admindb 2.3.1 → 2.4.1
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/README.md +16 -16
- package/dist/app.js +119 -171
- package/dist/public/css/app.css +1 -1
- package/dist/public/js/browse.js +1 -1
- package/dist/public/js/databases.js +1 -1
- package/dist/public/js/designer.js +1 -1
- package/dist/public/js/forms.js +1 -1
- package/dist/public/js/home.js +1 -1
- package/dist/public/js/inspector.js +1 -1
- package/dist/public/js/query.js +1 -1
- package/dist/public/js/schema.js +1 -1
- package/dist/public/js/seed.js +1 -1
- package/dist/routes/api/erd.js +2 -2
- package/dist/routes/api/helpers.d.ts +1 -1
- package/dist/routes/api/import-export.js +8 -6
- package/dist/routes/api/index.js +16 -9
- package/dist/routes/api/query.js +8 -5
- package/dist/routes/api/rows.js +36 -21
- package/dist/routes/api/seed.js +29 -16
- package/dist/routes/api/tables.js +32 -18
- package/dist/routes/databases.js +2 -0
- package/dist/routes/pages.d.ts +1 -1
- package/dist/routes/pages.js +137 -43
- package/dist/views/layouts/main.hbs +1 -1
- package/dist/views/pages/databases.hbs +1 -1
- package/dist/views/pages/erd.hbs +1 -1
- package/dist/views/pages/form.hbs +1 -1
- package/dist/views/pages/home.hbs +1 -1
- package/dist/views/pages/info.hbs +1 -1
- package/dist/views/pages/schema.hbs +1 -1
- package/dist/views/pages/seed-select.hbs +6 -5
- package/dist/views/pages/seed.hbs +3 -3
- package/dist/views/pages/table.hbs +1 -1
- package/dist/views/partials/navbar.hbs +1 -1
- package/dist/views/partials/sidebar.hbs +1 -1
- package/docs/API.md +60 -55
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
<div class="sticky top-0 z-30 border-b border-base-300/80 bg-base-100/85 backdrop-blur-md">
|
|
2
1
|
<div class="navbar mx-auto w-full max-w-[1500px] px-4 sm:px-6 lg:px-8">
|
|
3
2
|
<div class="flex-none lg:hidden">
|
|
4
3
|
<label for="sidebar-toggle" class="btn btn-square btn-ghost" aria-label="open sidebar">
|
|
5
4
|
{{{icon "menu" class="h-5 w-5"}}}
|
|
6
5
|
</label>
|
|
7
6
|
</div>
|
|
8
7
|
<div class="flex flex-1 items-center gap-3">
|
|
9
8
|
<a href="{{basePath}}/" class="flex items-center gap-2.5">
|
|
10
9
|
<span class="font-headings text-lg font-bold tracking-tight text-base-content">Admin<span class="text-primary">DB</span></span>
|
|
11
10
|
</a>
|
|
12
11
|
{{#unless databasesMode}}
|
|
13
12
|
{{#if isPostgres}}
|
|
14
13
|
<span class="inline-flex items-center gap-1.5 rounded-lg border border-info/40 bg-info/10 px-2.5 py-0.5 text-xs font-semibold text-info" title="Engine: PostgreSQL ({{dbPath}})">
|
|
15
14
|
<span class="h-2 w-2 rounded-full bg-info animate-pulse"></span>
|
|
16
15
|
PostgreSQL
|
|
17
16
|
</span>
|
|
18
17
|
{{else}}
|
|
19
18
|
<span class="inline-flex items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-2.5 py-0.5 text-xs font-semibold text-emerald-600 dark:text-emerald-400" title="Engine: SQLite ({{dbPath}})">
|
|
20
19
|
<span class="h-2 w-2 rounded-full bg-emerald-500 animate-pulse"></span>
|
|
21
20
|
SQLite
|
|
22
21
|
</span>
|
|
23
22
|
{{/if}}
|
|
24
23
|
{{/unless}}
|
|
25
24
|
</div>
|
|
26
25
|
<div class="flex items-center gap-1.5">
|
|
27
26
|
{{#unless noSidebar}}
|
|
28
27
|
{{#unless databasesMode}}
|
|
29
28
|
{{#if databasesUrl}}
|
|
30
29
|
<a href="{{databasesUrl}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
31
30
|
{{{icon "database" class="h-4 w-4"}}}
|
|
32
31
|
Databases
|
|
33
32
|
</a>
|
|
34
33
|
{{/if}}
|
|
35
34
|
<a href="{{basePath}}/query" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
36
35
|
{{{icon "query" class="h-4 w-4"}}}
|
|
37
36
|
Query
|
|
38
37
|
</a>
|
|
39
38
|
{{#unless readonly}}
|
|
40
39
|
<a href="{{basePath}}/designer" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
41
40
|
{{{icon "plus" class="h-4 w-4"}}}
|
|
42
41
|
New table
|
|
43
42
|
</a>
|
|
44
43
|
{{/unless}}
|
|
45
44
|
<a href="{{basePath}}/export" class="btn btn-ghost btn-sm hidden gap-1.5 md:inline-flex">
|
|
46
45
|
{{{icon "export" class="h-4 w-4"}}}
|
|
47
46
|
Export
|
|
48
47
|
</a>
|
|
49
48
|
{{/unless}}
|
|
50
49
|
{{/unless}}
|
|
51
50
|
{{#if authEnabled}}
|
|
52
51
|
{{#if authUser}}
|
|
53
52
|
<div class="dropdown dropdown-end">
|
|
54
53
|
<label tabindex="0" class="btn btn-ghost btn-sm gap-1.5 normal-case font-medium">
|
|
55
54
|
{{{icon "user" class="h-4 w-4 text-base-content/70"}}}
|
|
56
55
|
<span class="max-w-[120px] truncate text-xs">{{authUser}}</span>
|
|
57
56
|
</label>
|
|
58
57
|
<ul tabindex="0" class="dropdown-content menu p-2 shadow-soft bg-base-100 rounded-xl w-56 border border-base-300 z-50 mt-1 text-sm space-y-1">
|
|
59
58
|
<li class="menu-title px-2 py-1 text-xs text-base-content/50">Signed in as <strong class="text-base-content">{{authUser}}</strong></li>
|
|
60
59
|
{{#if isDefaultPassword}}
|
|
61
60
|
<li class="rounded-lg bg-warning/10 p-2 text-[11px] text-warning border border-warning/20">
|
|
62
61
|
<div class="flex items-center gap-1.5 font-semibold p-0">
|
|
63
62
|
{{{icon "warning" class="h-3.5 w-3.5 shrink-0"}}}
|
|
64
63
|
<span>Default pass active (admin)</span>
|
|
65
64
|
</div>
|
|
66
65
|
</li>
|
|
67
66
|
{{/if}}
|
|
68
67
|
<li>
|
|
69
68
|
<form method="POST" action="{{basePath}}/logout" class="p-0">
|
|
70
69
|
<button type="submit" class="w-full text-left flex items-center gap-2 px-3 py-2 text-error hover:bg-error/10 rounded-lg">
|
|
71
70
|
{{{icon "logout" class="h-4 w-4"}}}
|
|
72
71
|
Sign out
|
|
73
72
|
</button>
|
|
74
73
|
</form>
|
|
75
74
|
</li>
|
|
76
75
|
</ul>
|
|
77
76
|
</div>
|
|
78
77
|
{{/if}}
|
|
79
78
|
{{/if}}
|
|
80
79
|
<button id="theme-toggle" type="button" class="btn btn-square btn-ghost btn-sm" aria-label="Toggle dark mode" title="Toggle dark mode">
|
|
81
80
|
{{{icon "moon" class="h-5 w-5"}}}
|
|
82
81
|
</button>
|
|
83
82
|
</div>
|
|
84
83
|
</div>
|
|
84
|
+
<div class="sticky top-0 z-30 border-b border-base-300/80 bg-base-100/85 backdrop-blur-md">
|
|
85
85
|
<div class="navbar mx-auto w-full max-w-[1500px] px-4 sm:px-6 lg:px-8">
|
|
86
86
|
<div class="flex-none lg:hidden">
|
|
87
87
|
<label for="sidebar-toggle" class="btn btn-square btn-ghost" aria-label="open sidebar">
|
|
88
88
|
{{{icon "menu" class="h-5 w-5"}}}
|
|
89
89
|
</label>
|
|
90
90
|
</div>
|
|
91
91
|
<div class="flex flex-1 items-center gap-3">
|
|
92
92
|
<a href="{{basePath}}/" class="flex items-center gap-2.5">
|
|
93
93
|
<span class="font-headings text-lg font-bold tracking-tight text-base-content">Admin<span class="text-primary">DB</span></span>
|
|
94
94
|
</a>
|
|
95
95
|
{{#unless databasesMode}}
|
|
96
96
|
{{#if isPostgres}}
|
|
97
97
|
<span class="inline-flex items-center gap-1.5 rounded-lg border border-info/40 bg-info/10 px-2.5 py-0.5 text-xs font-semibold text-info" title="Engine: PostgreSQL ({{dbPath}})">
|
|
98
98
|
<span class="h-2 w-2 rounded-full bg-info animate-pulse"></span>
|
|
99
99
|
PostgreSQL
|
|
100
100
|
</span>
|
|
101
101
|
{{else}}
|
|
102
102
|
<span class="inline-flex items-center gap-1.5 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-2.5 py-0.5 text-xs font-semibold text-emerald-600 dark:text-emerald-400" title="Engine: SQLite ({{dbPath}})">
|
|
103
103
|
<span class="h-2 w-2 rounded-full bg-emerald-500 animate-pulse"></span>
|
|
104
104
|
SQLite
|
|
105
105
|
</span>
|
|
106
106
|
{{/if}}
|
|
107
107
|
{{/unless}}
|
|
108
108
|
</div>
|
|
109
109
|
<div class="flex items-center gap-1.5">
|
|
110
110
|
{{#unless noSidebar}}
|
|
111
111
|
{{#unless databasesMode}}
|
|
112
112
|
{{#if databasesUrl}}
|
|
113
113
|
<a href="{{databasesUrl}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
114
114
|
{{{icon "database" class="h-4 w-4"}}}
|
|
115
115
|
Databases
|
|
116
116
|
</a>
|
|
117
117
|
{{/if}}
|
|
118
118
|
<a href="{{basePath}}/query/{{encodeUri dbId}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
119
119
|
{{{icon "query" class="h-4 w-4"}}}
|
|
120
120
|
Query
|
|
121
121
|
</a>
|
|
122
122
|
{{#unless readonly}}
|
|
123
123
|
<a href="{{basePath}}/designer/{{encodeUri dbId}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
|
|
124
124
|
{{{icon "plus" class="h-4 w-4"}}}
|
|
125
125
|
New table
|
|
126
126
|
</a>
|
|
127
127
|
{{/unless}}
|
|
128
128
|
<a href="{{basePath}}/export/{{encodeUri dbId}}" class="btn btn-ghost btn-sm hidden gap-1.5 md:inline-flex">
|
|
129
129
|
{{{icon "export" class="h-4 w-4"}}}
|
|
130
130
|
Export
|
|
131
131
|
</a>
|
|
132
132
|
{{/unless}}
|
|
133
133
|
{{/unless}}
|
|
134
134
|
{{#if authEnabled}}
|
|
135
135
|
{{#if authUser}}
|
|
136
136
|
<div class="dropdown dropdown-end">
|
|
137
137
|
<label tabindex="0" class="btn btn-ghost btn-sm gap-1.5 normal-case font-medium">
|
|
138
138
|
{{{icon "user" class="h-4 w-4 text-base-content/70"}}}
|
|
139
139
|
<span class="max-w-[120px] truncate text-xs">{{authUser}}</span>
|
|
140
140
|
</label>
|
|
141
141
|
<ul tabindex="0" class="dropdown-content menu p-2 shadow-soft bg-base-100 rounded-xl w-56 border border-base-300 z-50 mt-1 text-sm space-y-1">
|
|
142
142
|
<li class="menu-title px-2 py-1 text-xs text-base-content/50">Signed in as <strong class="text-base-content">{{authUser}}</strong></li>
|
|
143
143
|
{{#if isDefaultPassword}}
|
|
144
144
|
<li class="rounded-lg bg-warning/10 p-2 text-[11px] text-warning border border-warning/20">
|
|
145
145
|
<div class="flex items-center gap-1.5 font-semibold p-0">
|
|
146
146
|
{{{icon "warning" class="h-3.5 w-3.5 shrink-0"}}}
|
|
147
147
|
<span>Default pass active (admin)</span>
|
|
148
148
|
</div>
|
|
149
149
|
</li>
|
|
150
150
|
{{/if}}
|
|
151
151
|
<li>
|
|
152
152
|
<form method="POST" action="{{basePath}}/logout" class="p-0">
|
|
153
153
|
<button type="submit" class="w-full text-left flex items-center gap-2 px-3 py-2 text-error hover:bg-error/10 rounded-lg">
|
|
154
154
|
{{{icon "logout" class="h-4 w-4"}}}
|
|
155
155
|
Sign out
|
|
156
156
|
</button>
|
|
157
157
|
</form>
|
|
158
158
|
</li>
|
|
159
159
|
</ul>
|
|
160
160
|
</div>
|
|
161
161
|
{{/if}}
|
|
162
162
|
{{/if}}
|
|
163
163
|
<button id="theme-toggle" type="button" class="btn btn-square btn-ghost btn-sm" aria-label="Toggle dark mode" title="Toggle dark mode">
|
|
164
164
|
{{{icon "moon" class="h-5 w-5"}}}
|
|
165
165
|
</button>
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<aside class="flex h-full min-h-full w-72 flex-col bg-neutral text-neutral-content">
|
|
2
1
|
<div class="flex items-center gap-2.5 px-5 pb-4 pt-5">
|
|
3
2
|
<div class="w-full">
|
|
4
3
|
<div class="flex items-center justify-between">
|
|
5
4
|
<div class="font-headings text-base font-bold leading-tight">AdminDB <span style="font-size: x-small" class="font-sans font-normal opacity-70">{{#if version}}v{{version}}{{/if}}</span></div>
|
|
6
5
|
{{#unless databasesMode}}
|
|
7
6
|
{{#if isPostgres}}
|
|
8
7
|
<span class="rounded bg-info/20 px-1.5 py-0.5 text-[10px] font-bold text-info">PostgreSQL</span>
|
|
9
8
|
{{else}}
|
|
10
9
|
<span class="rounded bg-emerald-500/20 px-1.5 py-0.5 text-[10px] font-bold text-emerald-400">SQLite</span>
|
|
11
10
|
{{/if}}
|
|
12
11
|
{{/unless}}
|
|
13
12
|
</div>
|
|
14
13
|
<div class="mt-0.5 text-[11px] text-neutral-content/50 truncate">{{#if databasesMode}}Database manager{{else}}{{dbId}}{{/if}}</div>
|
|
15
14
|
</div>
|
|
16
15
|
</div>
|
|
17
16
|
{{#if databasesMode}}
|
|
18
17
|
<nav class="flex-1 overflow-y-auto px-3 py-2">
|
|
19
18
|
<ul class="space-y-0.5">
|
|
20
19
|
<li>
|
|
21
20
|
<a href="{{basePath}}/" class="side-link active">
|
|
22
21
|
{{{icon "database" class="h-4 w-4"}}}
|
|
23
22
|
Databases
|
|
24
23
|
</a>
|
|
25
24
|
</li>
|
|
26
25
|
</ul>
|
|
27
26
|
</nav>
|
|
28
27
|
{{else}}
|
|
29
28
|
<div class="px-4 pb-2">
|
|
30
29
|
<label class="relative block">
|
|
31
30
|
<span class="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-content/40">
|
|
32
31
|
{{{icon "search" class="h-4 w-4"}}}
|
|
33
32
|
</span>
|
|
34
33
|
<input id="table-search" type="search" placeholder="Filter tables…" autocomplete="off"
|
|
35
34
|
class="w-full rounded-lg border border-white/10 bg-white/[0.06] py-2 pl-9 pr-3 text-sm text-neutral-content outline-none transition placeholder:text-neutral-content/40 focus:border-primary/70 focus:ring-4 focus:ring-primary/20" />
|
|
36
35
|
</label>
|
|
37
36
|
</div>
|
|
38
37
|
<nav class="flex-1 overflow-y-auto px-3 py-2">
|
|
39
38
|
<ul class="space-y-0.5">
|
|
40
39
|
{{#if databasesUrl}}
|
|
41
40
|
<li>
|
|
42
41
|
<a href="{{databasesUrl}}" class="side-link">
|
|
43
42
|
{{{icon "database" class="h-4 w-4"}}}
|
|
44
43
|
Databases
|
|
45
44
|
</a>
|
|
46
45
|
</li>
|
|
47
46
|
{{/if}}
|
|
48
47
|
<li>
|
|
49
48
|
<a href="{{basePath}}/" class="side-link {{#if (eq currentPath '/')}}active{{/if}}">
|
|
50
49
|
{{{icon "home" class="h-4 w-4"}}}
|
|
51
50
|
Home
|
|
52
51
|
</a>
|
|
53
52
|
</li>
|
|
54
53
|
<li>
|
|
55
54
|
<a href="{{basePath}}/query" class="side-link {{#if (startsWith currentPath '/query')}}active{{/if}}">
|
|
56
55
|
{{{icon "query" class="h-4 w-4"}}}
|
|
57
56
|
Query editor
|
|
58
57
|
</a>
|
|
59
58
|
</li>
|
|
60
59
|
<li>
|
|
61
60
|
<a href="{{basePath}}/erd" class="side-link {{#if (startsWith currentPath '/erd')}}active{{/if}}">
|
|
62
61
|
{{{icon "diagram" class="h-4 w-4"}}}
|
|
63
62
|
ER Diagram
|
|
64
63
|
</a>
|
|
65
64
|
</li>
|
|
66
65
|
<li>
|
|
67
66
|
<a href="{{basePath}}/seed" class="side-link {{#if (startsWith currentPath '/seed')}}active{{/if}}">
|
|
68
67
|
{{{icon "seed" class="h-4 w-4"}}}
|
|
69
68
|
Seed generator
|
|
70
69
|
</a>
|
|
71
70
|
</li>
|
|
72
71
|
<li>
|
|
73
72
|
<a href="{{basePath}}/info" class="side-link {{#if (startsWith currentPath '/info')}}active{{/if}}">
|
|
74
73
|
{{{icon "settings" class="h-4 w-4"}}}
|
|
75
74
|
Info & Settings
|
|
76
75
|
</a>
|
|
77
76
|
</li>
|
|
78
77
|
{{#unless readonly}}
|
|
79
78
|
<li>
|
|
80
79
|
<a href="{{basePath}}/designer" class="side-link {{#if (startsWith currentPath '/designer')}}active{{/if}}">
|
|
81
80
|
{{{icon "plus" class="h-4 w-4"}}}
|
|
82
81
|
New table
|
|
83
82
|
</a>
|
|
84
83
|
</li>
|
|
85
84
|
{{/unless}}
|
|
86
85
|
</ul>
|
|
87
86
|
<div class="mb-2 mt-6 flex items-center justify-between px-3">
|
|
88
87
|
<span class="text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Tables</span>
|
|
89
88
|
<span id="table-count" class="rounded-md bg-white/[0.06] px-1.5 py-0.5 text-[10px] font-semibold text-neutral-content/50">{{tables.length}}</span>
|
|
90
89
|
</div>
|
|
91
90
|
<ul id="table-list" class="space-y-0.5">
|
|
92
91
|
{{#each tables}}
|
|
93
92
|
<li class="table-item" data-name="{{this}}">
|
|
94
93
|
<a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
|
|
95
94
|
<span class="table-icon">
|
|
96
95
|
{{{icon "table" class="h-4 w-4"}}}
|
|
97
96
|
</span>
|
|
98
97
|
<span class="truncate">{{this}}</span>
|
|
99
98
|
</a>
|
|
100
99
|
</li>
|
|
101
100
|
{{else}}
|
|
102
101
|
<li class="px-3 py-2 text-xs text-neutral-content/40">No tables yet</li>
|
|
103
102
|
{{/each}}
|
|
104
103
|
</ul>
|
|
105
104
|
{{#if internalTables.length}}
|
|
106
105
|
<div class="mb-2 mt-6 px-3 text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Internal</div>
|
|
107
106
|
<ul class="space-y-0.5">
|
|
108
107
|
{{#each internalTables}}
|
|
109
108
|
<li>
|
|
110
109
|
<a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
|
|
111
110
|
<span class="table-icon">
|
|
112
111
|
{{{icon "book" class="h-4 w-4"}}}
|
|
113
112
|
</span>
|
|
114
113
|
<span class="truncate">{{this}}</span>
|
|
115
114
|
</a>
|
|
116
115
|
</li>
|
|
117
116
|
{{/each}}
|
|
118
117
|
</ul>
|
|
119
118
|
{{/if}}
|
|
120
119
|
</nav>
|
|
121
120
|
{{/if}}
|
|
122
121
|
{{#if isDefaultPassword}}
|
|
123
122
|
<div class="border-t border-white/10 px-4 py-2 bg-warning/10">
|
|
124
123
|
<div class="flex items-center justify-between text-warning text-xs font-semibold">
|
|
125
124
|
<span class="flex items-center gap-1.5 font-mono text-[11px]">
|
|
126
125
|
{{{icon "warning" class="h-3.5 w-3.5 shrink-0"}}}
|
|
127
126
|
default pass active
|
|
128
127
|
</span>
|
|
129
128
|
<span class="badge badge-warning badge-xs font-mono font-bold">admin</span>
|
|
130
129
|
</div>
|
|
131
130
|
</div>
|
|
132
131
|
{{/if}}
|
|
133
132
|
<div class="border-t border-white/10 px-5 py-3">
|
|
134
133
|
<div class="flex items-center justify-between">
|
|
135
134
|
<div class="text-[11px] font-medium uppercase tracking-wider text-neutral-content/40">{{#if databasesMode}}Directory{{else}}Engine: {{dialectName}}{{/if}}</div>
|
|
136
135
|
{{#unless databasesMode}}
|
|
137
136
|
{{#if readonly}}
|
|
138
137
|
<span class="rounded bg-warning/20 px-1.5 py-0.5 text-[9px] font-bold uppercase text-warning">Read-only</span>
|
|
139
138
|
{{else}}
|
|
140
139
|
<span class="rounded bg-success/20 px-1.5 py-0.5 text-[9px] font-bold uppercase text-success">Writable</span>
|
|
141
140
|
{{/if}}
|
|
142
141
|
{{/unless}}
|
|
143
142
|
</div>
|
|
144
143
|
<div class="mt-0.5 truncate font-mono text-[11px] text-neutral-content/60" title="{{dbPath}}">{{dbPath}}</div>
|
|
145
144
|
</div>
|
|
145
|
+
<aside class="flex h-full min-h-full w-72 flex-col bg-neutral text-neutral-content">
|
|
146
146
|
<div class="flex items-center gap-2.5 px-5 pb-4 pt-5">
|
|
147
147
|
<div class="w-full">
|
|
148
148
|
<div class="flex items-center justify-between">
|
|
149
149
|
<div class="font-headings text-base font-bold leading-tight">AdminDB <span style="font-size: x-small" class="font-sans font-normal opacity-70">{{#if version}}v{{version}}{{/if}}</span></div>
|
|
150
150
|
{{#unless databasesMode}}
|
|
151
151
|
{{#if isPostgres}}
|
|
152
152
|
<span class="rounded bg-info/20 px-1.5 py-0.5 text-[10px] font-bold text-info">PostgreSQL</span>
|
|
153
153
|
{{else}}
|
|
154
154
|
<span class="rounded bg-emerald-500/20 px-1.5 py-0.5 text-[10px] font-bold text-emerald-400">SQLite</span>
|
|
155
155
|
{{/if}}
|
|
156
156
|
{{/unless}}
|
|
157
157
|
</div>
|
|
158
158
|
<div class="mt-0.5 text-[11px] text-neutral-content/50 truncate">{{#if databasesMode}}Database manager{{else}}{{dbId}}{{/if}}</div>
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
{{#if databasesMode}}
|
|
162
162
|
<nav class="flex-1 overflow-y-auto px-3 py-2">
|
|
163
163
|
<ul class="space-y-0.5">
|
|
164
164
|
<li>
|
|
165
165
|
<a href="{{basePath}}/" class="side-link active">
|
|
166
166
|
{{{icon "database" class="h-4 w-4"}}}
|
|
167
167
|
Databases
|
|
168
168
|
</a>
|
|
169
169
|
</li>
|
|
170
170
|
</ul>
|
|
171
171
|
</nav>
|
|
172
172
|
{{else}}
|
|
173
173
|
<div class="px-4 pb-2">
|
|
174
174
|
<label class="relative block">
|
|
175
175
|
<span class="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-content/40">
|
|
176
176
|
{{{icon "search" class="h-4 w-4"}}}
|
|
177
177
|
</span>
|
|
178
178
|
<input id="table-search" type="search" placeholder="Filter tables…" autocomplete="off"
|
|
179
179
|
class="w-full rounded-lg border border-white/10 bg-white/[0.06] py-2 pl-9 pr-3 text-sm text-neutral-content outline-none transition placeholder:text-neutral-content/40 focus:border-primary/70 focus:ring-4 focus:ring-primary/20" />
|
|
180
180
|
</label>
|
|
181
181
|
</div>
|
|
182
182
|
<nav class="flex-1 overflow-y-auto px-3 py-2">
|
|
183
183
|
<ul class="space-y-0.5">
|
|
184
184
|
{{#if databasesUrl}}
|
|
185
185
|
<li>
|
|
186
186
|
<a href="{{databasesUrl}}" class="side-link">
|
|
187
187
|
{{{icon "database" class="h-4 w-4"}}}
|
|
188
188
|
Databases
|
|
189
189
|
</a>
|
|
190
190
|
</li>
|
|
191
191
|
{{/if}}
|
|
192
192
|
<li>
|
|
193
193
|
<a href="{{basePath}}/home/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/home')}}active{{/if}}">
|
|
194
194
|
{{{icon "home" class="h-4 w-4"}}}
|
|
195
195
|
Home
|
|
196
196
|
</a>
|
|
197
197
|
</li>
|
|
198
198
|
<li>
|
|
199
199
|
<a href="{{basePath}}/query/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/query')}}active{{/if}}">
|
|
200
200
|
{{{icon "query" class="h-4 w-4"}}}
|
|
201
201
|
Query editor
|
|
202
202
|
</a>
|
|
203
203
|
</li>
|
|
204
204
|
<li>
|
|
205
205
|
<a href="{{basePath}}/erd/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/erd')}}active{{/if}}">
|
|
206
206
|
{{{icon "diagram" class="h-4 w-4"}}}
|
|
207
207
|
ER Diagram
|
|
208
208
|
</a>
|
|
209
209
|
</li>
|
|
210
210
|
<li>
|
|
211
211
|
<a href="{{basePath}}/seed/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/seed')}}active{{/if}}">
|
|
212
212
|
{{{icon "seed" class="h-4 w-4"}}}
|
|
213
213
|
Seed generator
|
|
214
214
|
</a>
|
|
215
215
|
</li>
|
|
216
216
|
<li>
|
|
217
217
|
<a href="{{basePath}}/info/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/info')}}active{{/if}}">
|
|
218
218
|
{{{icon "settings" class="h-4 w-4"}}}
|
|
219
219
|
Info & Settings
|
|
220
220
|
</a>
|
|
221
221
|
</li>
|
|
222
222
|
{{#unless readonly}}
|
|
223
223
|
<li>
|
|
224
224
|
<a href="{{basePath}}/designer/{{encodeUri dbId}}" class="side-link {{#if (startsWith currentPath '/designer')}}active{{/if}}">
|
|
225
225
|
{{{icon "plus" class="h-4 w-4"}}}
|
|
226
226
|
New table
|
|
227
227
|
</a>
|
|
228
228
|
</li>
|
|
229
229
|
{{/unless}}
|
|
230
230
|
</ul>
|
|
231
231
|
<div class="mb-2 mt-6 flex items-center justify-between px-3">
|
|
232
232
|
<span class="text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Tables</span>
|
|
233
233
|
<span id="table-count" class="rounded-md bg-white/[0.06] px-1.5 py-0.5 text-[10px] font-semibold text-neutral-content/50">{{tables.length}}</span>
|
|
234
234
|
</div>
|
|
235
235
|
<ul id="table-list" class="space-y-0.5">
|
|
236
236
|
{{#each tables}}
|
|
237
237
|
<li class="table-item" data-name="{{tableName this}}">
|
|
238
238
|
<a href="{{../basePath}}/tables/{{encodeUri ../dbId}}/{{encodeUri (tableName this)}}" class="side-link {{#if (eq ../currentTable (tableName this))}}active{{/if}}">
|
|
239
239
|
<span class="table-icon">
|
|
240
240
|
{{{icon "table" class="h-4 w-4"}}}
|
|
241
241
|
</span>
|
|
242
242
|
<span class="truncate">{{tableName this}}</span>
|
|
243
243
|
</a>
|
|
244
244
|
</li>
|
|
245
245
|
{{else}}
|
|
246
246
|
<li class="px-3 py-2 text-xs text-neutral-content/40">No tables yet</li>
|
|
247
247
|
{{/each}}
|
|
248
248
|
</ul>
|
|
249
249
|
{{#if internalTables.length}}
|
|
250
250
|
<div class="mb-2 mt-6 px-3 text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Internal</div>
|
|
251
251
|
<ul class="space-y-0.5">
|
|
252
252
|
{{#each internalTables}}
|
|
253
253
|
<li>
|
|
254
254
|
<a href="{{../basePath}}/tables/{{encodeUri ../dbId}}/{{encodeUri this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
|
|
255
255
|
<span class="table-icon">
|
|
256
256
|
{{{icon "book" class="h-4 w-4"}}}
|
|
257
257
|
</span>
|
|
258
258
|
<span class="truncate">{{this}}</span>
|
|
259
259
|
</a>
|
|
260
260
|
</li>
|
|
261
261
|
{{/each}}
|
|
262
262
|
</ul>
|
|
263
263
|
{{/if}}
|
|
264
264
|
</nav>
|
|
265
265
|
{{/if}}
|
|
266
266
|
{{#if isDefaultPassword}}
|
|
267
267
|
<div class="border-t border-white/10 px-4 py-2 bg-warning/10">
|
|
268
268
|
<div class="flex items-center justify-between text-warning text-xs font-semibold">
|
|
269
269
|
<span class="flex items-center gap-1.5 font-mono text-[11px]">
|
|
270
270
|
{{{icon "warning" class="h-3.5 w-3.5 shrink-0"}}}
|
|
271
271
|
default pass active
|
|
272
272
|
</span>
|
|
273
273
|
<span class="badge badge-warning badge-xs font-mono font-bold">admin</span>
|
|
274
274
|
</div>
|
|
275
275
|
</div>
|
|
276
276
|
{{/if}}
|
|
277
277
|
<div class="border-t border-white/10 px-5 py-3">
|
|
278
278
|
<div class="flex items-center justify-between">
|
|
279
279
|
<div class="text-[11px] font-medium uppercase tracking-wider text-neutral-content/40">{{#if databasesMode}}Directory{{else}}Engine: {{dialectName}}{{/if}}</div>
|
|
280
280
|
{{#unless databasesMode}}
|
|
281
281
|
{{#if readonly}}
|
|
282
282
|
<span class="rounded bg-warning/20 px-1.5 py-0.5 text-[9px] font-bold uppercase text-warning">Read-only</span>
|
|
283
283
|
{{else}}
|
|
284
284
|
<span class="rounded bg-success/20 px-1.5 py-0.5 text-[9px] font-bold uppercase text-success">Writable</span>
|
|
285
285
|
{{/if}}
|
|
286
286
|
{{/unless}}
|
|
287
287
|
</div>
|
|
288
288
|
<div class="mt-0.5 truncate font-mono text-[11px] text-neutral-content/60" title="{{dbPath}}">{{dbPath}}</div>
|
|
289
289
|
</div>
|
package/docs/API.md
CHANGED
|
@@ -1,72 +1,77 @@
|
|
|
1
1
|
# AdminDB REST API
|
|
2
2
|
|
|
3
3
|
Every route is under `basePath` and returns the consistent shape
|
|
4
|
-
`{ success, data?, error? }`.
|
|
5
|
-
|
|
4
|
+
`{ success, data?, error? }`. All database-specific routes follow the uniform pattern
|
|
5
|
+
`/<page>/<db>` and `/api/<resource>/<db>/...` (e.g. `/api/tables/app.db` or `/api/tables/prod_pg/users`).
|
|
6
6
|
|
|
7
7
|
AdminDB supports both **SQLite** and **PostgreSQL** database backends seamlessly.
|
|
8
8
|
|
|
9
9
|
## Tables & rows
|
|
10
10
|
|
|
11
|
-
| Method | Path
|
|
12
|
-
| ------ |
|
|
13
|
-
| GET | `/api/tables`
|
|
14
|
-
| GET | `/api/tables/:table/info`
|
|
15
|
-
| GET | `/api/tables/:table/fk-options`
|
|
16
|
-
| GET | `/api/tables/:table/rows?page&limit&f`
|
|
17
|
-
| GET | `/api/tables/:table/rows/count?f=`
|
|
18
|
-
| GET | `/api/tables/:table/row/:id`
|
|
19
|
-
| GET | `/api/tables/:table/rows/:id/references`
|
|
20
|
-
| GET | `/api/tables/:table/row/:id/blob/:column` | Stream binary BLOB / BYTEA with MIME detection (add `?download=1` to force download) |
|
|
21
|
-
| GET | `/api/tables/:table/row/:id/blob/:column/meta` | Inspect BLOB / BYTEA metadata, MIME sniffing & 3-column hex dump |
|
|
22
|
-
| PUT | `/api/tables/:table/row/:id/blob/:column` | Update binary value (`{ data: base64/hex, format?: 'base64'|'hex'|'text' }`) |
|
|
23
|
-
| POST | `/api/tables/:table/rows`
|
|
24
|
-
| POST | `/api/tables/:table/rows/generate`
|
|
25
|
-
| POST | `/api/tables/:table/rows/import`
|
|
26
|
-
| GET | `/api/tables/:table/export?format=`
|
|
27
|
-
| PUT | `/api/tables/:table/row/:id`
|
|
28
|
-
| PUT | `/api/tables/:table/row/:id/generate`
|
|
29
|
-
| DELETE | `/api/tables/:table/row/:id`
|
|
30
|
-
| POST | `/api/tables/:table/rows/bulk-impact`
|
|
31
|
-
| POST | `/api/tables/:table/rows/bulk-delete`
|
|
32
|
-
| POST | `/api/tables/:table/rows/bulk-export`
|
|
33
|
-
| POST | `/api/tables/:table/rows/bulk-update`
|
|
34
|
-
| GET | `/api/tables/:table/seed/config`
|
|
35
|
-
| GET | `/api/tables/:table/seed/plan`
|
|
36
|
-
| POST | `/api/tables/:table/seed/preview`
|
|
37
|
-
| POST | `/api/tables/:table/seed/generate`
|
|
38
|
-
| POST | `/api/tables/:table/seed`
|
|
11
|
+
| Method | Path | Purpose |
|
|
12
|
+
| ------ | --------------------------------------------- | -------------------------------- |
|
|
13
|
+
| GET | `/api/tables/:db` | List tables |
|
|
14
|
+
| GET | `/api/tables/:db/:table/info` | Column + FK metadata, PK columns |
|
|
15
|
+
| GET | `/api/tables/:db/:table/fk-options` | Values for FK dropdowns |
|
|
16
|
+
| GET | `/api/tables/:db/:table/rows?page&limit&f` | Paginated rows (`f` = URL-encoded JSON filters — legacy strings like `{"age":">35"}` or structured conditions like `{"balance":{"op":"gte","value":"100"}}`) |
|
|
17
|
+
| GET | `/api/tables/:db/:table/rows/count?f=` | Filtered row count |
|
|
18
|
+
| GET | `/api/tables/:db/:table/row/:id` | Single row by (encoded) PK |
|
|
19
|
+
| GET | `/api/tables/:db/:table/rows/:id/references` | Rows in other tables whose foreign keys reference this row |
|
|
20
|
+
| GET | `/api/tables/:db/:table/row/:id/blob/:column` | Stream binary BLOB / BYTEA with MIME detection (add `?download=1` to force download) |
|
|
21
|
+
| GET | `/api/tables/:db/:table/row/:id/blob/:column/meta` | Inspect BLOB / BYTEA metadata, MIME sniffing & 3-column hex dump |
|
|
22
|
+
| PUT | `/api/tables/:db/:table/row/:id/blob/:column` | Update binary value (`{ data: base64/hex, format?: 'base64'|'hex'|'text' }`) |
|
|
23
|
+
| POST | `/api/tables/:db/:table/rows` | Insert row (or batch of rows with `{ rows: [...] }`) |
|
|
24
|
+
| POST | `/api/tables/:db/:table/rows/generate` | Generate INSERT SQL (no execute) |
|
|
25
|
+
| POST | `/api/tables/:db/:table/rows/import` | Import CSV (`{ csv }`, header row must match columns) |
|
|
26
|
+
| GET | `/api/tables/:db/:table/export?format=` | Download all rows as `csv` or `json` |
|
|
27
|
+
| PUT | `/api/tables/:db/:table/row/:id` | Update row (`{ values, nulls? }` — `nulls` explicitly sets columns to NULL) |
|
|
28
|
+
| PUT | `/api/tables/:db/:table/row/:id/generate` | Generate UPDATE SQL (no execute) |
|
|
29
|
+
| DELETE | `/api/tables/:db/:table/row/:id` | Delete row |
|
|
30
|
+
| POST | `/api/tables/:db/:table/rows/bulk-impact` | FK-impact preview: how many rows in other tables reference the selected rows |
|
|
31
|
+
| POST | `/api/tables/:db/:table/rows/bulk-delete` | Delete selected rows (`{ ids, confirmImpact }`; transactional) |
|
|
32
|
+
| POST | `/api/tables/:db/:table/rows/bulk-export` | Export only the selected rows as `csv`/`json` (`{ ids, format }`) |
|
|
33
|
+
| POST | `/api/tables/:db/:table/rows/bulk-update` | Apply staged inline edits (`{ updates: [{ id, values?, nulls? }] }`; transactional) |
|
|
34
|
+
| GET | `/api/tables/:db/:table/seed/config` | Per-column generator strategies + detected defaults |
|
|
35
|
+
| GET | `/api/tables/:db/:table/seed/plan` | Detect intelligent seed plan heuristics |
|
|
36
|
+
| POST | `/api/tables/:db/:table/seed/preview` | Generate preview sample rows for grid without executing |
|
|
37
|
+
| POST | `/api/tables/:db/:table/seed/generate` | Generate seed INSERT SQL without executing (`{ count, plan }`) |
|
|
38
|
+
| POST | `/api/tables/:db/:table/seed` | Generate and insert seed rows transactionally (`{ count, plan, truncate? }`) |
|
|
39
|
+
| GET | `/api/tables/:db/:table/seed/chain` | Relational ER chain resolution and topological sort |
|
|
40
|
+
| POST | `/api/tables/:db/:table/seed/chain/generate` | Generate ER chain seed SQL & preview rows |
|
|
41
|
+
| POST | `/api/tables/:db/:table/seed/chain` | Execute atomic relational chain seeding |
|
|
42
|
+
| POST | `/api/seed/:db/validate` | Validate unified seed plan |
|
|
43
|
+
| POST | `/api/seed/:db/preview` | Preview unified multi-table seed rows |
|
|
44
|
+
| POST | `/api/seed/:db/execute` | Execute unified multi-table seed plan |
|
|
39
45
|
|
|
40
46
|
## Schema & indexes
|
|
41
47
|
|
|
42
|
-
| Method | Path
|
|
43
|
-
| ------ |
|
|
44
|
-
| POST | `/api/tables`
|
|
45
|
-
| POST | `/api/tables/generate`
|
|
46
|
-
| GET | `/api/tables/:table/schema`
|
|
47
|
-
| GET | `/api/tables/:table/ddl`
|
|
48
|
-
| GET | `/api/info/ddl`
|
|
49
|
-
|
|
50
|
-
| POST | `/api/tables/:table/
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
| DELETE | `/api/tables/:table
|
|
54
|
-
|
|
|
55
|
-
| POST | `/api/tables/bulk-
|
|
56
|
-
| POST | `/api/tables/
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
| GET | `/api/erd` | Full schema graph with columns & FK edges for ER Diagram |
|
|
48
|
+
| Method | Path | Purpose |
|
|
49
|
+
| ------ | ----------------------------------------- | -------------------------------- |
|
|
50
|
+
| POST | `/api/tables/:db` | Create table |
|
|
51
|
+
| POST | `/api/tables/:db/generate` | Generate CREATE SQL (no execute) |
|
|
52
|
+
| GET | `/api/tables/:db/:table/schema` | Full schema (constraints, indexes, FK refs) |
|
|
53
|
+
| GET | `/api/tables/:db/:table/ddl` | Get formatted `CREATE TABLE` and `INDEX` DDL for a single table |
|
|
54
|
+
| GET | `/api/info/:db/ddl` | Get formatted DDL for the entire database schema |
|
|
55
|
+
| POST | `/api/tables/:db/:table/rename` | Rename the table |
|
|
56
|
+
| POST | `/api/tables/:db/:table/columns` | Add a column |
|
|
57
|
+
| PUT | `/api/tables/:db/:table/columns/:column` | Modify/rename a column |
|
|
58
|
+
| DELETE | `/api/tables/:db/:table/columns/:column` | Drop a column (safety-checked) |
|
|
59
|
+
| DELETE | `/api/tables/:db/:table` | Drop the table (safety-checked) |
|
|
60
|
+
| POST | `/api/tables/:db/bulk-drop` | Drop multiple tables at once (`{ tables, force }`) |
|
|
61
|
+
| POST | `/api/tables/:db/bulk-truncate` | Truncate/empty multiple tables at once (`{ tables, force }`) |
|
|
62
|
+
| POST | `/api/tables/:db/:table/indexes` | Create an index (`{ name?, columns[], unique? }`) |
|
|
63
|
+
| DELETE | `/api/tables/:db/:table/indexes/:index` | Drop an index (auto indexes refused) |
|
|
64
|
+
| GET | `/api/erd/:db` | Full schema graph with columns & FK edges for ER Diagram |
|
|
60
65
|
|
|
61
66
|
## Queries
|
|
62
67
|
|
|
63
|
-
| Method | Path
|
|
64
|
-
| ------ |
|
|
65
|
-
| POST | `/api/query`
|
|
66
|
-
| POST | `/api/query/export` | Run a SELECT and download as `csv`/`json` |
|
|
67
|
-
| GET | `/api/queries`
|
|
68
|
-
| POST | `/api/queries`
|
|
69
|
-
| DELETE | `/api/queries/:id
|
|
68
|
+
| Method | Path | Purpose |
|
|
69
|
+
| ------ | -------------------- | -------------------------- |
|
|
70
|
+
| POST | `/api/query/:db` | Run arbitrary SQL |
|
|
71
|
+
| POST | `/api/query/:db/export` | Run a SELECT and download as `csv`/`json` |
|
|
72
|
+
| GET | `/api/queries/:db` | List saved queries |
|
|
73
|
+
| POST | `/api/queries/:db` | Save a named query |
|
|
74
|
+
| DELETE | `/api/queries/:db/:id` | Delete a saved query |
|
|
70
75
|
|
|
71
76
|
## Manager mode (databases landing page)
|
|
72
77
|
|
package/package.json
CHANGED