@nodestackapp/server 1.3.0 → 2.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.
- package/LICENSE +15 -0
- package/README.md +14 -13
- package/dist/NodeStack.d.ts +14 -0
- package/dist/NodeStack.d.ts.map +1 -1
- package/dist/NodeStack.js +42 -3
- package/dist/NodeStack.js.map +1 -1
- package/dist/admin/AdminUIBundler.d.ts.map +1 -1
- package/dist/admin/AdminUIBundler.js +10 -5
- package/dist/admin/AdminUIBundler.js.map +1 -1
- package/dist/admin/ui/css/analytics.css +68 -11
- package/dist/admin/ui/css/codemirror.css +98 -0
- package/dist/admin/ui/css/main.css +372 -78
- package/dist/admin/ui/css/rules.css +292 -264
- package/dist/admin/ui/css/webhooks.css +34 -10
- package/dist/admin/ui/index.html +9326 -5706
- package/dist/admin/ui/js/analytics.js +673 -624
- package/dist/admin/ui/js/api.js +60 -14
- package/dist/admin/ui/js/app.js +480 -263
- package/dist/admin/ui/js/apps.js +50 -17
- package/dist/admin/ui/js/codemirror.js +15 -0
- package/dist/admin/ui/js/collections.js +41 -13
- package/dist/admin/ui/js/command-palette.js +61 -19
- package/dist/admin/ui/js/demo.js +373 -271
- package/dist/admin/ui/js/functions-tester.js +432 -0
- package/dist/admin/ui/js/functions-workbench.js +1038 -0
- package/dist/admin/ui/js/functions.js +765 -0
- package/dist/admin/ui/js/modals.js +20 -16
- package/dist/admin/ui/js/plugin-tester.js +562 -559
- package/dist/admin/ui/js/plugins.js +221 -90
- package/dist/admin/ui/js/records.js +96 -61
- package/dist/admin/ui/js/rules.js +1 -1
- package/dist/admin/ui/js/schema.js +23 -9
- package/dist/admin/ui/js/theme.js +120 -0
- package/dist/admin/ui/js/views.js +680 -714
- package/dist/admin/ui/js/webhooks.js +1111 -1086
- package/dist/apps/AppScope.d.ts +6 -0
- package/dist/apps/AppScope.d.ts.map +1 -1
- package/dist/apps/AppScope.js +40 -4
- package/dist/apps/AppScope.js.map +1 -1
- package/dist/auth/ApiKeyService.d.ts +91 -0
- package/dist/auth/ApiKeyService.d.ts.map +1 -0
- package/dist/auth/ApiKeyService.js +414 -0
- package/dist/auth/ApiKeyService.js.map +1 -0
- package/dist/auth/AuthService.d.ts +33 -1
- package/dist/auth/AuthService.d.ts.map +1 -1
- package/dist/auth/AuthService.js +255 -10
- package/dist/auth/AuthService.js.map +1 -1
- package/dist/auth/oauth/AppleProvider.d.ts +23 -0
- package/dist/auth/oauth/AppleProvider.d.ts.map +1 -0
- package/dist/auth/oauth/AppleProvider.js +161 -0
- package/dist/auth/oauth/AppleProvider.js.map +1 -0
- package/dist/auth/oauth/BaseOAuthProvider.d.ts +18 -0
- package/dist/auth/oauth/BaseOAuthProvider.d.ts.map +1 -0
- package/dist/auth/oauth/BaseOAuthProvider.js +79 -0
- package/dist/auth/oauth/BaseOAuthProvider.js.map +1 -0
- package/dist/auth/oauth/DiscordProvider.d.ts +11 -0
- package/dist/auth/oauth/DiscordProvider.d.ts.map +1 -0
- package/dist/auth/oauth/DiscordProvider.js +47 -0
- package/dist/auth/oauth/DiscordProvider.js.map +1 -0
- package/dist/auth/oauth/GitHubProvider.d.ts +13 -0
- package/dist/auth/oauth/GitHubProvider.d.ts.map +1 -0
- package/dist/auth/oauth/GitHubProvider.js +90 -0
- package/dist/auth/oauth/GitHubProvider.js.map +1 -0
- package/dist/auth/oauth/GoogleProvider.d.ts +11 -0
- package/dist/auth/oauth/GoogleProvider.d.ts.map +1 -0
- package/dist/auth/oauth/GoogleProvider.js +43 -0
- package/dist/auth/oauth/GoogleProvider.js.map +1 -0
- package/dist/auth/oauth/MicrosoftProvider.d.ts +11 -0
- package/dist/auth/oauth/MicrosoftProvider.d.ts.map +1 -0
- package/dist/auth/oauth/MicrosoftProvider.js +83 -0
- package/dist/auth/oauth/MicrosoftProvider.js.map +1 -0
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts +32 -0
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts.map +1 -0
- package/dist/auth/oauth/OAuthProviderRegistry.js +232 -0
- package/dist/auth/oauth/OAuthProviderRegistry.js.map +1 -0
- package/dist/auth/oauth/types.d.ts +63 -0
- package/dist/auth/oauth/types.d.ts.map +1 -0
- package/dist/auth/oauth/types.js +3 -0
- package/dist/auth/oauth/types.js.map +1 -0
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +74 -10
- package/dist/cli/cli.js.map +1 -1
- package/dist/core/config/ConfigService.d.ts +1 -0
- package/dist/core/config/ConfigService.d.ts.map +1 -1
- package/dist/core/config/ConfigService.js +4 -1
- package/dist/core/config/ConfigService.js.map +1 -1
- package/dist/core/container/Tokens.d.ts +4 -0
- package/dist/core/container/Tokens.d.ts.map +1 -1
- package/dist/core/container/Tokens.js +4 -0
- package/dist/core/container/Tokens.js.map +1 -1
- package/dist/core/plugins/PluginManager.d.ts.map +1 -1
- package/dist/core/plugins/PluginManager.js +73 -19
- package/dist/core/plugins/PluginManager.js.map +1 -1
- package/dist/database/migrations/SystemMigrations.d.ts.map +1 -1
- package/dist/database/migrations/SystemMigrations.js +41 -1
- package/dist/database/migrations/SystemMigrations.js.map +1 -1
- package/dist/demo/DemoService.d.ts +15 -103
- package/dist/demo/DemoService.d.ts.map +1 -1
- package/dist/demo/DemoService.js +14 -419
- package/dist/demo/DemoService.js.map +1 -1
- package/dist/functions/FunctionService.d.ts +80 -0
- package/dist/functions/FunctionService.d.ts.map +1 -0
- package/dist/functions/FunctionService.js +610 -0
- package/dist/functions/FunctionService.js.map +1 -0
- package/dist/functions/runtime/IFunctionRuntime.d.ts +23 -0
- package/dist/functions/runtime/IFunctionRuntime.d.ts.map +1 -0
- package/dist/functions/runtime/IFunctionRuntime.js +3 -0
- package/dist/functions/runtime/IFunctionRuntime.js.map +1 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts +21 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts.map +1 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.js +418 -0
- package/dist/functions/runtime/QuickJsWasmRuntime.js.map +1 -0
- package/dist/functions/runtime/SandboxedRunner.d.ts +31 -0
- package/dist/functions/runtime/SandboxedRunner.d.ts.map +1 -0
- package/dist/functions/runtime/SandboxedRunner.js +61 -0
- package/dist/functions/runtime/SandboxedRunner.js.map +1 -0
- package/dist/functions/security/SsrfGuard.d.ts +41 -0
- package/dist/functions/security/SsrfGuard.d.ts.map +1 -0
- package/dist/functions/security/SsrfGuard.js +470 -0
- package/dist/functions/security/SsrfGuard.js.map +1 -0
- package/dist/functions/types.d.ts +109 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/functions/types.js +3 -0
- package/dist/functions/types.js.map +1 -0
- package/dist/http/HttpServer.d.ts +9 -1
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +108 -8
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/controllers/ApiKeyController.d.ts +31 -0
- package/dist/http/controllers/ApiKeyController.d.ts.map +1 -0
- package/dist/http/controllers/ApiKeyController.js +52 -0
- package/dist/http/controllers/ApiKeyController.js.map +1 -0
- package/dist/http/controllers/AuthController.d.ts +29 -1
- package/dist/http/controllers/AuthController.d.ts.map +1 -1
- package/dist/http/controllers/AuthController.js +42 -1
- package/dist/http/controllers/AuthController.js.map +1 -1
- package/dist/http/controllers/DemoController.d.ts.map +1 -1
- package/dist/http/controllers/DemoController.js +1 -0
- package/dist/http/controllers/DemoController.js.map +1 -1
- package/dist/http/controllers/FunctionController.d.ts +64 -0
- package/dist/http/controllers/FunctionController.d.ts.map +1 -0
- package/dist/http/controllers/FunctionController.js +202 -0
- package/dist/http/controllers/FunctionController.js.map +1 -0
- package/dist/http/controllers/HealthController.js +2 -2
- package/dist/http/controllers/RecordController.d.ts.map +1 -1
- package/dist/http/controllers/RecordController.js +4 -0
- package/dist/http/controllers/RecordController.js.map +1 -1
- package/dist/http/controllers/SnapshotController.d.ts +58 -0
- package/dist/http/controllers/SnapshotController.d.ts.map +1 -0
- package/dist/http/controllers/SnapshotController.js +79 -0
- package/dist/http/controllers/SnapshotController.js.map +1 -0
- package/dist/http/middleware/AuthMiddleware.d.ts +6 -1
- package/dist/http/middleware/AuthMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AuthMiddleware.js +79 -8
- package/dist/http/middleware/AuthMiddleware.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins/chat-notifications.d.ts +51 -0
- package/dist/plugins/chat-notifications.d.ts.map +1 -0
- package/dist/plugins/chat-notifications.js +545 -0
- package/dist/plugins/chat-notifications.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/webhooks.d.ts +5 -34
- package/dist/plugins/webhooks.d.ts.map +1 -1
- package/dist/plugins/webhooks.js +11 -412
- package/dist/plugins/webhooks.js.map +1 -1
- package/dist/records/MockDataService.d.ts.map +1 -1
- package/dist/records/MockDataService.js +3 -0
- package/dist/records/MockDataService.js.map +1 -1
- package/dist/records/QueryFilterParser.d.ts.map +1 -1
- package/dist/records/QueryFilterParser.js +2 -1
- package/dist/records/QueryFilterParser.js.map +1 -1
- package/dist/records/RecordService.d.ts.map +1 -1
- package/dist/records/RecordService.js +70 -43
- package/dist/records/RecordService.js.map +1 -1
- package/dist/records/RecordValidator.d.ts +6 -0
- package/dist/records/RecordValidator.d.ts.map +1 -0
- package/dist/records/RecordValidator.js +100 -0
- package/dist/records/RecordValidator.js.map +1 -0
- package/dist/rules/RuleEngine.d.ts +14 -0
- package/dist/rules/RuleEngine.d.ts.map +1 -1
- package/dist/rules/RuleEngine.js +144 -1
- package/dist/rules/RuleEngine.js.map +1 -1
- package/dist/schema/OpenApiGenerator.js +3 -3
- package/dist/snapshots/SnapshotService.d.ts +75 -0
- package/dist/snapshots/SnapshotService.d.ts.map +1 -0
- package/dist/snapshots/SnapshotService.js +775 -0
- package/dist/snapshots/SnapshotService.js.map +1 -0
- package/dist/snapshots/types.d.ts +63 -0
- package/dist/snapshots/types.d.ts.map +1 -0
- package/dist/snapshots/types.js +5 -0
- package/dist/snapshots/types.js.map +1 -0
- package/dist/templates/definitions/ecommerce.js +13 -13
- package/dist/templates/definitions/ecommerce.js.map +1 -1
- package/dist/webhooks/WebhookService.js +1 -1
- package/package.json +4 -3
|
@@ -162,40 +162,8 @@
|
|
|
162
162
|
function renderRecordsView() {
|
|
163
163
|
const topActions = document.getElementById('view-actions');
|
|
164
164
|
if (topActions) topActions.innerHTML = '';
|
|
165
|
-
const actions = document.getElementById('collection-actions')
|
|
166
|
-
actions.innerHTML =
|
|
167
|
-
<div style="display:flex; align-items:center; gap:0.5rem;">
|
|
168
|
-
<div class="dropdown-wrapper">
|
|
169
|
-
<button class="btn btn-secondary btn-sm" onclick="toggleExportMenu(event)" title="Export collection records">
|
|
170
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
|
171
|
-
<span>Export</span>
|
|
172
|
-
<span style="font-size:10px; margin-left:1px; opacity:0.7;">▾</span>
|
|
173
|
-
</button>
|
|
174
|
-
<div id="export-dropdown-menu" style="display:none; position:absolute; right:0; top:calc(100% + 4px); background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:6px; box-shadow:0 10px 25px rgba(0,0,0,0.5); min-width:150px; z-index:100; padding:4px 0;">
|
|
175
|
-
<button class="dropdown-menu-item" onclick="exportData('csv')">
|
|
176
|
-
<span style="color:#60a5fa; font-weight:bold;">CSV</span> Export as CSV
|
|
177
|
-
</button>
|
|
178
|
-
<button class="dropdown-menu-item" onclick="exportData('json')">
|
|
179
|
-
<span style="color:#34d399; font-weight:bold;">{ }</span> Export as JSON
|
|
180
|
-
</button>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
<button class="btn btn-secondary btn-sm" onclick="openImportModal()" title="Drag & drop CSV import with visual column mapping">
|
|
185
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
|
186
|
-
<span>Import CSV</span>
|
|
187
|
-
</button>
|
|
188
|
-
|
|
189
|
-
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="border-color: rgba(96, 165, 250, 0.4); color: #93c5fd;">
|
|
190
|
-
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
191
|
-
<span>Generate Mock Data</span>
|
|
192
|
-
</button>
|
|
193
|
-
|
|
194
|
-
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
195
|
-
<span>+ New Record</span>
|
|
196
|
-
</button>
|
|
197
|
-
</div>
|
|
198
|
-
`;
|
|
165
|
+
const actions = document.getElementById('collection-actions');
|
|
166
|
+
if (actions) actions.innerHTML = '';
|
|
199
167
|
|
|
200
168
|
if (typeof showPageView === 'function') {
|
|
201
169
|
showPageView('collections');
|
|
@@ -205,6 +173,52 @@
|
|
|
205
173
|
|
|
206
174
|
const main = document.getElementById('collections-detail-pane') || document.getElementById('main-body');
|
|
207
175
|
main.innerHTML = `
|
|
176
|
+
<div class="collection-view-header" style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle);">
|
|
177
|
+
<div>
|
|
178
|
+
<h2 style="font-size: 16px; font-weight: 800; color: var(--text-heading); margin: 0; display: flex; align-items: center; gap: 8px;">
|
|
179
|
+
<span>${escapeHtml(col.name)}</span>
|
|
180
|
+
<span class="badge ${col.type === 'auth' ? 'badge-post' : 'badge-get'}" style="font-size: 10px; font-weight: 700;">${col.type.toUpperCase()}</span>
|
|
181
|
+
${col.system ? `<span class="badge" style="font-size: 10px; background: rgba(148, 163, 184, 0.2); color: var(--text-muted);">SYSTEM</span>` : ''}
|
|
182
|
+
</h2>
|
|
183
|
+
<p style="font-size: 12px; color: var(--text-muted); margin: 3px 0 0 0;">
|
|
184
|
+
Browse, filter, and manage records for the <code>${escapeHtml(col.name)}</code> table.
|
|
185
|
+
</p>
|
|
186
|
+
</div>
|
|
187
|
+
<div class="collection-view-actions" style="display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;">
|
|
188
|
+
<div class="dropdown-wrapper">
|
|
189
|
+
<button class="btn btn-secondary btn-sm" onclick="toggleExportMenu(event)" title="Export collection records">
|
|
190
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
|
191
|
+
<span>Export</span>
|
|
192
|
+
<span style="font-size: 10px; margin-left: 1px; opacity: 0.7;">▾</span>
|
|
193
|
+
</button>
|
|
194
|
+
<div id="export-dropdown-menu" style="display: none; position: absolute; left: 0; top: calc(100% + 4px); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 6px; box-shadow: var(--shadow-dropdown); min-width: 160px; z-index: 100; padding: 4px 0;">
|
|
195
|
+
<button class="dropdown-menu-item" onclick="exportData('csv')">
|
|
196
|
+
<span style="color: #60a5fa; font-weight: bold;">CSV</span> Export as CSV
|
|
197
|
+
</button>
|
|
198
|
+
<button class="dropdown-menu-item" onclick="exportData('json')">
|
|
199
|
+
<span style="color: #34d399; font-weight: bold;">{ }</span> Export as JSON
|
|
200
|
+
</button>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<button class="btn btn-secondary btn-sm" onclick="openImportModal()" title="Drag & drop CSV import with visual column mapping">
|
|
205
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
|
206
|
+
<span>Import CSV</span>
|
|
207
|
+
</button>
|
|
208
|
+
|
|
209
|
+
${!col.system ? `
|
|
210
|
+
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="color: var(--accent-primary);">
|
|
211
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
212
|
+
<span>Generate Mock Data</span>
|
|
213
|
+
</button>
|
|
214
|
+
` : ''}
|
|
215
|
+
|
|
216
|
+
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
217
|
+
<span>+ New Record</span>
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
208
222
|
<div class="controls-bar">
|
|
209
223
|
<div style="display:flex; align-items:center; gap:0.75rem; flex:1; max-width:640px;">
|
|
210
224
|
<div class="search-bar-composite" id="search-composite-box">
|
|
@@ -371,15 +385,36 @@
|
|
|
371
385
|
</td>
|
|
372
386
|
</tr>
|
|
373
387
|
`;
|
|
388
|
+
} else if (col.system) {
|
|
389
|
+
tbContainer.innerHTML = `
|
|
390
|
+
<tr>
|
|
391
|
+
<td colspan="${displayFields.length + 3}" style="text-align:center;padding:3.5rem 1rem;">
|
|
392
|
+
<div style="display:flex; flex-direction:column; align-items:center; gap:0.75rem;">
|
|
393
|
+
<div style="width:44px; height:44px; border-radius:50%; background:var(--bg-input); color:var(--text-muted); display:flex; align-items:center; justify-content:center;">
|
|
394
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>
|
|
395
|
+
</div>
|
|
396
|
+
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${escapeHtml(col.name)}' yet</div>
|
|
397
|
+
<div style="font-size:13px; color:var(--text-muted); max-width:400px; line-height:1.4;">
|
|
398
|
+
System activity and audit events will appear here automatically as operations execute.
|
|
399
|
+
</div>
|
|
400
|
+
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
|
|
401
|
+
<button class="btn btn-primary btn-sm" onclick="openNewRecordModal()">
|
|
402
|
+
<span>+ New Record</span>
|
|
403
|
+
</button>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</td>
|
|
407
|
+
</tr>
|
|
408
|
+
`;
|
|
374
409
|
} else {
|
|
375
410
|
tbContainer.innerHTML = `
|
|
376
411
|
<tr>
|
|
377
412
|
<td colspan="${displayFields.length + 3}" style="text-align:center;padding:3.5rem 1rem;">
|
|
378
413
|
<div style="display:flex; flex-direction:column; align-items:center; gap:0.75rem;">
|
|
379
414
|
<div style="width:44px; height:44px; border-radius:50%; background:rgba(59,130,246,0.12); color:#60a5fa; display:flex; align-items:center; justify-content:center; font-size:20px;">
|
|
380
|
-
|
|
415
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
381
416
|
</div>
|
|
382
|
-
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${col.name}' yet</div>
|
|
417
|
+
<div style="font-weight:600; font-size:15px; color:var(--text-main);">No records in '${escapeHtml(col.name)}' yet</div>
|
|
383
418
|
<div style="font-size:13px; color:var(--text-muted); max-width:380px; line-height:1.4;">
|
|
384
419
|
Populate your collection in seconds with realistic human names, emails, prices, avatars, and linked relations.
|
|
385
420
|
</div>
|
|
@@ -719,7 +754,7 @@
|
|
|
719
754
|
<div class="drawer-field-item">
|
|
720
755
|
<div class="drawer-field-header">
|
|
721
756
|
<span class="drawer-field-name">id</span>
|
|
722
|
-
<span class="badge" style="background:
|
|
757
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">system</span>
|
|
723
758
|
</div>
|
|
724
759
|
<div class="drawer-field-value" style="display:flex; align-items:center; justify-content:space-between;">
|
|
725
760
|
<span class="id-pill">${safeRecId}</span>
|
|
@@ -730,7 +765,7 @@
|
|
|
730
765
|
<div class="drawer-field-item">
|
|
731
766
|
<div class="drawer-field-header">
|
|
732
767
|
<span class="drawer-field-name">created</span>
|
|
733
|
-
<span class="badge" style="background:
|
|
768
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">datetime</span>
|
|
734
769
|
</div>
|
|
735
770
|
<div class="drawer-field-value" style="font-size:12px; color:var(--text-muted);">
|
|
736
771
|
${new Date(rec.created).toLocaleString()} <span style="font-family:var(--font-mono); opacity:0.7;">(${escapeHtml(rec.created)})</span>
|
|
@@ -741,7 +776,7 @@
|
|
|
741
776
|
<div class="drawer-field-item">
|
|
742
777
|
<div class="drawer-field-header">
|
|
743
778
|
<span class="drawer-field-name">updated</span>
|
|
744
|
-
<span class="badge" style="background:
|
|
779
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">datetime</span>
|
|
745
780
|
</div>
|
|
746
781
|
<div class="drawer-field-value" style="font-size:12px; color:var(--text-muted);">
|
|
747
782
|
${new Date(rec.updated).toLocaleString()} <span style="font-family:var(--font-mono); opacity:0.7;">(${escapeHtml(rec.updated)})</span>
|
|
@@ -756,14 +791,14 @@
|
|
|
756
791
|
<span class="badge badge-get">auth</span>
|
|
757
792
|
</div>
|
|
758
793
|
<div class="drawer-field-value" style="display:flex; align-items:center; justify-content:space-between;">
|
|
759
|
-
<span style="font-family:var(--font-mono); color
|
|
794
|
+
<span style="font-family:var(--font-mono); color: var(--accent-primary);">${escapeHtml(rec.email || '—')}</span>
|
|
760
795
|
<button class="btn btn-secondary btn-sm" style="padding:2px 6px; font-size:11px;" data-email="${escapeHtml(rec.email || '')}" onclick="handleDrawerCopyEmail(this)">Copy</button>
|
|
761
796
|
</div>
|
|
762
797
|
</div>
|
|
763
798
|
<div class="drawer-field-item">
|
|
764
799
|
<div class="drawer-field-header">
|
|
765
800
|
<span class="drawer-field-name">verified</span>
|
|
766
|
-
<span class="badge" style="background:
|
|
801
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">auth</span>
|
|
767
802
|
</div>
|
|
768
803
|
<div class="drawer-field-value">
|
|
769
804
|
<span class="badge ${rec.verified ? 'badge-get' : 'badge-delete'}">${rec.verified ? 'Verified' : 'Unverified'}</span>
|
|
@@ -772,7 +807,7 @@
|
|
|
772
807
|
<div class="drawer-field-item">
|
|
773
808
|
<div class="drawer-field-header">
|
|
774
809
|
<span class="drawer-field-name">emailVisibility</span>
|
|
775
|
-
<span class="badge" style="background:
|
|
810
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">auth</span>
|
|
776
811
|
</div>
|
|
777
812
|
<div class="drawer-field-value">
|
|
778
813
|
<span class="badge ${rec.emailVisibility ? 'badge-get' : 'badge-delete'}">${rec.emailVisibility ? 'Public' : 'Hidden'}</span>
|
|
@@ -868,7 +903,7 @@
|
|
|
868
903
|
}
|
|
869
904
|
|
|
870
905
|
if (typeof val === 'number' || field.type === 'number') {
|
|
871
|
-
return `<span style="font-family:var(--font-mono); font-weight:600; color
|
|
906
|
+
return `<span style="font-family:var(--font-mono); font-weight:600; color: var(--accent-primary);">${val}</span>`;
|
|
872
907
|
}
|
|
873
908
|
|
|
874
909
|
// Plain text or long text: display full inspection with copy button
|
|
@@ -890,11 +925,11 @@
|
|
|
890
925
|
if (e) e.stopPropagation();
|
|
891
926
|
if (!btnEl) return;
|
|
892
927
|
const id = btnEl.getAttribute('data-id');
|
|
893
|
-
if (id) {
|
|
894
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
895
|
-
closeRecordDrawer();
|
|
896
|
-
}
|
|
897
|
-
editRecord(id);
|
|
928
|
+
if (id) {
|
|
929
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
930
|
+
closeRecordDrawer();
|
|
931
|
+
}
|
|
932
|
+
editRecord(id);
|
|
898
933
|
}
|
|
899
934
|
}
|
|
900
935
|
|
|
@@ -914,11 +949,11 @@
|
|
|
914
949
|
function handleDrawerEditRecord(btnEl) {
|
|
915
950
|
if (!btnEl) return;
|
|
916
951
|
const id = btnEl.getAttribute('data-id');
|
|
917
|
-
if (id) {
|
|
918
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
919
|
-
closeRecordDrawer();
|
|
920
|
-
}
|
|
921
|
-
editRecord(id);
|
|
952
|
+
if (id) {
|
|
953
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
954
|
+
closeRecordDrawer();
|
|
955
|
+
}
|
|
956
|
+
editRecord(id);
|
|
922
957
|
}
|
|
923
958
|
}
|
|
924
959
|
|
|
@@ -931,11 +966,11 @@
|
|
|
931
966
|
function handleDrawerDeleteRecord(btnEl) {
|
|
932
967
|
if (!btnEl) return;
|
|
933
968
|
const id = btnEl.getAttribute('data-id');
|
|
934
|
-
if (id) {
|
|
935
|
-
if (typeof closeRecordDrawer === 'function') {
|
|
936
|
-
closeRecordDrawer();
|
|
937
|
-
}
|
|
938
|
-
drawerDeleteRecord(id);
|
|
969
|
+
if (id) {
|
|
970
|
+
if (typeof closeRecordDrawer === 'function') {
|
|
971
|
+
closeRecordDrawer();
|
|
972
|
+
}
|
|
973
|
+
drawerDeleteRecord(id);
|
|
939
974
|
}
|
|
940
975
|
}
|
|
941
976
|
|
|
@@ -1067,8 +1102,8 @@
|
|
|
1067
1102
|
if (!items || items.length === 0) {
|
|
1068
1103
|
container.innerHTML = `
|
|
1069
1104
|
<div class="audit-card" style="text-align:center; padding:2rem; color:var(--text-muted);">
|
|
1070
|
-
<
|
|
1071
|
-
<div style="font-weight:600; color
|
|
1105
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color:var(--text-muted); margin-bottom:0.5rem;"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
|
1106
|
+
<div style="font-weight:600; color:var(--text-heading); margin-bottom:0.25rem;">No History Logged</div>
|
|
1072
1107
|
<div style="font-size:12px;">No recorded field modifications found for this record.</div>
|
|
1073
1108
|
</div>
|
|
1074
1109
|
`;
|
|
@@ -1080,7 +1115,7 @@
|
|
|
1080
1115
|
|
|
1081
1116
|
container.innerHTML = `
|
|
1082
1117
|
<div style="margin-bottom:1rem; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px;">
|
|
1083
|
-
<h3 style="margin:0; font-size:13px; font-weight:700; color
|
|
1118
|
+
<h3 style="margin:0; font-size:13px; font-weight:700; color:var(--text-heading); text-transform:uppercase; letter-spacing:0.05em;">
|
|
1084
1119
|
Audit History (${countLabel})
|
|
1085
1120
|
</h3>
|
|
1086
1121
|
<span style="font-size:11px; color:var(--text-muted);">Immutable Append-Only Log</span>
|
|
@@ -296,7 +296,7 @@
|
|
|
296
296
|
let badgeHtml = '';
|
|
297
297
|
if (r.mode === 'admin') badgeHtml = '<span class="badge" style="background:rgba(239,68,68,0.18); color:#fca5a5;">🔒 Admin Only</span>';
|
|
298
298
|
else if (r.mode === 'public') badgeHtml = '<span class="badge" style="background:rgba(16,185,129,0.18); color:#6ee7b7;">🌐 Public</span>';
|
|
299
|
-
else if (r.mode === 'auth') badgeHtml = '<span class="badge" style="background:rgba(59,130,246,0.18); color
|
|
299
|
+
else if (r.mode === 'auth') badgeHtml = '<span class="badge" style="background:rgba(59,130,246,0.18); color: var(--accent-primary);">👤 Auth Users</span>';
|
|
300
300
|
else badgeHtml = '<span class="badge" style="background:rgba(245,158,11,0.18); color:#fbbf24;">⚙ Custom Rule</span>';
|
|
301
301
|
|
|
302
302
|
return `
|
|
@@ -91,18 +91,32 @@
|
|
|
91
91
|
|
|
92
92
|
const topActions = document.getElementById('view-actions');
|
|
93
93
|
if (topActions) topActions.innerHTML = '';
|
|
94
|
-
const actions = document.getElementById('collection-actions')
|
|
95
|
-
actions.innerHTML =
|
|
96
|
-
${!col.system ? `
|
|
97
|
-
<button class="btn btn-danger btn-sm" onclick="openDeleteCollectionModal('${col.name}')" title="Permanently delete this collection">
|
|
98
|
-
Delete Collection
|
|
99
|
-
</button>
|
|
100
|
-
` : ''}
|
|
101
|
-
<button class="btn btn-primary btn-sm" onclick="saveSchemaChanges()">Save Schema</button>
|
|
102
|
-
`;
|
|
94
|
+
const actions = document.getElementById('collection-actions');
|
|
95
|
+
if (actions) actions.innerHTML = '';
|
|
103
96
|
|
|
104
97
|
const main = document.getElementById('collections-detail-pane') || document.getElementById('main-body');
|
|
105
98
|
main.innerHTML = `
|
|
99
|
+
<div class="collection-view-header" style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle);">
|
|
100
|
+
<div>
|
|
101
|
+
<h2 style="font-size: 16px; font-weight: 800; color: var(--text-heading); margin: 0; display: flex; align-items: center; gap: 8px;">
|
|
102
|
+
<span>${escapeHtml(col.name)} Schema & Rules</span>
|
|
103
|
+
<span class="badge ${col.type === 'auth' ? 'badge-post' : 'badge-get'}" style="font-size: 10px; font-weight: 700;">${col.type.toUpperCase()}</span>
|
|
104
|
+
${col.system ? `<span class="badge" style="font-size: 10px; background: rgba(148, 163, 184, 0.2); color: var(--text-muted);">SYSTEM</span>` : ''}
|
|
105
|
+
</h2>
|
|
106
|
+
<p style="font-size: 12px; color: var(--text-muted); margin: 3px 0 0 0;">
|
|
107
|
+
Define database columns, field types, validations, and API access rules.
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;">
|
|
111
|
+
${!col.system ? `
|
|
112
|
+
<button class="btn btn-danger btn-sm" onclick="openDeleteCollectionModal('${escapeHtml(col.name)}')" title="Permanently delete this collection">
|
|
113
|
+
Delete Collection
|
|
114
|
+
</button>
|
|
115
|
+
` : ''}
|
|
116
|
+
<button class="btn btn-primary btn-sm" onclick="saveSchemaChanges()">Save Schema</button>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
106
120
|
<div style="max-width: 860px; display:flex; flex-direction:column; gap: 1.5rem;">
|
|
107
121
|
<div class="form-group">
|
|
108
122
|
<label class="form-label">Collection Name</label>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// ==========================================
|
|
2
|
+
// NodeStack Admin UI - Theme Manager
|
|
3
|
+
// Handles System, Light, and Dark appearance themes
|
|
4
|
+
// with localStorage persistence and OS change detection.
|
|
5
|
+
// ==========================================
|
|
6
|
+
|
|
7
|
+
const ThemeManager = {
|
|
8
|
+
STORAGE_KEY: 'nodestack_theme',
|
|
9
|
+
|
|
10
|
+
getTheme() {
|
|
11
|
+
try {
|
|
12
|
+
const stored = localStorage.getItem(this.STORAGE_KEY);
|
|
13
|
+
if (stored === 'light' || stored === 'dark' || stored === 'system') {
|
|
14
|
+
return stored;
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
return 'system';
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
getSystemPreference() {
|
|
21
|
+
try {
|
|
22
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
23
|
+
return 'dark';
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {}
|
|
26
|
+
return 'light';
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
getEffectiveTheme() {
|
|
30
|
+
const pref = this.getTheme();
|
|
31
|
+
return pref === 'system' ? this.getSystemPreference() : pref;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
applyTheme(theme) {
|
|
35
|
+
const validTheme = ['system', 'dark', 'light'].includes(theme) ? theme : 'system';
|
|
36
|
+
try {
|
|
37
|
+
localStorage.setItem(this.STORAGE_KEY, validTheme);
|
|
38
|
+
} catch (e) {}
|
|
39
|
+
|
|
40
|
+
const effective = validTheme === 'system' ? this.getSystemPreference() : validTheme;
|
|
41
|
+
const root = document.documentElement;
|
|
42
|
+
|
|
43
|
+
root.classList.remove('dark', 'light');
|
|
44
|
+
root.classList.add(effective);
|
|
45
|
+
root.setAttribute('data-theme', validTheme);
|
|
46
|
+
root.setAttribute('data-color-scheme', effective);
|
|
47
|
+
|
|
48
|
+
this.updateUI(validTheme);
|
|
49
|
+
|
|
50
|
+
// If Analytics view is active, redraw charts with theme-aware colors
|
|
51
|
+
if (typeof renderCurrentAnalyticsView === 'function' && typeof state !== 'undefined' && state && state.activeNav === 'analytics') {
|
|
52
|
+
try {
|
|
53
|
+
renderCurrentAnalyticsView();
|
|
54
|
+
} catch (e) {}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (typeof window !== 'undefined' && window.dispatchEvent) {
|
|
58
|
+
window.dispatchEvent(new CustomEvent('nodestack-theme-changed', {
|
|
59
|
+
detail: { theme: validTheme, effective }
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
updateUI(theme) {
|
|
65
|
+
const currentTheme = theme || this.getTheme();
|
|
66
|
+
const buttons = document.querySelectorAll('.theme-picker-btn');
|
|
67
|
+
buttons.forEach((btn) => {
|
|
68
|
+
const btnTheme = btn.getAttribute('data-theme-value');
|
|
69
|
+
if (btnTheme === currentTheme) {
|
|
70
|
+
btn.classList.add('active');
|
|
71
|
+
btn.setAttribute('aria-pressed', 'true');
|
|
72
|
+
} else {
|
|
73
|
+
btn.classList.remove('active');
|
|
74
|
+
btn.setAttribute('aria-pressed', 'false');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
init() {
|
|
80
|
+
const currentTheme = this.getTheme();
|
|
81
|
+
this.applyTheme(currentTheme);
|
|
82
|
+
|
|
83
|
+
// Listen for OS system theme changes
|
|
84
|
+
if (typeof window !== 'undefined' && window.matchMedia) {
|
|
85
|
+
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
86
|
+
const handleMediaChange = () => {
|
|
87
|
+
if (this.getTheme() === 'system') {
|
|
88
|
+
this.applyTheme('system');
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (typeof mql.addEventListener === 'function') {
|
|
93
|
+
mql.addEventListener('change', handleMediaChange);
|
|
94
|
+
} else if (typeof mql.addListener === 'function') {
|
|
95
|
+
mql.addListener(handleMediaChange);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.updateUI(currentTheme);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Global shorthand for inline onclick handlers
|
|
104
|
+
function setTheme(theme) {
|
|
105
|
+
ThemeManager.applyTheme(theme);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof window !== 'undefined') {
|
|
109
|
+
window.ThemeManager = ThemeManager;
|
|
110
|
+
window.setTheme = setTheme;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Auto-initialize when DOM is ready
|
|
114
|
+
if (typeof document !== 'undefined') {
|
|
115
|
+
if (document.readyState === 'loading') {
|
|
116
|
+
document.addEventListener('DOMContentLoaded', () => ThemeManager.init());
|
|
117
|
+
} else {
|
|
118
|
+
ThemeManager.init();
|
|
119
|
+
}
|
|
120
|
+
}
|