admindb 1.0.1 → 1.1.0

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 (48) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +354 -325
  3. package/dist/db/database.d.ts +61 -39
  4. package/dist/db/database.js +251 -51
  5. package/dist/db/database.js.map +1 -1
  6. package/dist/db/manager.d.ts +2 -2
  7. package/dist/db/manager.js +3 -2
  8. package/dist/db/manager.js.map +1 -1
  9. package/dist/public/css/app.css +1 -1
  10. package/dist/public/css/input.css +232 -179
  11. package/dist/public/js/api.js +47 -47
  12. package/dist/public/js/app.js +120 -120
  13. package/dist/public/js/browse.js +877 -123
  14. package/dist/public/js/databases.js +45 -45
  15. package/dist/public/js/designer.js +205 -205
  16. package/dist/public/js/forms.js +244 -244
  17. package/dist/public/js/query.js +232 -232
  18. package/dist/public/js/schema.js +314 -314
  19. package/dist/routes/api.js +261 -97
  20. package/dist/routes/api.js.map +1 -1
  21. package/dist/routes/pages.js +50 -30
  22. package/dist/routes/pages.js.map +1 -1
  23. package/dist/sql/generator.d.ts +0 -22
  24. package/dist/sql/generator.js +0 -48
  25. package/dist/sql/generator.js.map +1 -1
  26. package/dist/test/database.test.js +241 -63
  27. package/dist/test/database.test.js.map +1 -1
  28. package/dist/test/generator.test.js +0 -32
  29. package/dist/test/generator.test.js.map +1 -1
  30. package/dist/util.d.ts +13 -1
  31. package/dist/util.js +24 -2
  32. package/dist/util.js.map +1 -1
  33. package/dist/views/layouts/main.hbs +49 -49
  34. package/dist/views/pages/databases.hbs +102 -102
  35. package/dist/views/pages/designer.hbs +81 -81
  36. package/dist/views/pages/error.hbs +12 -12
  37. package/dist/views/pages/form.hbs +62 -62
  38. package/dist/views/pages/home.hbs +123 -123
  39. package/dist/views/pages/query.hbs +94 -94
  40. package/dist/views/pages/schema.hbs +290 -290
  41. package/dist/views/pages/table.hbs +256 -203
  42. package/dist/views/partials/navbar.hbs +50 -50
  43. package/dist/views/partials/sidebar.hbs +116 -128
  44. package/package.json +66 -62
  45. package/dist/public/js/triggers.js +0 -155
  46. package/dist/public/js/views.js +0 -176
  47. package/dist/views/pages/triggers.hbs +0 -162
  48. package/dist/views/pages/views.hbs +0 -134
@@ -1,50 +1,50 @@
1
- <div class="sticky top-0 z-30 border-b border-base-300/80 bg-base-100/85 backdrop-blur-md">
2
- <div class="navbar mx-auto w-full max-w-[1500px] px-4 sm:px-6 lg:px-8">
3
- <div class="flex-none lg:hidden">
4
- <label for="sidebar-toggle" class="btn btn-square btn-ghost" aria-label="open sidebar">
5
- <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
6
- <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
7
- </svg>
8
- </label>
9
- </div>
10
- <div class="flex-1">
11
- <a href="{{basePath}}/" class="flex items-center gap-2.5">
12
- <span class="grid h-9 w-9 place-items-center rounded-xl bg-gradient-to-br from-primary to-secondary text-white shadow-soft">
13
- <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
14
- <path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" />
15
- </svg>
16
- </span>
17
- <span class="text-lg font-bold tracking-tight">DB<span class="text-primary">Admin</span></span>
18
- </a>
19
- </div>
20
- <div class="flex items-center gap-1.5">
21
- {{#unless databasesMode}}
22
- {{#if databasesUrl}}
23
- <a href="{{databasesUrl}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
24
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
25
- Databases
26
- </a>
27
- {{/if}}
28
- <a href="{{basePath}}/query" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
29
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
30
- Query
31
- </a>
32
- {{#unless readonly}}
33
- <a href="{{basePath}}/designer" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
34
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
35
- New table
36
- </a>
37
- {{/unless}}
38
- <a href="{{basePath}}/export" class="btn btn-ghost btn-sm hidden gap-1.5 md:inline-flex">
39
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /></svg>
40
- Export
41
- </a>
42
- {{/unless}}
43
- <button id="theme-toggle" type="button" class="btn btn-square btn-ghost btn-sm" aria-label="Toggle dark mode" title="Toggle dark mode">
44
- <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
45
- <path stroke-linecap="round" stroke-linejoin="round" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
46
- </svg>
47
- </button>
48
- </div>
49
- </div>
50
- </div>
1
+ <div class="sticky top-0 z-30 border-b border-base-300/80 bg-base-100/85 backdrop-blur-md">
2
+ <div class="navbar mx-auto w-full max-w-[1500px] px-4 sm:px-6 lg:px-8">
3
+ <div class="flex-none lg:hidden">
4
+ <label for="sidebar-toggle" class="btn btn-square btn-ghost" aria-label="open sidebar">
5
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
6
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
7
+ </svg>
8
+ </label>
9
+ </div>
10
+ <div class="flex-1">
11
+ <a href="{{basePath}}/" class="flex items-center gap-2.5">
12
+ <span class="grid h-9 w-9 place-items-center rounded-xl bg-gradient-to-br from-primary to-secondary text-white shadow-soft">
13
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
14
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" />
15
+ </svg>
16
+ </span>
17
+ <span class="text-lg font-bold tracking-tight">DB<span class="text-primary">Admin</span></span>
18
+ </a>
19
+ </div>
20
+ <div class="flex items-center gap-1.5">
21
+ {{#unless databasesMode}}
22
+ {{#if databasesUrl}}
23
+ <a href="{{databasesUrl}}" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
24
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
25
+ Databases
26
+ </a>
27
+ {{/if}}
28
+ <a href="{{basePath}}/query" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
29
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
30
+ Query
31
+ </a>
32
+ {{#unless readonly}}
33
+ <a href="{{basePath}}/designer" class="btn btn-ghost btn-sm hidden gap-1.5 sm:inline-flex">
34
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
35
+ New table
36
+ </a>
37
+ {{/unless}}
38
+ <a href="{{basePath}}/export" class="btn btn-ghost btn-sm hidden gap-1.5 md:inline-flex">
39
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /></svg>
40
+ Export
41
+ </a>
42
+ {{/unless}}
43
+ <button id="theme-toggle" type="button" class="btn btn-square btn-ghost btn-sm" aria-label="Toggle dark mode" title="Toggle dark mode">
44
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
45
+ <path stroke-linecap="round" stroke-linejoin="round" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
46
+ </svg>
47
+ </button>
48
+ </div>
49
+ </div>
50
+ </div>
@@ -1,128 +1,116 @@
1
- <aside class="flex h-full min-h-full w-72 flex-col bg-neutral text-neutral-content">
2
- <div class="flex items-center gap-2.5 px-5 pb-4 pt-5">
3
- <span class="grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-gradient-to-br from-primary to-secondary text-white shadow-soft">
4
- <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
- <path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" />
6
- </svg>
7
- </span>
8
- <div>
9
- <div class="text-base font-bold leading-tight">AdminDB</div>
10
- <div class="text-[11px] text-neutral-content/50">{{#if databasesMode}}Database manager{{else}}Database: {{dbId}}{{/if}}</div>
11
- </div>
12
- </div>
13
-
14
- {{#if databasesMode}}
15
- <nav class="flex-1 overflow-y-auto px-3 py-2">
16
- <ul class="space-y-0.5">
17
- <li>
18
- <a href="{{basePath}}/" class="side-link active">
19
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
20
- Databases
21
- </a>
22
- </li>
23
- </ul>
24
- </nav>
25
- {{else}}
26
- <div class="px-4 pb-2">
27
- <label class="relative block">
28
- <svg xmlns="http://www.w3.org/2000/svg" class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral-content/40" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
29
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
30
- </svg>
31
- <input id="table-search" type="search" placeholder="Filter tables…" autocomplete="off"
32
- 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" />
33
- </label>
34
- </div>
35
-
36
- <nav class="flex-1 overflow-y-auto px-3 py-2">
37
- <ul class="space-y-0.5">
38
- {{#if databasesUrl}}
39
- <li>
40
- <a href="{{databasesUrl}}" class="side-link">
41
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
42
- Databases
43
- </a>
44
- </li>
45
- {{/if}}
46
- <li>
47
- <a href="{{basePath}}/" class="side-link {{#if (eq currentPath '/')}}active{{/if}}">
48
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /></svg>
49
- Home
50
- </a>
51
- </li>
52
- <li>
53
- <a href="{{basePath}}/query" class="side-link {{#if (startsWith currentPath '/query')}}active{{/if}}">
54
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
55
- Query editor
56
- </a>
57
- </li>
58
- <li>
59
- <a href="{{basePath}}/views" class="side-link {{#if (startsWith currentPath '/views')}}active{{/if}}">
60
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /></svg>
61
- Views
62
- </a>
63
- </li>
64
- <li>
65
- <a href="{{basePath}}/triggers" class="side-link {{#if (startsWith currentPath '/triggers')}}active{{/if}}">
66
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
67
- Triggers
68
- </a>
69
- </li>
70
- {{#unless readonly}}
71
- <li>
72
- <a href="{{basePath}}/designer" class="side-link {{#if (startsWith currentPath '/designer')}}active{{/if}}">
73
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
74
- New table
75
- </a>
76
- </li>
77
- {{/unless}}
78
- </ul>
79
-
80
- <div class="mb-2 mt-6 flex items-center justify-between px-3">
81
- <span class="text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Tables</span>
82
- <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>
83
- </div>
84
-
85
- <ul id="table-list" class="space-y-0.5">
86
- {{#each tables}}
87
- <li class="table-item" data-name="{{this}}">
88
- <a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
89
- <span class="table-icon">
90
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>
91
- </span>
92
- <span class="truncate">{{this}}</span>
93
- </a>
94
- </li>
95
- {{else}}
96
- <li class="px-3 py-2 text-xs text-neutral-content/40">No tables yet</li>
97
- {{/each}}
98
- </ul>
99
-
100
- {{#if internalTables.length}}
101
- <div class="mb-2 mt-6 px-3 text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Internal</div>
102
- <ul class="space-y-0.5">
103
- {{#each internalTables}}
104
- <li>
105
- <a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
106
- <span class="table-icon">
107
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" /></svg>
108
- </span>
109
- <span class="truncate">{{this}}</span>
110
- </a>
111
- </li>
112
- {{/each}}
113
- </ul>
114
- {{/if}}
115
- </nav>
116
- {{/if}}
117
-
118
- <div class="border-t border-white/10 px-5 py-3">
119
- <div class="text-[11px] font-medium uppercase tracking-wider text-neutral-content/40">{{#if databasesMode}}Directory{{else}}Database{{/if}}</div>
120
- <div class="mt-0.5 truncate font-mono text-[11px] text-neutral-content/60" title="{{dbPath}}">{{dbPath}}</div>
121
- {{#if readonly}}
122
- <div class="mt-2 inline-flex items-center gap-1 rounded-md bg-warning/20 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-warning">
123
- <svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
124
- Read-only
125
- </div>
126
- {{/if}}
127
- </div>
128
- </aside>
1
+ <aside class="flex h-full min-h-full w-72 flex-col bg-neutral text-neutral-content">
2
+ <div class="flex items-center gap-2.5 px-5 pb-4 pt-5">
3
+ <span class="grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-gradient-to-br from-primary to-secondary text-white shadow-soft">
4
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" />
6
+ </svg>
7
+ </span>
8
+ <div>
9
+ <div class="text-base font-bold leading-tight">AdminDB</div>
10
+ <div class="text-[11px] text-neutral-content/50">{{#if databasesMode}}Database manager{{else}}Database: {{dbId}}{{/if}}</div>
11
+ </div>
12
+ </div>
13
+
14
+ {{#if databasesMode}}
15
+ <nav class="flex-1 overflow-y-auto px-3 py-2">
16
+ <ul class="space-y-0.5">
17
+ <li>
18
+ <a href="{{basePath}}/" class="side-link active">
19
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
20
+ Databases
21
+ </a>
22
+ </li>
23
+ </ul>
24
+ </nav>
25
+ {{else}}
26
+ <div class="px-4 pb-2">
27
+ <label class="relative block">
28
+ <svg xmlns="http://www.w3.org/2000/svg" class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-neutral-content/40" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
29
+ <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
30
+ </svg>
31
+ <input id="table-search" type="search" placeholder="Filter tables…" autocomplete="off"
32
+ 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" />
33
+ </label>
34
+ </div>
35
+
36
+ <nav class="flex-1 overflow-y-auto px-3 py-2">
37
+ <ul class="space-y-0.5">
38
+ {{#if databasesUrl}}
39
+ <li>
40
+ <a href="{{databasesUrl}}" class="side-link">
41
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7v10c0 1.1.9 2 2 2h12a2 2 0 002-2V7M4 7c0-1.1.9-2 2-2h12a2 2 0 012 2M4 7c0 1.1.9 2 2 2h12a2 2 0 002-2" /></svg>
42
+ Databases
43
+ </a>
44
+ </li>
45
+ {{/if}}
46
+ <li>
47
+ <a href="{{basePath}}/" class="side-link {{#if (eq currentPath '/')}}active{{/if}}">
48
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /></svg>
49
+ Home
50
+ </a>
51
+ </li>
52
+ <li>
53
+ <a href="{{basePath}}/query" class="side-link {{#if (startsWith currentPath '/query')}}active{{/if}}">
54
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg>
55
+ Query editor
56
+ </a>
57
+ </li>
58
+ {{#unless readonly}}
59
+ <li>
60
+ <a href="{{basePath}}/designer" class="side-link {{#if (startsWith currentPath '/designer')}}active{{/if}}">
61
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" /></svg>
62
+ New table
63
+ </a>
64
+ </li>
65
+ {{/unless}}
66
+ </ul>
67
+
68
+ <div class="mb-2 mt-6 flex items-center justify-between px-3">
69
+ <span class="text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Tables</span>
70
+ <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>
71
+ </div>
72
+
73
+ <ul id="table-list" class="space-y-0.5">
74
+ {{#each tables}}
75
+ <li class="table-item" data-name="{{this}}">
76
+ <a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
77
+ <span class="table-icon">
78
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>
79
+ </span>
80
+ <span class="truncate">{{this}}</span>
81
+ </a>
82
+ </li>
83
+ {{else}}
84
+ <li class="px-3 py-2 text-xs text-neutral-content/40">No tables yet</li>
85
+ {{/each}}
86
+ </ul>
87
+
88
+ {{#if internalTables.length}}
89
+ <div class="mb-2 mt-6 px-3 text-[11px] font-semibold uppercase tracking-wider text-neutral-content/40">Internal</div>
90
+ <ul class="space-y-0.5">
91
+ {{#each internalTables}}
92
+ <li>
93
+ <a href="{{../basePath}}/tables/{{this}}" class="side-link {{#if (eq ../currentTable this)}}active{{/if}}">
94
+ <span class="table-icon">
95
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" /></svg>
96
+ </span>
97
+ <span class="truncate">{{this}}</span>
98
+ </a>
99
+ </li>
100
+ {{/each}}
101
+ </ul>
102
+ {{/if}}
103
+ </nav>
104
+ {{/if}}
105
+
106
+ <div class="border-t border-white/10 px-5 py-3">
107
+ <div class="text-[11px] font-medium uppercase tracking-wider text-neutral-content/40">{{#if databasesMode}}Directory{{else}}Database{{/if}}</div>
108
+ <div class="mt-0.5 truncate font-mono text-[11px] text-neutral-content/60" title="{{dbPath}}">{{dbPath}}</div>
109
+ {{#if readonly}}
110
+ <div class="mt-2 inline-flex items-center gap-1 rounded-md bg-warning/20 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-warning">
111
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
112
+ Read-only
113
+ </div>
114
+ {{/if}}
115
+ </div>
116
+ </aside>
package/package.json CHANGED
@@ -1,62 +1,66 @@
1
- {
2
- "name": "admindb",
3
- "version": "1.0.1",
4
- "description": "Browser-based SQLite database administration tool — embed it in your Express app or run it standalone.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "bin": {
8
- "admindb": "dist/cli.js"
9
- },
10
- "homepage": "https://github.com/MIbnEKhalid/admindb#readme",
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/MIbnEKhalid/admindb.git"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/MIbnEKhalid/admindb/issues"
17
- },
18
- "author": "MIbnEKhalid",
19
- "files": [
20
- "dist",
21
- "README.md",
22
- "LICENSE"
23
- ],
24
- "engines": {
25
- "node": ">=22.5.0"
26
- },
27
- "scripts": {
28
- "build": "tsc -p tsconfig.json && node scripts/copy-assets.mjs && npm run build:css",
29
- "build:css": "tailwindcss -i ./src/public/css/input.css -o ./dist/public/css/app.css --minify",
30
- "start": "node dist/cli.js",
31
- "dev": "concurrently -k -n server,css \"tsx watch src/cli.ts\" \"npm run dev:css\"",
32
- "dev:css": "tailwindcss -i ./src/public/css/input.css -o ./src/public/css/app.css --watch",
33
- "prepack": "npm run build",
34
- "test": "npm run build && node --test \"dist/test/**/*.test.js\""
35
- },
36
- "keywords": [
37
- "sqlite",
38
- "admin",
39
- "database",
40
- "express",
41
- "handlebars",
42
- "tailwind",
43
- "daisyui"
44
- ],
45
- "license": "MIT",
46
- "publishConfig": {
47
- "registry": "https://registry.npmjs.org/"
48
- },
49
- "dependencies": {
50
- "express": "^5.1.0",
51
- "express-handlebars": "^8.0.3"
52
- },
53
- "devDependencies": {
54
- "@types/express": "^4.17.21",
55
- "@types/node": "^22.10.0",
56
- "concurrently": "^9.1.0",
57
- "daisyui": "^4.12.0",
58
- "tailwindcss": "^3.4.17",
59
- "tsx": "^4.19.0",
60
- "typescript": "^5.7.0"
61
- }
62
- }
1
+ {
2
+ "name": "admindb",
3
+ "version": "1.1.0",
4
+ "description": "Browser-based SQLite database administration tool — embed it in your Express app or run it standalone.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "admindb": "dist/cli.js"
9
+ },
10
+ "homepage": "https://github.com/MIbnEKhalid/admindb#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/MIbnEKhalid/admindb.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/MIbnEKhalid/admindb/issues"
17
+ },
18
+ "author": "MIbnEKhalid",
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "package.json",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=20.0.0"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.json && node scripts/copy-assets.mjs && npm run build:css",
30
+ "build:css": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 tailwindcss -i ./src/public/css/input.css -o ./dist/public/css/app.css --minify",
31
+ "start": "node dist/cli.js",
32
+ "dev": "concurrently -k -n server,css \"tsx watch src/cli.ts\" \"npm run dev:css\"",
33
+ "dev:css": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=1 tailwindcss -i ./src/public/css/input.css -o ./src/public/css/app.css --watch",
34
+ "prepack": "npm run build",
35
+ "test": "npm run build && node --test dist/test/*.test.js"
36
+ },
37
+ "keywords": [
38
+ "sqlite",
39
+ "admin",
40
+ "database",
41
+ "express",
42
+ "handlebars",
43
+ "tailwind",
44
+ "daisyui"
45
+ ],
46
+ "license": "MIT",
47
+ "publishConfig": {
48
+ "registry": "https://registry.npmjs.org/"
49
+ },
50
+ "dependencies": {
51
+ "better-sqlite3": "^11.9.1",
52
+ "express": "^5.1.0",
53
+ "express-handlebars": "^8.0.3"
54
+ },
55
+ "devDependencies": {
56
+ "@types/better-sqlite3": "^9.6.0",
57
+ "@types/express": "^4.17.21",
58
+ "@types/node": "^22.10.0",
59
+ "concurrently": "^9.1.0",
60
+ "cross-env": "^10.1.0",
61
+ "daisyui": "^4.12.0",
62
+ "tailwindcss": "^3.4.17",
63
+ "tsx": "^4.19.0",
64
+ "typescript": "^5.7.0"
65
+ }
66
+ }