axiodb 22.2.2 → 22.4.2

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 (74) hide show
  1. package/electron/electron-builder.json +58 -0
  2. package/electron/main/main.cts +585 -0
  3. package/electron/main/preload.cts +51 -0
  4. package/electron/package-lock.json +8123 -0
  5. package/electron/package.json +52 -0
  6. package/electron/public/AXioDB.png +0 -0
  7. package/electron/resources/after-install.sh +45 -0
  8. package/electron/resources/after-remove.sh +29 -0
  9. package/electron/resources/icon.png +0 -0
  10. package/electron/resources/icons/128x128.png +0 -0
  11. package/electron/resources/icons/16x16.png +0 -0
  12. package/electron/resources/icons/24x24.png +0 -0
  13. package/electron/resources/icons/256x256.png +0 -0
  14. package/electron/resources/icons/32x32.png +0 -0
  15. package/electron/resources/icons/48x48.png +0 -0
  16. package/electron/resources/icons/512x512.png +0 -0
  17. package/electron/resources/icons/64x64.png +0 -0
  18. package/electron/src/App.jsx +128 -0
  19. package/electron/src/api/authApi.js +83 -0
  20. package/electron/src/api/client.js +102 -0
  21. package/electron/src/assets/AXioDB.png +0 -0
  22. package/electron/src/components/auth/CreateRoleModal.jsx +189 -0
  23. package/electron/src/components/auth/CreateUserModal.jsx +131 -0
  24. package/electron/src/components/auth/ForcePasswordChangeModal.jsx +132 -0
  25. package/electron/src/components/auth/ProtectedRoute.jsx +42 -0
  26. package/electron/src/components/auth/ResetPasswordModal.jsx +90 -0
  27. package/electron/src/components/auth/UserAvatarMenu.jsx +103 -0
  28. package/electron/src/components/collection/CreateCollectionModal.jsx +116 -0
  29. package/electron/src/components/collection/DeleteCollectionModal.jsx +85 -0
  30. package/electron/src/components/collection/SchemaViewModal.jsx +369 -0
  31. package/electron/src/components/dashboard/CollectionsChart.jsx +94 -0
  32. package/electron/src/components/dashboard/DatabaseTreeView.jsx +130 -0
  33. package/electron/src/components/dashboard/InMemoryCacheCard.jsx +60 -0
  34. package/electron/src/components/dashboard/StorageDonut.jsx +76 -0
  35. package/electron/src/components/dashboard/StorageUsageCard.jsx +59 -0
  36. package/electron/src/components/dashboard/TotalCollectionsCard.jsx +47 -0
  37. package/electron/src/components/dashboard/TotalDatabasesCard.jsx +43 -0
  38. package/electron/src/components/dashboard/TotalDocumentsCard.jsx +44 -0
  39. package/electron/src/components/database/CreateDatabaseModal.jsx +109 -0
  40. package/electron/src/components/database/DeleteDatabaseModal.jsx +97 -0
  41. package/electron/src/components/query/CodeEditor.jsx +343 -0
  42. package/electron/src/components/query/ObjectEditor.jsx +115 -0
  43. package/electron/src/components/query/ObjectView.jsx +44 -0
  44. package/electron/src/components/query/QueryEditor.jsx +32 -0
  45. package/electron/src/components/query/queryLanguage.js +755 -0
  46. package/electron/src/components/ui/Button.jsx +58 -0
  47. package/electron/src/components/ui/Card.jsx +29 -0
  48. package/electron/src/components/ui/ErrorBoundary.jsx +108 -0
  49. package/electron/src/components/ui/Feedback.jsx +66 -0
  50. package/electron/src/components/ui/Field.jsx +65 -0
  51. package/electron/src/components/ui/MetricCard.jsx +104 -0
  52. package/electron/src/components/ui/Modal.jsx +119 -0
  53. package/electron/src/components/ui/Page.jsx +40 -0
  54. package/electron/src/config/key.js +11 -0
  55. package/electron/src/index.css +181 -0
  56. package/electron/src/index.html +13 -0
  57. package/electron/src/layout/Sidebar.jsx +478 -0
  58. package/electron/src/layout/StatusBar.jsx +70 -0
  59. package/electron/src/layout/Titlebar.jsx +128 -0
  60. package/electron/src/main.jsx +42 -0
  61. package/electron/src/pages/ConnectionHub.jsx +464 -0
  62. package/electron/src/pages/Dashboard.jsx +128 -0
  63. package/electron/src/pages/Documents.jsx +823 -0
  64. package/electron/src/pages/Import.jsx +527 -0
  65. package/electron/src/pages/UserManagement.jsx +294 -0
  66. package/electron/src/pages/Welcome.jsx +157 -0
  67. package/electron/src/store/authStore.js +30 -0
  68. package/electron/src/store/connectionStore.js +103 -0
  69. package/electron/src/store/dbStore.js +165 -0
  70. package/electron/src/store/store.js +8 -0
  71. package/electron/src/utils/format.js +39 -0
  72. package/electron/vite.config.js +28 -0
  73. package/lib/Services/Indexation.operation.js +1 -1
  74. package/package.json +1 -1
@@ -0,0 +1,70 @@
1
+ import React from "react";
2
+ import { motion } from "framer-motion";
3
+ import { useConnectionStore } from "../store/connectionStore";
4
+ import { useAuthStore } from "../store/authStore";
5
+ import { useDbStore } from "../store/dbStore";
6
+
7
+ const StatusBar = () => {
8
+ const { protocol, host, port, pingLatency, isConnected } = useConnectionStore();
9
+ const { role } = useAuthStore();
10
+ const { selectedDatabase, selectedCollection } = useDbStore();
11
+ const isPingAlive = pingLatency !== null;
12
+
13
+ return (
14
+ <footer className="h-6 w-full bg-slate-100 border-t border-slate-200 flex items-center justify-between px-3 text-[11px] text-slate-600 select-none shrink-0 font-mono">
15
+ <div className="flex items-center gap-3">
16
+ <div className="flex items-center gap-1.5">
17
+ <span
18
+ className={`h-2 w-2 rounded-full transition-all ${
19
+ isConnected
20
+ ? isPingAlive
21
+ ? "bg-emerald-500 shadow-xs animate-pulseDot"
22
+ : "bg-emerald-500 shadow-xs animate-pulse"
23
+ : "bg-slate-400"
24
+ }`}
25
+ />
26
+ <span className="font-medium text-slate-700">{isConnected ? `${protocol}://${host}:${port}` : "Offline"}</span>
27
+ </div>
28
+
29
+ {isConnected && pingLatency !== null && (
30
+ <>
31
+ <span className="text-slate-300">|</span>
32
+ <motion.span
33
+ key={pingLatency}
34
+ initial={{ opacity: 0.5, scale: 0.9 }}
35
+ animate={{ opacity: 1, scale: 1 }}
36
+ transition={{ duration: 0.25, ease: "easeOut" }}
37
+ className="text-emerald-700 font-semibold"
38
+ >
39
+ {pingLatency} ms
40
+ </motion.span>
41
+ </>
42
+ )}
43
+
44
+ {selectedDatabase && (
45
+ <>
46
+ <span className="text-slate-300">|</span>
47
+ <span>
48
+ db: <span className="text-slate-900 font-semibold">{selectedDatabase}</span>
49
+ {selectedCollection && (
50
+ <> / coll: <span className="text-emerald-700 font-semibold">{selectedCollection}</span></>
51
+ )}
52
+ </span>
53
+ </>
54
+ )}
55
+ </div>
56
+
57
+ <div className="flex items-center gap-3">
58
+ {role && (
59
+ <>
60
+ <span>role: <span className="text-slate-800 font-semibold capitalize">{role}</span></span>
61
+ <span className="text-slate-300">|</span>
62
+ </>
63
+ )}
64
+ <span className="text-slate-400 font-sans">AxioDB Control v22.3.1</span>
65
+ </div>
66
+ </footer>
67
+ );
68
+ };
69
+
70
+ export default StatusBar;
@@ -0,0 +1,128 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { motion } from "framer-motion";
3
+ import { useConnectionStore } from "../store/connectionStore";
4
+ import { useAuthStore } from "../store/authStore";
5
+ import axioLogo from "../assets/AXioDB.png";
6
+
7
+ const Titlebar = () => {
8
+ const [isMaximized, setIsMaximized] = useState(false);
9
+ const { isConnected, host, port, pingLatency, disconnect } = useConnectionStore();
10
+ const isPingAlive = pingLatency !== null;
11
+ const { clearSession } = useAuthStore();
12
+
13
+ useEffect(() => {
14
+ if (window.electronAPI?.isMaximized) {
15
+ window.electronAPI.isMaximized().then(setIsMaximized);
16
+ }
17
+ if (window.electronAPI?.onMaximizeChange) {
18
+ return window.electronAPI.onMaximizeChange(setIsMaximized);
19
+ }
20
+ }, []);
21
+
22
+ const handleMinimize = () => window.electronAPI?.minimize();
23
+ const handleMaximize = () => window.electronAPI?.maximize();
24
+ const handleClose = () => window.electronAPI?.close();
25
+
26
+ const handleDisconnect = () => {
27
+ clearSession();
28
+ disconnect();
29
+ };
30
+
31
+ return (
32
+ <header className="drag-region h-10 w-full bg-white border-b border-slate-200 flex items-center justify-between px-3 select-none z-50 shrink-0 shadow-2xs">
33
+ {/* Brand & Connection Status */}
34
+ <div className="flex items-center gap-2.5 min-w-0">
35
+ <img src={axioLogo} alt="AxioDB" className="h-5 w-5 rounded-md no-drag shadow-2xs" />
36
+ <span className="text-xs font-bold tracking-tight text-slate-800">
37
+ AxioDB <span className="text-emerald-600 font-semibold">Control</span>
38
+ </span>
39
+
40
+ {isConnected ? (
41
+ <div className="ml-3 flex items-center gap-2 bg-emerald-50/80 border border-emerald-200/80 rounded-full px-2.5 py-0.5 no-drag">
42
+ <span
43
+ className={`relative flex h-2 w-2 rounded-full bg-emerald-500 ${isPingAlive ? "animate-pulseDot" : ""}`}
44
+ >
45
+ <span className="absolute inset-0 rounded-full bg-emerald-400 opacity-40 animate-ping"></span>
46
+ </span>
47
+ <span className="text-[11px] font-mono font-medium text-slate-700">
48
+ {host}:{port}
49
+ </span>
50
+ {pingLatency !== null && (
51
+ <motion.span
52
+ key={pingLatency}
53
+ initial={{ opacity: 0, scale: 0.85 }}
54
+ animate={{ opacity: 1, scale: 1 }}
55
+ transition={{ duration: 0.25, ease: "easeOut" }}
56
+ className="text-[10px] font-mono font-semibold text-emerald-700 bg-emerald-100/70 px-1.5 py-0.2 rounded"
57
+ >
58
+ {pingLatency}ms
59
+ </motion.span>
60
+ )}
61
+ </div>
62
+ ) : (
63
+ <span className="ml-2 text-[10px] uppercase font-mono tracking-wider text-slate-400 bg-slate-100 border border-slate-200 rounded px-1.5 py-0.5">
64
+ Disconnected
65
+ </span>
66
+ )}
67
+ </div>
68
+
69
+ {/* Center Drag Area */}
70
+ <div className="flex-1 h-full" />
71
+
72
+ {/* Right Controls */}
73
+ <div className="no-drag flex items-center gap-1">
74
+ {isConnected && (
75
+ <button
76
+ onClick={handleDisconnect}
77
+ className="mr-2 text-[11px] font-medium text-slate-600 hover:text-red-600 hover:bg-red-50 border border-slate-200 hover:border-red-200 px-2 py-0.5 rounded-md transition-colors flex items-center gap-1 shadow-2xs"
78
+ title="Disconnect from server"
79
+ >
80
+ <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
81
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
82
+ </svg>
83
+ Disconnect
84
+ </button>
85
+ )}
86
+
87
+ {/* Window controls */}
88
+ <button
89
+ onClick={handleMinimize}
90
+ className="h-7 w-8 flex items-center justify-center rounded text-slate-500 hover:text-slate-900 hover:bg-slate-100 transition-colors"
91
+ title="Minimize"
92
+ >
93
+ <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
94
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M20 12H4" />
95
+ </svg>
96
+ </button>
97
+
98
+ <button
99
+ onClick={handleMaximize}
100
+ className="h-7 w-8 flex items-center justify-center rounded text-slate-500 hover:text-slate-900 hover:bg-slate-100 transition-colors"
101
+ title={isMaximized ? "Restore" : "Maximize"}
102
+ >
103
+ {isMaximized ? (
104
+ <svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
105
+ <rect x="5" y="5" width="14" height="14" rx="2" strokeWidth={2} />
106
+ </svg>
107
+ ) : (
108
+ <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
109
+ <rect x="4" y="4" width="16" height="16" rx="2" strokeWidth={2} />
110
+ </svg>
111
+ )}
112
+ </button>
113
+
114
+ <button
115
+ onClick={handleClose}
116
+ className="h-7 w-8 flex items-center justify-center rounded text-slate-500 hover:text-white hover:bg-red-600 transition-colors"
117
+ title="Close"
118
+ >
119
+ <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
120
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
121
+ </svg>
122
+ </button>
123
+ </div>
124
+ </header>
125
+ );
126
+ };
127
+
128
+ export default Titlebar;
@@ -0,0 +1,42 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import axios from "axios";
4
+ import "./index.css";
5
+ import App from "./App";
6
+ import { useConnectionStore } from "./store/connectionStore";
7
+ import { useAuthStore } from "./store/authStore";
8
+ import { customIpcAdapter } from "./api/client";
9
+
10
+ // Global Axios configuration
11
+ axios.defaults.adapter = customIpcAdapter;
12
+ axios.defaults.withCredentials = true;
13
+
14
+ axios.interceptors.request.use((config) => {
15
+ const baseUrl = useConnectionStore.getState().getBaseUrl();
16
+ if (config.url && !config.url.startsWith("http://") && !config.url.startsWith("https://")) {
17
+ config.url = `${baseUrl.replace(/\/+$/, "")}/${config.url.replace(/^\/+/, "")}`;
18
+ }
19
+ return config;
20
+ });
21
+
22
+ axios.interceptors.response.use(
23
+ (response) => response,
24
+ (error) => {
25
+ if (error.response?.status === 401) {
26
+ const isLogin = error.config?.url?.includes("/api/auth/login");
27
+ if (!isLogin) {
28
+ useAuthStore.getState().clearSession();
29
+ useConnectionStore.getState().setConnectionError(
30
+ error.response?.data?.message || "Session expired or unauthorized (401). Please log in again."
31
+ );
32
+ }
33
+ }
34
+ return Promise.reject(error);
35
+ }
36
+ );
37
+
38
+ createRoot(document.getElementById("root")).render(
39
+ <StrictMode>
40
+ <App />
41
+ </StrictMode>
42
+ );