@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
|
@@ -15,6 +15,16 @@ function renderPluginNavItems() {
|
|
|
15
15
|
railCount.textContent = String(items.length);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const homePlugEl = document.getElementById('home-stat-plugins');
|
|
19
|
+
const homePlugSubEl = document.getElementById('home-stat-plugins-sub');
|
|
20
|
+
if (homePlugEl) {
|
|
21
|
+
homePlugEl.textContent = String(items.length);
|
|
22
|
+
}
|
|
23
|
+
if (homePlugSubEl) {
|
|
24
|
+
const catalogCount = (state.pluginCatalog && state.pluginCatalog.length) || 5;
|
|
25
|
+
homePlugSubEl.textContent = `${items.length} active / ${catalogCount} available`;
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
if (!group || !container) return;
|
|
19
29
|
|
|
20
30
|
if (items.length === 0) {
|
|
@@ -95,11 +105,11 @@ function renderPluginView(item) {
|
|
|
95
105
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem;">
|
|
96
106
|
<div style="background: rgba(0,0,0,0.2); padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.04);">
|
|
97
107
|
<div style="font-size: 11px; color: var(--text-muted);">Plugin ID</div>
|
|
98
|
-
<div style="font-size: 13px; font-weight: 600; color:
|
|
108
|
+
<div style="font-size: 13px; font-weight: 600; color: var(--accent-primary); font-family: monospace;">${escapeHtml(item.id)}</div>
|
|
99
109
|
</div>
|
|
100
110
|
<div style="background: rgba(0,0,0,0.2); padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.04);">
|
|
101
111
|
<div style="font-size: 11px; color: var(--text-muted);">Lifecycle State</div>
|
|
102
|
-
<div style="font-size: 13px; font-weight: 600; color:
|
|
112
|
+
<div style="font-size: 13px; font-weight: 600; color: var(--accent-success);">Active & Mounted</div>
|
|
103
113
|
</div>
|
|
104
114
|
</div>
|
|
105
115
|
</div>
|
|
@@ -110,12 +120,12 @@ function renderPluginView(item) {
|
|
|
110
120
|
<div id="plugin-overview-card-${escapeHtml(item.id)}" style="background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem;">
|
|
111
121
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;">
|
|
112
122
|
<div style="display: flex; align-items: center; gap: 0.75rem;">
|
|
113
|
-
<div style="width: 40px; height: 40px; border-radius: 10px; background:
|
|
123
|
+
<div style="width: 40px; height: 40px; border-radius: 10px; background: var(--bg-main); border: 1px solid rgba(59, 130, 246, 0.4); display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
|
|
114
124
|
<span style="font-size: 20px;">🧩</span>
|
|
115
125
|
</div>
|
|
116
126
|
<div>
|
|
117
127
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
118
|
-
<span id="plugin-overview-title-${escapeHtml(item.id)}" style="font-weight: 800; font-size: 16px; color:
|
|
128
|
+
<span id="plugin-overview-title-${escapeHtml(item.id)}" style="font-weight: 800; font-size: 16px; color: var(--text-heading);">${escapeHtml(title)}</span>
|
|
119
129
|
<span id="plugin-overview-badge-${escapeHtml(item.id)}">${item.badge ? `<span class="badge ${item.badgeVariant ? 'badge-' + item.badgeVariant : 'badge-get'}">${escapeHtml(item.badge)}</span>` : ''}</span>
|
|
120
130
|
</div>
|
|
121
131
|
<div id="plugin-overview-desc-${escapeHtml(item.id)}" style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">
|
|
@@ -206,11 +216,11 @@ function syncPluginOverview(pluginId, fields) {
|
|
|
206
216
|
</div>
|
|
207
217
|
<div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
|
|
208
218
|
<div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Region</div>
|
|
209
|
-
<div style="font-size: 13px; font-weight: 700; color:
|
|
219
|
+
<div style="font-size: 13px; font-weight: 700; color: var(--accent-success); font-family: monospace; margin-top: 4px;">${escapeHtml(curRegion)}</div>
|
|
210
220
|
</div>
|
|
211
221
|
<div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
|
|
212
222
|
<div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Tracking Collection</div>
|
|
213
|
-
<div style="font-size: 13px; font-weight: 700; color:
|
|
223
|
+
<div style="font-size: 13px; font-weight: 700; color: var(--accent-warning); font-family: monospace; margin-top: 4px;">_s3_uploads</div>
|
|
214
224
|
</div>
|
|
215
225
|
</div>
|
|
216
226
|
`;
|
|
@@ -296,7 +306,7 @@ async function loadPluginConfig(pluginId) {
|
|
|
296
306
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.85rem;">
|
|
297
307
|
<div>
|
|
298
308
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
299
|
-
<span style="font-weight: 800; font-size: 15px; color:
|
|
309
|
+
<span style="font-weight: 800; font-size: 15px; color: var(--text-heading);">⚙️ Configuration & Credentials</span>
|
|
300
310
|
<span class="badge badge-info" style="font-size: 10.5px;">Option B Precedence</span>
|
|
301
311
|
</div>
|
|
302
312
|
<div style="font-size: 12px; color: var(--text-muted); margin-top: 3px;">
|
|
@@ -304,43 +314,189 @@ async function loadPluginConfig(pluginId) {
|
|
|
304
314
|
</div>
|
|
305
315
|
</div>
|
|
306
316
|
<div style="display: flex; align-items: center; gap: 0.5rem; font-size: 11.5px;">
|
|
307
|
-
<span class="badge
|
|
308
|
-
<span class="badge
|
|
317
|
+
<span class="badge badge-secondary">🔒 ${lockedCount} Locked</span>
|
|
318
|
+
<span class="badge badge-success">✏️ ${editableCount} Editable</span>
|
|
309
319
|
</div>
|
|
310
320
|
</div>
|
|
311
321
|
|
|
312
322
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem;">
|
|
313
|
-
${
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
323
|
+
${(() => {
|
|
324
|
+
const consumed = new Set();
|
|
325
|
+
const cards = [];
|
|
326
|
+
|
|
327
|
+
for (const field of res.fields) {
|
|
328
|
+
if (consumed.has(field.name)) continue;
|
|
329
|
+
|
|
330
|
+
// Check if field is a Webhook URL that pairs with a boolean toggle
|
|
331
|
+
let urlField = null;
|
|
332
|
+
let toggleField = null;
|
|
333
|
+
let platformTitle = '';
|
|
334
|
+
let platformIcon = '';
|
|
335
|
+
|
|
336
|
+
if (field.name.endsWith('WebhookUrl') || field.name.endsWith('Url')) {
|
|
337
|
+
const prefix = field.name.replace(/WebhookUrl$|Url$/, '');
|
|
338
|
+
const tName1 = 'enable' + prefix.charAt(0).toUpperCase() + prefix.slice(1);
|
|
339
|
+
const tName2 = prefix + 'Enabled';
|
|
340
|
+
const match = res.fields.find(f => (f.name === tName1 || f.name === tName2) && f.type === 'boolean');
|
|
341
|
+
if (match) {
|
|
342
|
+
urlField = field;
|
|
343
|
+
toggleField = match;
|
|
344
|
+
}
|
|
345
|
+
} else if (field.type === 'boolean' && (field.name.startsWith('enable') || field.name.endsWith('Enabled'))) {
|
|
346
|
+
let prefix = '';
|
|
347
|
+
if (field.name.startsWith('enable')) {
|
|
348
|
+
prefix = field.name.slice(6);
|
|
349
|
+
prefix = prefix.charAt(0).toLowerCase() + prefix.slice(1);
|
|
350
|
+
} else {
|
|
351
|
+
prefix = field.name.replace(/Enabled$/, '');
|
|
352
|
+
}
|
|
353
|
+
const match = res.fields.find(f => (f.name === prefix + 'WebhookUrl' || f.name === prefix + 'Url') && f.type === 'text');
|
|
354
|
+
if (match) {
|
|
355
|
+
urlField = match;
|
|
356
|
+
toggleField = field;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (urlField && toggleField) {
|
|
361
|
+
consumed.add(urlField.name);
|
|
362
|
+
consumed.add(toggleField.name);
|
|
363
|
+
|
|
364
|
+
const lowerName = urlField.name.toLowerCase();
|
|
365
|
+
if (lowerName.includes('discord')) {
|
|
366
|
+
platformTitle = 'Discord Channel';
|
|
367
|
+
platformIcon = '<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
|
|
368
|
+
} else if (lowerName.includes('slack')) {
|
|
369
|
+
platformTitle = 'Slack Channel';
|
|
370
|
+
platformIcon = '<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>';
|
|
371
|
+
} else {
|
|
372
|
+
platformTitle = urlField.label || 'Channel Webhook';
|
|
373
|
+
platformIcon = '🔔';
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const urlId = `cfg-${pluginId}-${urlField.name}`;
|
|
377
|
+
const toggleId = `cfg-${pluginId}-${toggleField.name}`;
|
|
378
|
+
const isUrlLocked = urlField.isLocked;
|
|
379
|
+
const isToggleLocked = toggleField.isLocked;
|
|
380
|
+
const isToggleChecked = toggleField.value !== false;
|
|
381
|
+
|
|
382
|
+
const badgeHtml = isUrlLocked ? `
|
|
383
|
+
<span class="badge badge-secondary" style="font-size: 10px; padding: 2px 6px;" title="${escapeHtml(urlField.lockReason || 'Locked')}">
|
|
384
|
+
🔒 ENV LOCKED
|
|
385
|
+
</span>
|
|
386
|
+
` : (urlField.source === 'db' || toggleField.source === 'db' ? `
|
|
387
|
+
<span class="badge badge-success" style="font-size: 10px; padding: 2px 6px;">
|
|
388
|
+
✏️ DATABASE OVERRIDE
|
|
389
|
+
</span>
|
|
390
|
+
` : `
|
|
391
|
+
<span class="badge badge-primary" style="font-size: 10px; padding: 2px 6px;">
|
|
392
|
+
✏️ ${urlField.source === 'code' ? 'CODE DEFAULT' : 'DEFAULT'}
|
|
393
|
+
</span>
|
|
394
|
+
`);
|
|
395
|
+
|
|
396
|
+
cards.push(`
|
|
397
|
+
<div style="background: var(--bg-input); border: 1px solid ${isUrlLocked ? 'rgba(255,255,255,0.06)' : 'var(--border-subtle)'}; border-radius: 8px; padding: 0.95rem 1.1rem; display: flex; flex-direction: column; gap: 0.65rem;">
|
|
398
|
+
<div style="display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;">
|
|
399
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
400
|
+
<span style="display: inline-flex; align-items: center; color: var(--accent-primary);">${platformIcon}</span>
|
|
401
|
+
<label style="font-size: 13px; font-weight: 700; color: var(--text-heading); cursor: pointer; margin: 0;" for="${toggleId}">
|
|
402
|
+
${escapeHtml(platformTitle)}
|
|
403
|
+
</label>
|
|
404
|
+
</div>
|
|
405
|
+
<div style="display: flex; align-items: center; gap: 10px;">
|
|
406
|
+
<label style="display: inline-flex; align-items: center; gap: 6px; cursor: ${isToggleLocked ? 'not-allowed' : 'pointer'}; margin: 0; user-select: none;">
|
|
407
|
+
<input type="checkbox" id="${toggleId}" ${isToggleChecked ? 'checked' : ''} ${isToggleLocked ? 'disabled' : ''}
|
|
408
|
+
onchange="const inp = document.getElementById('${urlId}'); if (inp) inp.style.opacity = this.checked ? '1' : '0.55';"
|
|
409
|
+
style="cursor: pointer; width: 16px; height: 16px; accent-color: var(--accent-primary);" />
|
|
410
|
+
<span style="font-size: 12px; font-weight: 600; color: var(--text-main);">Enabled</span>
|
|
411
|
+
</label>
|
|
412
|
+
${badgeHtml}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
336
415
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
${
|
|
342
|
-
<
|
|
343
|
-
|
|
416
|
+
<div style="display: flex; flex-direction: column; gap: 0.35rem;">
|
|
417
|
+
<label style="font-size: 11.5px; font-weight: 600; color: var(--text-muted); display: block;" for="${urlId}">
|
|
418
|
+
${escapeHtml(urlField.label)} ${urlField.required ? '<span style="color:#ef4444;">*</span>' : ''}
|
|
419
|
+
</label>
|
|
420
|
+
${isUrlLocked ? `
|
|
421
|
+
<input type="text" class="form-input" disabled value="${escapeHtml(urlField.value !== undefined ? String(urlField.value) : '')}"
|
|
422
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-family: monospace; font-size: 12.5px; border-color: rgba(255,255,255,0.06);" />
|
|
423
|
+
<div style="font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 4px;">
|
|
424
|
+
<span>🔒</span> <span>${escapeHtml(urlField.lockReason || 'Managed by environment')}</span>
|
|
425
|
+
</div>
|
|
426
|
+
` : `
|
|
427
|
+
<input type="text" class="form-input" id="${urlId}"
|
|
428
|
+
value="${escapeHtml(urlField.value !== undefined ? String(urlField.value) : '')}" placeholder="${escapeHtml(urlField.placeholder || '')}"
|
|
429
|
+
style="font-family: monospace; font-size: 12.5px; opacity: ${isToggleChecked ? '1' : '0.55'}; transition: opacity 0.15s ease;" />
|
|
430
|
+
`}
|
|
431
|
+
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
432
|
+
${escapeHtml(urlField.description || '')}
|
|
433
|
+
${urlField.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(urlField.envKey)})</span>` : ''}
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
`);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Standard standalone field card
|
|
442
|
+
consumed.add(field.name);
|
|
443
|
+
const isLocked = field.isLocked;
|
|
444
|
+
const fieldId = `cfg-${pluginId}-${field.name}`;
|
|
445
|
+
cards.push(`
|
|
446
|
+
<div style="background: var(--bg-input); border: 1px solid ${isLocked ? 'rgba(255,255,255,0.06)' : 'var(--border-subtle)'}; border-radius: 8px; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.45rem;">
|
|
447
|
+
<div style="display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;">
|
|
448
|
+
<label style="font-size: 12.5px; font-weight: 700; color: var(--text-heading);" for="${fieldId}">
|
|
449
|
+
${escapeHtml(field.label)} ${field.required ? '<span style="color:#ef4444;">*</span>' : ''}
|
|
450
|
+
</label>
|
|
451
|
+
${isLocked ? `
|
|
452
|
+
<span class="badge badge-secondary" style="font-size: 10px; padding: 2px 6px;" title="${escapeHtml(field.lockReason || 'Locked')}">
|
|
453
|
+
🔒 ENV LOCKED
|
|
454
|
+
</span>
|
|
455
|
+
` : (field.source === 'db' ? `
|
|
456
|
+
<span class="badge badge-success" style="font-size: 10px; padding: 2px 6px;">
|
|
457
|
+
✏️ DATABASE OVERRIDE
|
|
458
|
+
</span>
|
|
459
|
+
` : `
|
|
460
|
+
<span class="badge badge-primary" style="font-size: 10px; padding: 2px 6px;">
|
|
461
|
+
✏️ ${field.source === 'code' ? 'CODE DEFAULT' : 'DEFAULT'}
|
|
462
|
+
</span>
|
|
463
|
+
`)}
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
${isLocked ? `
|
|
467
|
+
${field.type === 'select' ? `
|
|
468
|
+
<select class="form-input" disabled
|
|
469
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-size: 12.5px; border-color: rgba(255,255,255,0.06); color: var(--text-heading);">
|
|
470
|
+
${field.value !== undefined && !(field.options || []).some(opt => String(typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === String(field.value)) ? `
|
|
471
|
+
<option value="${escapeHtml(String(field.value))}" selected>${escapeHtml(String(field.value))}</option>
|
|
472
|
+
` : ''}
|
|
473
|
+
${(field.options || []).map(opt => {
|
|
474
|
+
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
475
|
+
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
476
|
+
const isSelected = String(field.value) === String(optVal);
|
|
477
|
+
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
478
|
+
}).join('')}
|
|
479
|
+
</select>
|
|
480
|
+
` : `
|
|
481
|
+
<input type="text" class="form-input" disabled value="${escapeHtml(field.type === 'password' ? '••••••••' : (field.value !== undefined ? String(field.value) : ''))}"
|
|
482
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-family: monospace; font-size: 12.5px; border-color: rgba(255,255,255,0.06);" />
|
|
483
|
+
`}
|
|
484
|
+
<div style="font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 4px;">
|
|
485
|
+
<span>🔒</span> <span>${escapeHtml(field.lockReason || 'Managed by environment')}</span>
|
|
486
|
+
</div>
|
|
487
|
+
` : (field.type === 'boolean' ? `
|
|
488
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; height: 36px;">
|
|
489
|
+
<input type="checkbox" id="${fieldId}" ${field.value ? 'checked' : ''} style="cursor: pointer; width: 18px; height: 18px;" />
|
|
490
|
+
<label for="${fieldId}" style="font-size: 12.5px; color: var(--text-main); cursor: pointer;">Enabled</label>
|
|
491
|
+
</div>
|
|
492
|
+
` : (field.type === 'select' ? `
|
|
493
|
+
<select class="form-input" id="${fieldId}"
|
|
494
|
+
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color: var(--text-heading);">
|
|
495
|
+
${!field.required && !(field.options || []).some(opt => (typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === '') ? `
|
|
496
|
+
<option value="" ${field.value === undefined || field.value === '' ? 'selected' : ''}>${escapeHtml(field.placeholder || '-- Select an option --')}</option>
|
|
497
|
+
` : (field.placeholder && (field.value === undefined || field.value === '') ? `
|
|
498
|
+
<option value="" disabled selected>${escapeHtml(field.placeholder)}</option>
|
|
499
|
+
` : '')}
|
|
344
500
|
${(field.options || []).map(opt => {
|
|
345
501
|
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
346
502
|
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
@@ -348,56 +504,31 @@ async function loadPluginConfig(pluginId) {
|
|
|
348
504
|
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
349
505
|
}).join('')}
|
|
350
506
|
</select>
|
|
507
|
+
` : (field.type === 'password' ? `
|
|
508
|
+
<input type="password" class="form-input" id="${fieldId}"
|
|
509
|
+
value="" placeholder="${field.hasValue ? '•••••••• (Secret configured - leave blank to keep unchanged)' : escapeHtml(field.placeholder || 'Enter secret...')}"
|
|
510
|
+
autocomplete="new-password"
|
|
511
|
+
style="font-family: monospace; font-size: 12.5px;" />
|
|
512
|
+
${field.hasValue ? `
|
|
513
|
+
<div style="font-size: 10.5px; color: var(--accent-success); display: flex; align-items: center; gap: 4px; margin-top: 2px;">
|
|
514
|
+
<span>✓</span> <span>Secret is configured. Leave blank to keep existing secret.</span>
|
|
515
|
+
</div>
|
|
516
|
+
` : ''}
|
|
351
517
|
` : `
|
|
352
|
-
<input type="text" class="form-input"
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
<input type="checkbox" id="${fieldId}" ${field.value ? 'checked' : ''} style="cursor: pointer; width: 18px; height: 18px;" />
|
|
361
|
-
<label for="${fieldId}" style="font-size: 12.5px; color: #e2e8f0; cursor: pointer;">Enabled</label>
|
|
518
|
+
<input type="text" class="form-input" id="${fieldId}"
|
|
519
|
+
value="${escapeHtml(field.value !== undefined ? String(field.value) : '')}" placeholder="${escapeHtml(field.placeholder || '')}"
|
|
520
|
+
style="font-family: monospace; font-size: 12.5px;" />
|
|
521
|
+
`)))}
|
|
522
|
+
|
|
523
|
+
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
524
|
+
${escapeHtml(field.description || '')}
|
|
525
|
+
${field.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(field.envKey)})</span>` : ''}
|
|
362
526
|
</div>
|
|
363
|
-
` : (field.type === 'select' ? `
|
|
364
|
-
<select class="form-input" id="${fieldId}"
|
|
365
|
-
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color: #fff;">
|
|
366
|
-
${!field.required && !(field.options || []).some(opt => (typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === '') ? `
|
|
367
|
-
<option value="" ${field.value === undefined || field.value === '' ? 'selected' : ''}>${escapeHtml(field.placeholder || '-- Select an option --')}</option>
|
|
368
|
-
` : (field.placeholder && (field.value === undefined || field.value === '') ? `
|
|
369
|
-
<option value="" disabled selected>${escapeHtml(field.placeholder)}</option>
|
|
370
|
-
` : '')}
|
|
371
|
-
${(field.options || []).map(opt => {
|
|
372
|
-
const optVal = typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt;
|
|
373
|
-
const optLabel = typeof opt === 'object' && opt !== null && 'label' in opt ? opt.label : opt;
|
|
374
|
-
const isSelected = String(field.value) === String(optVal);
|
|
375
|
-
return `<option value="${escapeHtml(String(optVal))}" ${isSelected ? 'selected' : ''}>${escapeHtml(String(optLabel))}</option>`;
|
|
376
|
-
}).join('')}
|
|
377
|
-
</select>
|
|
378
|
-
` : (field.type === 'password' ? `
|
|
379
|
-
<input type="password" class="form-input" id="${fieldId}"
|
|
380
|
-
value="" placeholder="${field.hasValue ? '•••••••• (Secret configured - leave blank to keep unchanged)' : escapeHtml(field.placeholder || 'Enter secret...')}"
|
|
381
|
-
autocomplete="new-password"
|
|
382
|
-
style="font-family: monospace; font-size: 12.5px;" />
|
|
383
|
-
${field.hasValue ? `
|
|
384
|
-
<div style="font-size: 10.5px; color: #34d399; display: flex; align-items: center; gap: 4px; margin-top: 2px;">
|
|
385
|
-
<span>✓</span> <span>Secret is configured. Leave blank to keep existing secret.</span>
|
|
386
|
-
</div>
|
|
387
|
-
` : ''}
|
|
388
|
-
` : `
|
|
389
|
-
<input type="text" class="form-input" id="${fieldId}"
|
|
390
|
-
value="${escapeHtml(field.value !== undefined ? String(field.value) : '')}" placeholder="${escapeHtml(field.placeholder || '')}"
|
|
391
|
-
style="font-family: monospace; font-size: 12.5px;" />
|
|
392
|
-
`)))}
|
|
393
|
-
|
|
394
|
-
<div style="font-size: 11px; color: var(--text-muted); line-height: 1.35;">
|
|
395
|
-
${escapeHtml(field.description || '')}
|
|
396
|
-
${field.envKey ? `<span style="display:inline-block; margin-left: 4px; font-family: monospace; opacity: 0.8;">(${escapeHtml(field.envKey)})</span>` : ''}
|
|
397
527
|
</div>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
528
|
+
`);
|
|
529
|
+
}
|
|
530
|
+
return cards.join('');
|
|
531
|
+
})()}
|
|
401
532
|
</div>
|
|
402
533
|
|
|
403
534
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle);">
|
|
@@ -613,7 +744,7 @@ function renderPluginsHubView() {
|
|
|
613
744
|
<div class="hub-hero-banner">
|
|
614
745
|
<div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.75rem;">
|
|
615
746
|
<div>
|
|
616
|
-
<h2 style="font-size:18px; font-weight:800; color
|
|
747
|
+
<h2 style="font-size:18px; font-weight:800; color: var(--text-heading); letter-spacing:-0.02em;">Installed Extensions & Plugins Hub</h2>
|
|
617
748
|
<p style="font-size:12px; color:var(--text-muted); margin-top:3px;">
|
|
618
749
|
Modular official plugins extending NodeStack with Stripe payments, S3 cloud storage, Resend emails, Webhooks, and Algolia search.
|
|
619
750
|
</p>
|
|
@@ -626,11 +757,11 @@ function renderPluginsHubView() {
|
|
|
626
757
|
<div class="hub-stats-row" style="margin-top:0.5rem;">
|
|
627
758
|
<div class="hub-stat-card">
|
|
628
759
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Active Extensions</span>
|
|
629
|
-
<span style="font-size:20px; font-weight:800; color
|
|
760
|
+
<span style="font-size:20px; font-weight:800; color:var(--accent-primary);">${items.length}</span>
|
|
630
761
|
</div>
|
|
631
762
|
<div class="hub-stat-card">
|
|
632
763
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Architecture</span>
|
|
633
|
-
<span style="font-size:13px; font-weight:700; color
|
|
764
|
+
<span style="font-size:13px; font-weight:700; color:var(--accent-success); margin-top:4px;">app.use(plugin)</span>
|
|
634
765
|
</div>
|
|
635
766
|
<div class="hub-stat-card">
|
|
636
767
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Official Catalog</span>
|
|
@@ -684,7 +815,7 @@ function renderPluginsHubView() {
|
|
|
684
815
|
` : `
|
|
685
816
|
<div style="background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:10px; padding:1.25rem; text-align:center; color:var(--text-muted); margin-bottom:1.5rem;">
|
|
686
817
|
<div style="font-size:22px; margin-bottom:0.25rem;">🧩</div>
|
|
687
|
-
<div style="font-weight:700; font-size:14px; color
|
|
818
|
+
<div style="font-weight:700; font-size:14px; color: var(--text-heading);">No Extensions Currently Active</div>
|
|
688
819
|
<div style="font-size:12px; margin-top:4px;">Enable any of the official community extensions below with 1-click, or mount custom plugins using <code>app.use(plugin)</code> in code.</div>
|
|
689
820
|
</div>
|
|
690
821
|
`}
|