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.
- package/electron/electron-builder.json +58 -0
- package/electron/main/main.cts +585 -0
- package/electron/main/preload.cts +51 -0
- package/electron/package-lock.json +8123 -0
- package/electron/package.json +52 -0
- package/electron/public/AXioDB.png +0 -0
- package/electron/resources/after-install.sh +45 -0
- package/electron/resources/after-remove.sh +29 -0
- package/electron/resources/icon.png +0 -0
- package/electron/resources/icons/128x128.png +0 -0
- package/electron/resources/icons/16x16.png +0 -0
- package/electron/resources/icons/24x24.png +0 -0
- package/electron/resources/icons/256x256.png +0 -0
- package/electron/resources/icons/32x32.png +0 -0
- package/electron/resources/icons/48x48.png +0 -0
- package/electron/resources/icons/512x512.png +0 -0
- package/electron/resources/icons/64x64.png +0 -0
- package/electron/src/App.jsx +128 -0
- package/electron/src/api/authApi.js +83 -0
- package/electron/src/api/client.js +102 -0
- package/electron/src/assets/AXioDB.png +0 -0
- package/electron/src/components/auth/CreateRoleModal.jsx +189 -0
- package/electron/src/components/auth/CreateUserModal.jsx +131 -0
- package/electron/src/components/auth/ForcePasswordChangeModal.jsx +132 -0
- package/electron/src/components/auth/ProtectedRoute.jsx +42 -0
- package/electron/src/components/auth/ResetPasswordModal.jsx +90 -0
- package/electron/src/components/auth/UserAvatarMenu.jsx +103 -0
- package/electron/src/components/collection/CreateCollectionModal.jsx +116 -0
- package/electron/src/components/collection/DeleteCollectionModal.jsx +85 -0
- package/electron/src/components/collection/SchemaViewModal.jsx +369 -0
- package/electron/src/components/dashboard/CollectionsChart.jsx +94 -0
- package/electron/src/components/dashboard/DatabaseTreeView.jsx +130 -0
- package/electron/src/components/dashboard/InMemoryCacheCard.jsx +60 -0
- package/electron/src/components/dashboard/StorageDonut.jsx +76 -0
- package/electron/src/components/dashboard/StorageUsageCard.jsx +59 -0
- package/electron/src/components/dashboard/TotalCollectionsCard.jsx +47 -0
- package/electron/src/components/dashboard/TotalDatabasesCard.jsx +43 -0
- package/electron/src/components/dashboard/TotalDocumentsCard.jsx +44 -0
- package/electron/src/components/database/CreateDatabaseModal.jsx +109 -0
- package/electron/src/components/database/DeleteDatabaseModal.jsx +97 -0
- package/electron/src/components/query/CodeEditor.jsx +343 -0
- package/electron/src/components/query/ObjectEditor.jsx +115 -0
- package/electron/src/components/query/ObjectView.jsx +44 -0
- package/electron/src/components/query/QueryEditor.jsx +32 -0
- package/electron/src/components/query/queryLanguage.js +755 -0
- package/electron/src/components/ui/Button.jsx +58 -0
- package/electron/src/components/ui/Card.jsx +29 -0
- package/electron/src/components/ui/ErrorBoundary.jsx +108 -0
- package/electron/src/components/ui/Feedback.jsx +66 -0
- package/electron/src/components/ui/Field.jsx +65 -0
- package/electron/src/components/ui/MetricCard.jsx +104 -0
- package/electron/src/components/ui/Modal.jsx +119 -0
- package/electron/src/components/ui/Page.jsx +40 -0
- package/electron/src/config/key.js +11 -0
- package/electron/src/index.css +181 -0
- package/electron/src/index.html +13 -0
- package/electron/src/layout/Sidebar.jsx +478 -0
- package/electron/src/layout/StatusBar.jsx +70 -0
- package/electron/src/layout/Titlebar.jsx +128 -0
- package/electron/src/main.jsx +42 -0
- package/electron/src/pages/ConnectionHub.jsx +464 -0
- package/electron/src/pages/Dashboard.jsx +128 -0
- package/electron/src/pages/Documents.jsx +823 -0
- package/electron/src/pages/Import.jsx +527 -0
- package/electron/src/pages/UserManagement.jsx +294 -0
- package/electron/src/pages/Welcome.jsx +157 -0
- package/electron/src/store/authStore.js +30 -0
- package/electron/src/store/connectionStore.js +103 -0
- package/electron/src/store/dbStore.js +165 -0
- package/electron/src/store/store.js +8 -0
- package/electron/src/utils/format.js +39 -0
- package/electron/vite.config.js +28 -0
- package/lib/Services/Indexation.operation.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import apiClient from "../api/client";
|
|
3
|
+
|
|
4
|
+
export const useDbStore = create((set, get) => ({
|
|
5
|
+
databases: [],
|
|
6
|
+
collectionsMap: {}, // { [dbName]: [ { name, count, size } ] }
|
|
7
|
+
expandedDbs: {}, // { [dbName]: boolean }
|
|
8
|
+
selectedDatabase: "",
|
|
9
|
+
selectedCollection: "",
|
|
10
|
+
activeTab: "documents", // 'documents' | 'query'
|
|
11
|
+
loadingTree: false,
|
|
12
|
+
treeError: null,
|
|
13
|
+
|
|
14
|
+
setSelectedDatabase: (dbName) => {
|
|
15
|
+
set({ selectedDatabase: dbName, selectedCollection: "" });
|
|
16
|
+
if (dbName && !get().collectionsMap[dbName]) {
|
|
17
|
+
get().fetchCollections(dbName);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
setSelectedCollection: (dbName, collName) => {
|
|
22
|
+
set({
|
|
23
|
+
selectedDatabase: dbName,
|
|
24
|
+
selectedCollection: collName,
|
|
25
|
+
expandedDbs: { ...get().expandedDbs, [dbName]: true },
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
setActiveTab: (tab) => set({ activeTab: tab }),
|
|
30
|
+
|
|
31
|
+
toggleDbExpanded: (dbName) => {
|
|
32
|
+
const isCurrentlyExpanded = !!get().expandedDbs[dbName];
|
|
33
|
+
set({
|
|
34
|
+
expandedDbs: {
|
|
35
|
+
...get().expandedDbs,
|
|
36
|
+
[dbName]: !isCurrentlyExpanded,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (!isCurrentlyExpanded && !get().collectionsMap[dbName]) {
|
|
41
|
+
get().fetchCollections(dbName);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
fetchDatabases: async () => {
|
|
46
|
+
try {
|
|
47
|
+
set({ loadingTree: true, treeError: null });
|
|
48
|
+
const res = await apiClient.get("/api/db/databases");
|
|
49
|
+
const data = res.data?.data || {};
|
|
50
|
+
const list = Array.isArray(data.ListOfDatabases) ? data.ListOfDatabases : [];
|
|
51
|
+
set({ databases: list, loadingTree: false });
|
|
52
|
+
|
|
53
|
+
// Automatically select and expand first database if none selected
|
|
54
|
+
if (list.length > 0 && !get().selectedDatabase) {
|
|
55
|
+
const firstDb = list[0];
|
|
56
|
+
set({
|
|
57
|
+
selectedDatabase: firstDb,
|
|
58
|
+
expandedDbs: { [firstDb]: true },
|
|
59
|
+
});
|
|
60
|
+
get().fetchCollections(firstDb);
|
|
61
|
+
}
|
|
62
|
+
return list;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error("Failed to load databases:", err);
|
|
65
|
+
set({
|
|
66
|
+
loadingTree: false,
|
|
67
|
+
treeError: err.response?.data?.message || "Failed to load databases",
|
|
68
|
+
});
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
fetchCollections: async (dbName) => {
|
|
74
|
+
if (!dbName) return [];
|
|
75
|
+
try {
|
|
76
|
+
const res = await apiClient.get(`/api/collection/all/?databaseName=${encodeURIComponent(dbName)}`);
|
|
77
|
+
const data = res.data?.data || {};
|
|
78
|
+
const list = Array.isArray(data.ListOfCollections) ? data.ListOfCollections : [];
|
|
79
|
+
const metaStatus = Array.isArray(data.collectionMetaStatus) ? data.collectionMetaStatus : [];
|
|
80
|
+
const sizeMap = Array.isArray(data.CollectionSizeMap) ? data.CollectionSizeMap : [];
|
|
81
|
+
|
|
82
|
+
const formatted = list.map((collName) => {
|
|
83
|
+
const meta = metaStatus.find((m) => m.name === collName) || {};
|
|
84
|
+
const sizeEntry = sizeMap.find((s) => s.folderPath?.endsWith(`/${collName}`)) || {};
|
|
85
|
+
return {
|
|
86
|
+
name: collName,
|
|
87
|
+
count: meta.totalDocuments ?? meta.count ?? 0,
|
|
88
|
+
size: sizeEntry.size ?? meta.size ?? 0,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
set({
|
|
93
|
+
collectionsMap: {
|
|
94
|
+
...get().collectionsMap,
|
|
95
|
+
[dbName]: formatted,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// If this is the active database and no collection is selected yet, select first collection
|
|
100
|
+
if (get().selectedDatabase === dbName && !get().selectedCollection && formatted.length > 0) {
|
|
101
|
+
set({ selectedCollection: formatted[0].name });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return formatted;
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error(`Failed to fetch collections for ${dbName}:`, err);
|
|
107
|
+
set({
|
|
108
|
+
collectionsMap: {
|
|
109
|
+
...get().collectionsMap,
|
|
110
|
+
[dbName]: [],
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
addDatabaseLocally: (dbName) => {
|
|
118
|
+
const list = Array.from(new Set([...get().databases, dbName]));
|
|
119
|
+
set({
|
|
120
|
+
databases: list,
|
|
121
|
+
selectedDatabase: dbName,
|
|
122
|
+
selectedCollection: "",
|
|
123
|
+
expandedDbs: { ...get().expandedDbs, [dbName]: true },
|
|
124
|
+
collectionsMap: { ...get().collectionsMap, [dbName]: [] },
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
removeDatabaseLocally: (dbName) => {
|
|
129
|
+
const updated = get().databases.filter((d) => d !== dbName);
|
|
130
|
+
const newCollectionsMap = { ...get().collectionsMap };
|
|
131
|
+
delete newCollectionsMap[dbName];
|
|
132
|
+
|
|
133
|
+
set({
|
|
134
|
+
databases: updated,
|
|
135
|
+
collectionsMap: newCollectionsMap,
|
|
136
|
+
selectedDatabase: updated[0] || "",
|
|
137
|
+
selectedCollection: "",
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
addCollectionLocally: (dbName, collName) => {
|
|
142
|
+
const current = get().collectionsMap[dbName] || [];
|
|
143
|
+
const updated = [...current.filter((c) => c.name !== collName), { name: collName, count: 0, size: 0 }];
|
|
144
|
+
set({
|
|
145
|
+
collectionsMap: {
|
|
146
|
+
...get().collectionsMap,
|
|
147
|
+
[dbName]: updated,
|
|
148
|
+
},
|
|
149
|
+
selectedDatabase: dbName,
|
|
150
|
+
selectedCollection: collName,
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
removeCollectionLocally: (dbName, collName) => {
|
|
155
|
+
const current = get().collectionsMap[dbName] || [];
|
|
156
|
+
const updated = current.filter((c) => c.name !== collName);
|
|
157
|
+
set({
|
|
158
|
+
collectionsMap: {
|
|
159
|
+
...get().collectionsMap,
|
|
160
|
+
[dbName]: updated,
|
|
161
|
+
},
|
|
162
|
+
selectedCollection: updated[0]?.name || "",
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function formatBytes(bytes, decimals = 2) {
|
|
2
|
+
if (bytes === 0 || !bytes) return "0 Bytes";
|
|
3
|
+
const k = 1024;
|
|
4
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
5
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
6
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
7
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function formatStorage(val, unit = "MB") {
|
|
11
|
+
if (val === undefined || val === null) return "0 MB";
|
|
12
|
+
if (typeof val === "number") {
|
|
13
|
+
return `${val.toLocaleString()} ${unit}`;
|
|
14
|
+
}
|
|
15
|
+
return `${val} ${unit}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function formatUptime(seconds) {
|
|
19
|
+
if (!Number.isFinite(seconds) || seconds < 0) return "—";
|
|
20
|
+
const days = Math.floor(seconds / 86400);
|
|
21
|
+
const hours = Math.floor((seconds % 86400) / 3600);
|
|
22
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
23
|
+
const secs = Math.floor(seconds % 60);
|
|
24
|
+
|
|
25
|
+
if (days > 0) return `${days}d ${hours}h ${minutes}m`;
|
|
26
|
+
if (hours > 0) return `${hours}h ${minutes}m`;
|
|
27
|
+
if (minutes > 0) return `${minutes}m ${secs}s`;
|
|
28
|
+
return `${secs}s`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function formatDate(dateString) {
|
|
32
|
+
if (!dateString) return "—";
|
|
33
|
+
try {
|
|
34
|
+
const date = new Date(dateString);
|
|
35
|
+
return date.toLocaleString();
|
|
36
|
+
} catch {
|
|
37
|
+
return String(dateString);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react-swc";
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [
|
|
8
|
+
tailwindcss(),
|
|
9
|
+
react()
|
|
10
|
+
],
|
|
11
|
+
base: "./",
|
|
12
|
+
root: "./src",
|
|
13
|
+
publicDir: "../public",
|
|
14
|
+
build: {
|
|
15
|
+
outDir: "../dist",
|
|
16
|
+
emptyOutDir: true,
|
|
17
|
+
sourcemap: false
|
|
18
|
+
},
|
|
19
|
+
resolve: {
|
|
20
|
+
alias: {
|
|
21
|
+
"@": path.resolve(__dirname, "./src")
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
server: {
|
|
25
|
+
port: 5173,
|
|
26
|
+
strictPort: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -125,7 +125,7 @@ class AxioDB {
|
|
|
125
125
|
Logger_helper_1.default.info(`AxioDB folder created at: ${this.currentPATH}`);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
if (this.GUI || (this.TCP && this.TCPAuth)) {
|
|
128
|
+
if (this.GUI || this.HTTP || (this.TCP && this.TCPAuth)) {
|
|
129
129
|
yield new AuthSeeder_service_1.default(this).seedIfNeeded();
|
|
130
130
|
LoginRateLimiter_service_1.default.startCleanupSweep();
|
|
131
131
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axiodb",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.4.2",
|
|
4
4
|
"description": "The embedded database for Node.js. Replaces SQLite, LowDB, NeDB & raw JSON files with MongoDB-style queries, ACID transactions, zero native dependencies, and built-in InMemoryCache. No compilation, no platform issues. Perfect for desktop apps, CLI tools, and embedded systems.",
|
|
5
5
|
"main": "./lib/config/DB.js",
|
|
6
6
|
"types": "./lib/config/DB.d.ts",
|