@nodestackapp/server 2.5.0 → 2.6.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/README.md +40 -28
- package/dist/NodeStack.d.ts +1 -1
- package/dist/NodeStack.d.ts.map +1 -1
- package/dist/NodeStack.js +73 -12
- package/dist/NodeStack.js.map +1 -1
- package/dist/admin/AdminUIBundler.d.ts.map +1 -1
- package/dist/admin/AdminUIBundler.js +1 -0
- package/dist/admin/AdminUIBundler.js.map +1 -1
- package/dist/admin/ui/css/main.css +34 -0
- package/dist/admin/ui/css/webhooks.css +8 -0
- package/dist/admin/ui/index.html +19150 -17212
- package/dist/admin/ui/js/api-keys.js +1381 -0
- package/dist/admin/ui/js/app.js +667 -641
- package/dist/admin/ui/js/apps.js +496 -489
- package/dist/admin/ui/js/collections.js +486 -484
- package/dist/admin/ui/js/command-palette.js +683 -673
- package/dist/admin/ui/js/flows-designer.js +1125 -1076
- package/dist/admin/ui/js/flows.js +908 -890
- package/dist/admin/ui/js/functions-tester.js +1 -1
- package/dist/admin/ui/js/functions-workbench.js +1144 -1101
- package/dist/admin/ui/js/functions.js +980 -979
- package/dist/admin/ui/js/rules.js +1080 -775
- package/dist/admin/ui/js/schema.js +346 -304
- package/dist/admin/ui/js/views.js +1 -1
- package/dist/apps/AppManager.d.ts +1 -1
- package/dist/apps/AppManager.d.ts.map +1 -1
- package/dist/apps/AppManager.js +4 -18
- package/dist/apps/AppManager.js.map +1 -1
- package/dist/apps/AppRegistry.d.ts +1 -0
- package/dist/apps/AppRegistry.d.ts.map +1 -1
- package/dist/apps/AppRegistry.js +78 -23
- package/dist/apps/AppRegistry.js.map +1 -1
- package/dist/apps/AppScope.d.ts +0 -1
- package/dist/apps/AppScope.d.ts.map +1 -1
- package/dist/apps/AppScope.js +5 -15
- package/dist/apps/AppScope.js.map +1 -1
- package/dist/auth/ApiKeyService.d.ts +62 -2
- package/dist/auth/ApiKeyService.d.ts.map +1 -1
- package/dist/auth/ApiKeyService.js +503 -8
- package/dist/auth/ApiKeyService.js.map +1 -1
- package/dist/auth/AuthService.d.ts +30 -1
- package/dist/auth/AuthService.d.ts.map +1 -1
- package/dist/auth/AuthService.js +468 -65
- package/dist/auth/AuthService.js.map +1 -1
- package/dist/auth/oauth/AppleProvider.d.ts +2 -0
- package/dist/auth/oauth/AppleProvider.d.ts.map +1 -1
- package/dist/auth/oauth/AppleProvider.js +40 -3
- package/dist/auth/oauth/AppleProvider.js.map +1 -1
- package/dist/auth/oauth/BaseOAuthProvider.d.ts +3 -2
- package/dist/auth/oauth/BaseOAuthProvider.d.ts.map +1 -1
- package/dist/auth/oauth/BaseOAuthProvider.js +29 -3
- package/dist/auth/oauth/BaseOAuthProvider.js.map +1 -1
- package/dist/auth/oauth/DiscordProvider.d.ts.map +1 -1
- package/dist/auth/oauth/DiscordProvider.js +4 -1
- package/dist/auth/oauth/DiscordProvider.js.map +1 -1
- package/dist/auth/oauth/GitHubProvider.d.ts.map +1 -1
- package/dist/auth/oauth/GitHubProvider.js +4 -1
- package/dist/auth/oauth/GitHubProvider.js.map +1 -1
- package/dist/auth/oauth/GoogleProvider.d.ts.map +1 -1
- package/dist/auth/oauth/GoogleProvider.js +4 -1
- package/dist/auth/oauth/GoogleProvider.js.map +1 -1
- package/dist/auth/oauth/MicrosoftProvider.d.ts.map +1 -1
- package/dist/auth/oauth/MicrosoftProvider.js +4 -1
- package/dist/auth/oauth/MicrosoftProvider.js.map +1 -1
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts +6 -2
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts.map +1 -1
- package/dist/auth/oauth/OAuthProviderRegistry.js +25 -10
- package/dist/auth/oauth/OAuthProviderRegistry.js.map +1 -1
- package/dist/auth/oauth/types.d.ts +4 -2
- package/dist/auth/oauth/types.d.ts.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +228 -12
- package/dist/cli/cli.js.map +1 -1
- package/dist/core/config/ConfigService.d.ts.map +1 -1
- package/dist/core/config/ConfigService.js +5 -3
- package/dist/core/config/ConfigService.js.map +1 -1
- package/dist/core/config/EnvLoader.d.ts +14 -0
- package/dist/core/config/EnvLoader.d.ts.map +1 -1
- package/dist/core/config/EnvLoader.js +44 -0
- package/dist/core/config/EnvLoader.js.map +1 -1
- package/dist/core/container/Container.d.ts +14 -0
- package/dist/core/container/Container.d.ts.map +1 -1
- package/dist/core/container/Container.js +32 -0
- package/dist/core/container/Container.js.map +1 -1
- package/dist/core/errors/AppError.d.ts +7 -7
- package/dist/core/errors/AppError.d.ts.map +1 -1
- package/dist/core/errors/AppError.js +18 -14
- package/dist/core/errors/AppError.js.map +1 -1
- package/dist/core/events/EventBus.d.ts.map +1 -1
- package/dist/core/events/EventBus.js +36 -6
- package/dist/core/events/EventBus.js.map +1 -1
- package/dist/core/maintenance/MaintenanceGate.d.ts +47 -0
- package/dist/core/maintenance/MaintenanceGate.d.ts.map +1 -1
- package/dist/core/maintenance/MaintenanceGate.js +265 -7
- package/dist/core/maintenance/MaintenanceGate.js.map +1 -1
- package/dist/core/plugins/PluginManager.d.ts +20 -1
- package/dist/core/plugins/PluginManager.d.ts.map +1 -1
- package/dist/core/plugins/PluginManager.js +231 -146
- package/dist/core/plugins/PluginManager.js.map +1 -1
- package/dist/core/plugins/types.d.ts +48 -31
- package/dist/core/plugins/types.d.ts.map +1 -1
- package/dist/database/DatabaseService.d.ts +1 -0
- package/dist/database/DatabaseService.d.ts.map +1 -1
- package/dist/database/DatabaseService.js +24 -6
- package/dist/database/DatabaseService.js.map +1 -1
- package/dist/database/drivers/DriverRegistry.d.ts +1 -0
- package/dist/database/drivers/DriverRegistry.d.ts.map +1 -1
- package/dist/database/drivers/DriverRegistry.js +29 -0
- package/dist/database/drivers/DriverRegistry.js.map +1 -1
- package/dist/database/drivers/IDatabaseDriver.d.ts +1 -0
- package/dist/database/drivers/IDatabaseDriver.d.ts.map +1 -1
- package/dist/database/drivers/MssqlDriver.d.ts.map +1 -1
- package/dist/database/drivers/MssqlDriver.js +8 -2
- package/dist/database/drivers/MssqlDriver.js.map +1 -1
- package/dist/database/drivers/NodeSqliteDriver.d.ts.map +1 -1
- package/dist/database/drivers/NodeSqliteDriver.js +15 -1
- package/dist/database/drivers/NodeSqliteDriver.js.map +1 -1
- package/dist/database/migrations/SystemMigrations.d.ts.map +1 -1
- package/dist/database/migrations/SystemMigrations.js +62 -5
- package/dist/database/migrations/SystemMigrations.js.map +1 -1
- package/dist/flows/FlowEngine.js.map +1 -1
- package/dist/flows/FlowService.d.ts +7 -1
- package/dist/flows/FlowService.d.ts.map +1 -1
- package/dist/flows/FlowService.js +126 -12
- package/dist/flows/FlowService.js.map +1 -1
- package/dist/flows/FlowValidator.d.ts +1 -0
- package/dist/flows/FlowValidator.d.ts.map +1 -1
- package/dist/flows/FlowValidator.js +76 -1
- package/dist/flows/FlowValidator.js.map +1 -1
- package/dist/flows/types.d.ts +14 -2
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/functions/FunctionService.d.ts +5 -1
- package/dist/functions/FunctionService.d.ts.map +1 -1
- package/dist/functions/FunctionService.js +84 -33
- package/dist/functions/FunctionService.js.map +1 -1
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts.map +1 -1
- package/dist/functions/runtime/QuickJsWasmRuntime.js +19 -10
- package/dist/functions/runtime/QuickJsWasmRuntime.js.map +1 -1
- package/dist/functions/types.d.ts +16 -2
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/http/HttpServer.d.ts +3 -0
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +153 -6
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/controllers/ApiKeyController.d.ts +1 -0
- package/dist/http/controllers/ApiKeyController.d.ts.map +1 -1
- package/dist/http/controllers/ApiKeyController.js +47 -1
- package/dist/http/controllers/ApiKeyController.js.map +1 -1
- package/dist/http/controllers/AuthController.d.ts +12 -0
- package/dist/http/controllers/AuthController.d.ts.map +1 -1
- package/dist/http/controllers/AuthController.js +40 -2
- package/dist/http/controllers/AuthController.js.map +1 -1
- package/dist/http/controllers/FlowController.d.ts.map +1 -1
- package/dist/http/controllers/FlowController.js +45 -4
- package/dist/http/controllers/FlowController.js.map +1 -1
- package/dist/http/controllers/FunctionController.d.ts.map +1 -1
- package/dist/http/controllers/FunctionController.js +16 -2
- package/dist/http/controllers/FunctionController.js.map +1 -1
- package/dist/http/controllers/HealthController.js +2 -2
- package/dist/http/middleware/AppResolutionMiddleware.d.ts +1 -1
- package/dist/http/middleware/AppResolutionMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AppResolutionMiddleware.js +2 -3
- package/dist/http/middleware/AppResolutionMiddleware.js.map +1 -1
- package/dist/http/middleware/AuthMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AuthMiddleware.js +6 -3
- package/dist/http/middleware/AuthMiddleware.js.map +1 -1
- package/dist/http/middleware/ChaosMiddleware.js +6 -6
- package/dist/http/middleware/ChaosMiddleware.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/queue/QueueService.d.ts +9 -0
- package/dist/queue/QueueService.d.ts.map +1 -1
- package/dist/queue/QueueService.js +143 -60
- package/dist/queue/QueueService.js.map +1 -1
- package/dist/queue/drivers/SqliteQueueDriver.d.ts +3 -0
- package/dist/queue/drivers/SqliteQueueDriver.d.ts.map +1 -1
- package/dist/queue/drivers/SqliteQueueDriver.js +315 -255
- package/dist/queue/drivers/SqliteQueueDriver.js.map +1 -1
- package/dist/records/FtsService.d.ts +7 -3
- package/dist/records/FtsService.d.ts.map +1 -1
- package/dist/records/FtsService.js +69 -5
- package/dist/records/FtsService.js.map +1 -1
- package/dist/records/QueryFilterParser.d.ts.map +1 -1
- package/dist/records/QueryFilterParser.js +58 -20
- package/dist/records/QueryFilterParser.js.map +1 -1
- package/dist/records/RecordSanitizer.d.ts.map +1 -1
- package/dist/records/RecordSanitizer.js +32 -4
- package/dist/records/RecordSanitizer.js.map +1 -1
- package/dist/records/RecordService.d.ts +6 -0
- package/dist/records/RecordService.d.ts.map +1 -1
- package/dist/records/RecordService.js +95 -14
- package/dist/records/RecordService.js.map +1 -1
- package/dist/records/RecordValidator.d.ts +10 -0
- package/dist/records/RecordValidator.d.ts.map +1 -1
- package/dist/records/RecordValidator.js +110 -2
- package/dist/records/RecordValidator.js.map +1 -1
- package/dist/records/fts/IFtsDriver.d.ts +7 -6
- package/dist/records/fts/IFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/MssqlFtsDriver.d.ts +5 -1
- package/dist/records/fts/MssqlFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/MssqlFtsDriver.js +35 -3
- package/dist/records/fts/MssqlFtsDriver.js.map +1 -1
- package/dist/records/fts/PostgresFtsDriver.d.ts +9 -2
- package/dist/records/fts/PostgresFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/PostgresFtsDriver.js +116 -11
- package/dist/records/fts/PostgresFtsDriver.js.map +1 -1
- package/dist/records/fts/SqliteFts5Driver.d.ts +7 -1
- package/dist/records/fts/SqliteFts5Driver.d.ts.map +1 -1
- package/dist/records/fts/SqliteFts5Driver.js +66 -6
- package/dist/records/fts/SqliteFts5Driver.js.map +1 -1
- package/dist/schema/OpenApiGenerator.d.ts.map +1 -1
- package/dist/schema/OpenApiGenerator.js +103 -3
- package/dist/schema/OpenApiGenerator.js.map +1 -1
- package/dist/schema/models/Field.d.ts +1 -0
- package/dist/schema/models/Field.d.ts.map +1 -1
- package/dist/templates/definitions/ecommerce.js +6 -6
- package/dist/templates/definitions/ecommerce.js.map +1 -1
- package/dist/webhooks/WebhookService.js +1 -1
- package/package.json +4 -3
|
@@ -1,673 +1,683 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// Global Command Palette (Ctrl + K / Cmd + K)
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
let commandPaletteActiveIndex = 0;
|
|
6
|
-
let commandPaletteFilteredItems = [];
|
|
7
|
-
|
|
8
|
-
function getAllCommandPaletteItems() {
|
|
9
|
-
const items = [];
|
|
10
|
-
|
|
11
|
-
// 1. Collections (User & System)
|
|
12
|
-
for (const col of state.collections || []) {
|
|
13
|
-
const isSys = typeof isSystemCollection === 'function' ? isSystemCollection(col) : Boolean(col.system || col.name?.startsWith('_'));
|
|
14
|
-
items.push({
|
|
15
|
-
id: `col-${col.name}`,
|
|
16
|
-
title: col.name,
|
|
17
|
-
description: `Jump to ${col.name} (${col.type}) collection`,
|
|
18
|
-
category: isSys ? 'System Tables' : 'Collections',
|
|
19
|
-
badge: col.type.toUpperCase(),
|
|
20
|
-
icon: isSys ? '⚙️' : '📁',
|
|
21
|
-
keywords: [col.name, col.name.toLowerCase(), 'collection', 'jump', col.type, isSys ? 'system' : 'user'],
|
|
22
|
-
action: () => {
|
|
23
|
-
if (typeof selectCollection === 'function') {
|
|
24
|
-
selectCollection(col.name);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// 2. Navigation items
|
|
31
|
-
items.push({
|
|
32
|
-
id: 'nav-home',
|
|
33
|
-
title: 'Overview',
|
|
34
|
-
description: 'Server status, collections list, quick stats',
|
|
35
|
-
category: 'Navigation',
|
|
36
|
-
badge: 'PAGE',
|
|
37
|
-
icon: '🏠',
|
|
38
|
-
keywords: ['home', 'dashboard', 'overview'],
|
|
39
|
-
action: () => selectNav('home')
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
items.push({
|
|
43
|
-
id: 'nav-collections',
|
|
44
|
-
title: 'Collections',
|
|
45
|
-
description: 'Dedicated database collections directory, tables & schema',
|
|
46
|
-
category: 'Navigation',
|
|
47
|
-
badge: 'PAGE',
|
|
48
|
-
icon: '📦',
|
|
49
|
-
keywords: ['collections', 'database', 'tables', 'schema', 'records'],
|
|
50
|
-
action: () => selectNav('collections')
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
items.push({
|
|
54
|
-
id: 'nav-plugins',
|
|
55
|
-
title: 'Plugins',
|
|
56
|
-
description: 'Dedicated official extensions & community plugins directory',
|
|
57
|
-
category: 'Navigation',
|
|
58
|
-
badge: 'PAGE',
|
|
59
|
-
icon: '🧩',
|
|
60
|
-
keywords: ['plugins', 'extensions', 'addons', 'stripe', 's3', 'resend', 'chat notifications', 'discord', 'slack', 'webhooks', 'algolia'],
|
|
61
|
-
action: () => selectNav('plugins')
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
items.push({
|
|
65
|
-
id: 'nav-webhooks',
|
|
66
|
-
title: 'Webhooks Manager',
|
|
67
|
-
description: 'Configure outbound webhooks, signatures and retry delivery logs',
|
|
68
|
-
category: 'Navigation',
|
|
69
|
-
badge: 'PAGE',
|
|
70
|
-
icon: '🔗',
|
|
71
|
-
keywords: ['webhooks', 'webhook', 'outbound', 'events', 'deliveries', 'retry'],
|
|
72
|
-
action: () => selectNav('webhooks')
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
items.push({
|
|
76
|
-
id: 'nav-functions',
|
|
77
|
-
title: 'Serverless Functions',
|
|
78
|
-
description: 'Sandboxed QuickJS serverless functions, API routes and event hooks',
|
|
79
|
-
category: 'Navigation',
|
|
80
|
-
badge: 'PAGE',
|
|
81
|
-
icon: '⚡',
|
|
82
|
-
keywords: ['functions', 'serverless', 'lambda', 'quickjs', 'wasm', 'sandbox', 'api', 'hooks', 'code'],
|
|
83
|
-
action: () => selectNav('functions')
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
items.push({
|
|
87
|
-
id: 'nav-flows',
|
|
88
|
-
title: 'Functions Flow',
|
|
89
|
-
description: 'Visual state machine orchestrator and pipeline designer',
|
|
90
|
-
category: 'Navigation',
|
|
91
|
-
badge: 'PAGE',
|
|
92
|
-
icon: '🔀',
|
|
93
|
-
keywords: ['flows', 'flow', 'pipeline', 'workflow', 'orchestrator', 'state machine', 'designer'],
|
|
94
|
-
action: () => selectNav('flows')
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
id: 'nav-queues',
|
|
98
|
-
title: 'Queues Manager',
|
|
99
|
-
description: 'Configure message queues, serverless function workers, DLQs and inspect messages',
|
|
100
|
-
category: 'Navigation',
|
|
101
|
-
badge: 'PAGE',
|
|
102
|
-
icon: '📬',
|
|
103
|
-
keywords: ['queues', 'queue', 'jobs', 'messages', 'dlq', 'dead letter', 'worker', 'background', 'concurrency'],
|
|
104
|
-
action: () => selectNav('queues')
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: 'nav-
|
|
108
|
-
title: '
|
|
109
|
-
description: '
|
|
110
|
-
category: 'Navigation',
|
|
111
|
-
badge: 'PAGE',
|
|
112
|
-
icon: '
|
|
113
|
-
keywords: ['
|
|
114
|
-
action: () => selectNav('
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
</
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
e.
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
1
|
+
// ==========================================
|
|
2
|
+
// Global Command Palette (Ctrl + K / Cmd + K)
|
|
3
|
+
// ==========================================
|
|
4
|
+
|
|
5
|
+
let commandPaletteActiveIndex = 0;
|
|
6
|
+
let commandPaletteFilteredItems = [];
|
|
7
|
+
|
|
8
|
+
function getAllCommandPaletteItems() {
|
|
9
|
+
const items = [];
|
|
10
|
+
|
|
11
|
+
// 1. Collections (User & System)
|
|
12
|
+
for (const col of state.collections || []) {
|
|
13
|
+
const isSys = typeof isSystemCollection === 'function' ? isSystemCollection(col) : Boolean(col.system || col.name?.startsWith('_'));
|
|
14
|
+
items.push({
|
|
15
|
+
id: `col-${col.name}`,
|
|
16
|
+
title: col.name,
|
|
17
|
+
description: `Jump to ${col.name} (${col.type}) collection`,
|
|
18
|
+
category: isSys ? 'System Tables' : 'Collections',
|
|
19
|
+
badge: col.type.toUpperCase(),
|
|
20
|
+
icon: isSys ? '⚙️' : '📁',
|
|
21
|
+
keywords: [col.name, col.name.toLowerCase(), 'collection', 'jump', col.type, isSys ? 'system' : 'user'],
|
|
22
|
+
action: () => {
|
|
23
|
+
if (typeof selectCollection === 'function') {
|
|
24
|
+
selectCollection(col.name);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 2. Navigation items
|
|
31
|
+
items.push({
|
|
32
|
+
id: 'nav-home',
|
|
33
|
+
title: 'Overview',
|
|
34
|
+
description: 'Server status, collections list, quick stats',
|
|
35
|
+
category: 'Navigation',
|
|
36
|
+
badge: 'PAGE',
|
|
37
|
+
icon: '🏠',
|
|
38
|
+
keywords: ['home', 'dashboard', 'overview'],
|
|
39
|
+
action: () => selectNav('home')
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
items.push({
|
|
43
|
+
id: 'nav-collections',
|
|
44
|
+
title: 'Collections',
|
|
45
|
+
description: 'Dedicated database collections directory, tables & schema',
|
|
46
|
+
category: 'Navigation',
|
|
47
|
+
badge: 'PAGE',
|
|
48
|
+
icon: '📦',
|
|
49
|
+
keywords: ['collections', 'database', 'tables', 'schema', 'records'],
|
|
50
|
+
action: () => selectNav('collections')
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
items.push({
|
|
54
|
+
id: 'nav-plugins',
|
|
55
|
+
title: 'Plugins',
|
|
56
|
+
description: 'Dedicated official extensions & community plugins directory',
|
|
57
|
+
category: 'Navigation',
|
|
58
|
+
badge: 'PAGE',
|
|
59
|
+
icon: '🧩',
|
|
60
|
+
keywords: ['plugins', 'extensions', 'addons', 'stripe', 's3', 'resend', 'chat notifications', 'discord', 'slack', 'webhooks', 'algolia'],
|
|
61
|
+
action: () => selectNav('plugins')
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
items.push({
|
|
65
|
+
id: 'nav-webhooks',
|
|
66
|
+
title: 'Webhooks Manager',
|
|
67
|
+
description: 'Configure outbound webhooks, signatures and retry delivery logs',
|
|
68
|
+
category: 'Navigation',
|
|
69
|
+
badge: 'PAGE',
|
|
70
|
+
icon: '🔗',
|
|
71
|
+
keywords: ['webhooks', 'webhook', 'outbound', 'events', 'deliveries', 'retry'],
|
|
72
|
+
action: () => selectNav('webhooks')
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
items.push({
|
|
76
|
+
id: 'nav-functions',
|
|
77
|
+
title: 'Serverless Functions',
|
|
78
|
+
description: 'Sandboxed QuickJS serverless functions, API routes and event hooks',
|
|
79
|
+
category: 'Navigation',
|
|
80
|
+
badge: 'PAGE',
|
|
81
|
+
icon: '⚡',
|
|
82
|
+
keywords: ['functions', 'serverless', 'lambda', 'quickjs', 'wasm', 'sandbox', 'api', 'hooks', 'code'],
|
|
83
|
+
action: () => selectNav('functions')
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
items.push({
|
|
87
|
+
id: 'nav-flows',
|
|
88
|
+
title: 'Functions Flow',
|
|
89
|
+
description: 'Visual state machine orchestrator and pipeline designer',
|
|
90
|
+
category: 'Navigation',
|
|
91
|
+
badge: 'PAGE',
|
|
92
|
+
icon: '🔀',
|
|
93
|
+
keywords: ['flows', 'flow', 'pipeline', 'workflow', 'orchestrator', 'state machine', 'designer'],
|
|
94
|
+
action: () => selectNav('flows')
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'nav-queues',
|
|
98
|
+
title: 'Queues Manager',
|
|
99
|
+
description: 'Configure message queues, serverless function workers, DLQs and inspect messages',
|
|
100
|
+
category: 'Navigation',
|
|
101
|
+
badge: 'PAGE',
|
|
102
|
+
icon: '📬',
|
|
103
|
+
keywords: ['queues', 'queue', 'jobs', 'messages', 'dlq', 'dead letter', 'worker', 'background', 'concurrency'],
|
|
104
|
+
action: () => selectNav('queues')
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 'nav-api-keys',
|
|
108
|
+
title: 'API Keys',
|
|
109
|
+
description: 'Create scoped machine-to-machine API keys across Collections, Functions, Flows and Queues',
|
|
110
|
+
category: 'Navigation',
|
|
111
|
+
badge: 'PAGE',
|
|
112
|
+
icon: '🔑',
|
|
113
|
+
keywords: ['api', 'keys', 'tokens', 'm2m', 'scopes', 'permissions', 'auth'],
|
|
114
|
+
action: () => selectNav('api-keys')
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'nav-analytics',
|
|
118
|
+
title: 'Analytics',
|
|
119
|
+
description: 'Realtime telemetry, latency and request throughput',
|
|
120
|
+
category: 'Navigation',
|
|
121
|
+
badge: 'PAGE',
|
|
122
|
+
icon: '📊',
|
|
123
|
+
keywords: ['metrics', 'analytics', 'telemetry', 'stats', 'traffic', 'latency', 'uptime', 'system'],
|
|
124
|
+
action: () => selectNav('analytics')
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
items.push({
|
|
128
|
+
id: 'nav-snapshots',
|
|
129
|
+
title: 'Snapshots',
|
|
130
|
+
description: 'Capture or restore application state snapshots',
|
|
131
|
+
|
|
132
|
+
category: 'Navigation',
|
|
133
|
+
badge: 'PAGE',
|
|
134
|
+
icon: '📸',
|
|
135
|
+
keywords: ['snapshots', 'snapshot', 'backup', 'restore', 'demo'],
|
|
136
|
+
action: () => selectNav('snapshots')
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
items.push({
|
|
140
|
+
id: 'nav-logs',
|
|
141
|
+
title: 'Audit Logs',
|
|
142
|
+
description: 'Live HTTP request activity, errors and slow queries',
|
|
143
|
+
category: 'Navigation',
|
|
144
|
+
badge: 'PAGE',
|
|
145
|
+
icon: '📝',
|
|
146
|
+
keywords: ['audit', 'logs', 'traffic', 'requests', 'errors', 'debug'],
|
|
147
|
+
action: () => selectNav('logs')
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
items.push({
|
|
151
|
+
id: "nav-database",
|
|
152
|
+
title: "Database Engine Settings",
|
|
153
|
+
description: "Configure and switch between SQLite, PostgreSQL, and SQL Server",
|
|
154
|
+
category: "System",
|
|
155
|
+
badge: "CONFIG",
|
|
156
|
+
icon: "🗄️",
|
|
157
|
+
keywords: ["database", "db", "postgres", "postgresql", "mssql", "sql server", "sqlite", "cluster", "migrate", "switch database"],
|
|
158
|
+
action: () => selectNav('database')
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// 2.5 Plugin navigation items
|
|
162
|
+
if (state.pluginNavItems && state.pluginNavItems.length > 0) {
|
|
163
|
+
for (const p of state.pluginNavItems) {
|
|
164
|
+
items.push({
|
|
165
|
+
id: 'plugin-' + p.id,
|
|
166
|
+
title: p.title,
|
|
167
|
+
description: (p.view && typeof p.view === 'object' && p.view.description) ? p.view.description : `Plugin extension: ${p.title}`,
|
|
168
|
+
category: 'Plugins',
|
|
169
|
+
badge: p.badge || 'PLUGIN',
|
|
170
|
+
icon: '🧩',
|
|
171
|
+
keywords: [p.id, p.title.toLowerCase(), 'plugin', 'extension'],
|
|
172
|
+
action: () => selectNav(p.id)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 2.8 Application Switcher & Actions
|
|
178
|
+
if (Array.isArray(state.apps) && state.apps.length > 0) {
|
|
179
|
+
for (const app of state.apps) {
|
|
180
|
+
items.push({
|
|
181
|
+
id: `app-switch-${app.slug}`,
|
|
182
|
+
title: `Switch App: ${app.name}`,
|
|
183
|
+
description: `Switch active application context to ${app.name} (${app.slug})`,
|
|
184
|
+
category: 'Applications',
|
|
185
|
+
badge: app.isDefault ? 'DEFAULT' : 'APP',
|
|
186
|
+
icon: app.isDefault ? '⚡' : '🚀',
|
|
187
|
+
keywords: ['app', 'application', 'switch', app.name.toLowerCase(), app.slug.toLowerCase()],
|
|
188
|
+
action: () => {
|
|
189
|
+
if (typeof selectApp === 'function') {
|
|
190
|
+
selectApp(app.slug);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
if (!app.isDefault && app.slug !== 'default') {
|
|
195
|
+
items.push({
|
|
196
|
+
id: `app-delete-${app.slug}`,
|
|
197
|
+
title: `Delete App: ${app.name}`,
|
|
198
|
+
description: `Permanently delete application ${app.name} (${app.slug}) and its database`,
|
|
199
|
+
category: 'Applications',
|
|
200
|
+
badge: 'DANGER',
|
|
201
|
+
icon: '🗑️',
|
|
202
|
+
keywords: ['delete app', 'remove app', 'delete application', 'drop app', app.slug.toLowerCase(), app.name.toLowerCase()],
|
|
203
|
+
action: () => {
|
|
204
|
+
if (typeof promptDeleteApp === 'function') {
|
|
205
|
+
promptDeleteApp(app.slug, app.name);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
items.push({
|
|
214
|
+
id: 'action-create-app',
|
|
215
|
+
title: 'Create New Application...',
|
|
216
|
+
description: 'Create a new isolated application scope with dedicated database and storage',
|
|
217
|
+
category: 'Applications',
|
|
218
|
+
badge: 'NEW',
|
|
219
|
+
icon: '➕',
|
|
220
|
+
keywords: ['create app', 'new app', 'new application', 'application', 'tenant'],
|
|
221
|
+
action: () => {
|
|
222
|
+
if (typeof openCreateAppModal === 'function') {
|
|
223
|
+
openCreateAppModal();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// 3. Actions: Export
|
|
229
|
+
if (state.activeCollection) {
|
|
230
|
+
items.push({
|
|
231
|
+
id: 'action-export-json',
|
|
232
|
+
title: `Export ${state.activeCollection.name} (JSON)`,
|
|
233
|
+
description: `Download ${state.activeCollection.name} records as JSON format`,
|
|
234
|
+
category: 'Actions',
|
|
235
|
+
badge: 'EXPORT',
|
|
236
|
+
icon: '📥',
|
|
237
|
+
keywords: ['export', 'export json', 'download', 'json', 'current collection', state.activeCollection.name],
|
|
238
|
+
action: () => {
|
|
239
|
+
if (typeof exportData === 'function') {
|
|
240
|
+
exportData('json');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
items.push({
|
|
245
|
+
id: 'action-export-csv',
|
|
246
|
+
title: `Export ${state.activeCollection.name} (CSV)`,
|
|
247
|
+
description: `Download ${state.activeCollection.name} records as CSV spreadsheet`,
|
|
248
|
+
category: 'Actions',
|
|
249
|
+
badge: 'EXPORT',
|
|
250
|
+
icon: '📄',
|
|
251
|
+
keywords: ['export', 'export csv', 'download', 'csv', 'current collection', state.activeCollection.name],
|
|
252
|
+
action: () => {
|
|
253
|
+
if (typeof exportData === 'function') {
|
|
254
|
+
exportData('csv');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
} else {
|
|
259
|
+
items.push({
|
|
260
|
+
id: 'action-export',
|
|
261
|
+
title: 'Export Collection Records',
|
|
262
|
+
description: 'Trigger data export (requires active collection)',
|
|
263
|
+
category: 'Actions',
|
|
264
|
+
badge: 'EXPORT',
|
|
265
|
+
icon: '📥',
|
|
266
|
+
keywords: ['export', 'download', 'json', 'csv'],
|
|
267
|
+
action: () => {
|
|
268
|
+
toast('Please select a collection first to export records', 'info');
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// 4. Actions: New Collection
|
|
274
|
+
items.push({
|
|
275
|
+
id: 'action-new-collection',
|
|
276
|
+
title: 'New Collection',
|
|
277
|
+
description: 'Create a new schema from scratch',
|
|
278
|
+
category: 'Actions',
|
|
279
|
+
badge: 'CREATE',
|
|
280
|
+
icon: '➕',
|
|
281
|
+
keywords: ['new', 'create', 'collection', 'add collection', 'new collection'],
|
|
282
|
+
action: () => {
|
|
283
|
+
if (typeof openNewCollectionModal === 'function') {
|
|
284
|
+
openNewCollectionModal();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
items.push({
|
|
290
|
+
id: 'action-new-webhook',
|
|
291
|
+
title: 'New Webhook',
|
|
292
|
+
description: 'Configure an outbound HTTP webhook on collection events',
|
|
293
|
+
category: 'Actions',
|
|
294
|
+
badge: 'CREATE',
|
|
295
|
+
icon: '⚡',
|
|
296
|
+
keywords: ['new webhook', 'create webhook', 'webhook', 'outbound', 'signature'],
|
|
297
|
+
action: () => {
|
|
298
|
+
selectNav('webhooks');
|
|
299
|
+
setTimeout(() => {
|
|
300
|
+
if (typeof openCreateWebhookModal === 'function') openCreateWebhookModal();
|
|
301
|
+
}, 50);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// 5. Actions: Starter Templates
|
|
306
|
+
items.push({
|
|
307
|
+
id: 'action-templates',
|
|
308
|
+
title: 'Starter Templates',
|
|
309
|
+
description: 'Pre-seeded recipes (E-Commerce, Blog, CRM)',
|
|
310
|
+
category: 'Actions',
|
|
311
|
+
badge: 'RECIPE',
|
|
312
|
+
icon: '✨',
|
|
313
|
+
keywords: ['templates', 'starter templates', 'ecommerce', 'blog', 'crm', 'recipe'],
|
|
314
|
+
action: () => {
|
|
315
|
+
if (typeof openTemplatesModal === 'function') {
|
|
316
|
+
openTemplatesModal();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// 6. Actions: Import JSON
|
|
322
|
+
items.push({
|
|
323
|
+
id: 'action-import-json',
|
|
324
|
+
title: 'Import JSON Schema',
|
|
325
|
+
description: 'Generate database schema from JSON sample',
|
|
326
|
+
category: 'Actions',
|
|
327
|
+
badge: 'IMPORT',
|
|
328
|
+
icon: '📥',
|
|
329
|
+
keywords: ['import', 'json', 'schema', 'upload'],
|
|
330
|
+
action: () => {
|
|
331
|
+
if (typeof openImportJsonModal === 'function') {
|
|
332
|
+
openImportJsonModal();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// 7. Action: New Record (if collection active)
|
|
338
|
+
if (state.activeCollection) {
|
|
339
|
+
items.push({
|
|
340
|
+
id: 'action-new-record',
|
|
341
|
+
title: `Create Record in ${state.activeCollection.name}`,
|
|
342
|
+
description: `Insert a new row into ${state.activeCollection.name}`,
|
|
343
|
+
category: 'Actions',
|
|
344
|
+
badge: 'RECORD',
|
|
345
|
+
icon: '📝',
|
|
346
|
+
keywords: ['new record', 'create record', 'add record', 'insert', 'row'],
|
|
347
|
+
action: () => {
|
|
348
|
+
if (typeof openNewRecordModal === 'function') {
|
|
349
|
+
openNewRecordModal();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// 8. Action: OpenAPI Docs
|
|
356
|
+
items.push({
|
|
357
|
+
id: 'action-docs',
|
|
358
|
+
title: 'API Docs (OpenAPI)',
|
|
359
|
+
description: 'Interactive OpenAPI 3.0 Reference & testing sandbox',
|
|
360
|
+
category: 'Documentation',
|
|
361
|
+
badge: 'DOCS',
|
|
362
|
+
icon: '📖',
|
|
363
|
+
keywords: ['docs', 'openapi', 'swagger', 'api reference'],
|
|
364
|
+
action: () => {
|
|
365
|
+
if (typeof openDocsWithApp === 'function') {
|
|
366
|
+
openDocsWithApp();
|
|
367
|
+
} else {
|
|
368
|
+
const slug = (typeof getActiveAppSlug === 'function')
|
|
369
|
+
? getActiveAppSlug()
|
|
370
|
+
: (state?.activeApp?.slug || (typeof state?.activeApp === 'string' ? state.activeApp : 'default'));
|
|
371
|
+
const app = slug && slug !== 'default' ? `?app=${encodeURIComponent(slug)}` : '';
|
|
372
|
+
window.open(`/_/docs${app}`, '_blank');
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
// 9. Appearance & Theme
|
|
379
|
+
items.push({
|
|
380
|
+
id: 'theme-system',
|
|
381
|
+
title: 'Theme: System (Auto)',
|
|
382
|
+
description: 'Sync admin appearance with your operating system preference',
|
|
383
|
+
category: 'Appearance',
|
|
384
|
+
badge: 'THEME',
|
|
385
|
+
icon: '💻',
|
|
386
|
+
keywords: ['theme', 'appearance', 'system', 'auto', 'mode', 'color'],
|
|
387
|
+
action: () => {
|
|
388
|
+
if (typeof setTheme === 'function') setTheme('system');
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
items.push({
|
|
393
|
+
id: 'theme-light',
|
|
394
|
+
title: 'Theme: Light Mode',
|
|
395
|
+
description: 'Switch admin portal to clean light appearance',
|
|
396
|
+
category: 'Appearance',
|
|
397
|
+
badge: 'THEME',
|
|
398
|
+
icon: '☀️',
|
|
399
|
+
keywords: ['theme', 'appearance', 'light', 'white', 'day', 'mode', 'color'],
|
|
400
|
+
action: () => {
|
|
401
|
+
if (typeof setTheme === 'function') setTheme('light');
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
items.push({
|
|
406
|
+
id: 'theme-dark',
|
|
407
|
+
title: 'Theme: Dark Mode',
|
|
408
|
+
description: 'Switch admin portal to dark night appearance',
|
|
409
|
+
category: 'Appearance',
|
|
410
|
+
badge: 'THEME',
|
|
411
|
+
icon: '🌙',
|
|
412
|
+
keywords: ['theme', 'appearance', 'dark', 'black', 'night', 'mode', 'color'],
|
|
413
|
+
action: () => {
|
|
414
|
+
if (typeof setTheme === 'function') setTheme('dark');
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
return items;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function filterCommandPaletteItems(query) {
|
|
422
|
+
const all = getAllCommandPaletteItems();
|
|
423
|
+
const q = (query || '').trim().toLowerCase();
|
|
424
|
+
if (!q) {
|
|
425
|
+
return all;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const scored = [];
|
|
429
|
+
for (const item of all) {
|
|
430
|
+
let score = 0;
|
|
431
|
+
const titleLower = item.title.toLowerCase();
|
|
432
|
+
|
|
433
|
+
if (titleLower === q) {
|
|
434
|
+
score += 100;
|
|
435
|
+
} else if (titleLower.startsWith(q)) {
|
|
436
|
+
score += 70;
|
|
437
|
+
} else if (titleLower.includes(q)) {
|
|
438
|
+
score += 40;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
for (const kw of item.keywords || []) {
|
|
442
|
+
if (kw === q) {
|
|
443
|
+
score = Math.max(score, 90);
|
|
444
|
+
} else if (kw.startsWith(q)) {
|
|
445
|
+
score = Math.max(score, 60);
|
|
446
|
+
} else if (kw.includes(q)) {
|
|
447
|
+
score = Math.max(score, 30);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (item.description && item.description.toLowerCase().includes(q)) {
|
|
452
|
+
score = Math.max(score, 20);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (score > 0) {
|
|
456
|
+
scored.push({ item, score });
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
scored.sort((a, b) => b.score - a.score);
|
|
461
|
+
return scored.map(s => s.item);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function renderCommandPaletteResultsHtml(items, selectedIndex) {
|
|
465
|
+
if (!items || items.length === 0) {
|
|
466
|
+
return `<div class="command-palette-empty">No matching commands or collections found</div>`;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return items.map((item, idx) => `
|
|
470
|
+
<div
|
|
471
|
+
class="command-palette-item ${idx === selectedIndex ? 'selected' : ''}"
|
|
472
|
+
id="command-palette-item-${idx}"
|
|
473
|
+
onclick="executeCommandPaletteItem(${idx})"
|
|
474
|
+
onmouseenter="setCommandPaletteActiveIndex(${idx})"
|
|
475
|
+
data-index="${idx}"
|
|
476
|
+
role="option"
|
|
477
|
+
aria-selected="${idx === selectedIndex ? 'true' : 'false'}"
|
|
478
|
+
tabindex="-1"
|
|
479
|
+
>
|
|
480
|
+
<div class="command-palette-item-left">
|
|
481
|
+
<div class="command-palette-item-icon" aria-hidden="true">${item.icon || '▶'}</div>
|
|
482
|
+
<div class="command-palette-item-text">
|
|
483
|
+
<div class="command-palette-item-title">${escapeHtml(item.title)}</div>
|
|
484
|
+
<div class="command-palette-item-desc">${escapeHtml(item.description)}</div>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
<div class="command-palette-item-badge">${escapeHtml(item.badge || item.category)}</div>
|
|
488
|
+
</div>
|
|
489
|
+
`).join('');
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function openCommandPalette() {
|
|
493
|
+
commandPaletteActiveIndex = 0;
|
|
494
|
+
commandPaletteFilteredItems = filterCommandPaletteItems('');
|
|
495
|
+
const root = document.getElementById('command-palette-root');
|
|
496
|
+
if (!root) return;
|
|
497
|
+
|
|
498
|
+
root.innerHTML = `
|
|
499
|
+
<div class="command-palette-backdrop" id="command-palette-backdrop" onclick="handleCommandPaletteBackdrop(event)" onkeydown="if(event.key==='Escape'){event.preventDefault();event.stopPropagation();closeCommandPalette();}">
|
|
500
|
+
<div class="command-palette-modal" role="dialog" aria-modal="true" aria-label="Command Palette">
|
|
501
|
+
<div class="command-palette-header">
|
|
502
|
+
<svg class="command-palette-search-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
503
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
504
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
505
|
+
</svg>
|
|
506
|
+
<input
|
|
507
|
+
type="text"
|
|
508
|
+
id="command-palette-input"
|
|
509
|
+
class="command-palette-input"
|
|
510
|
+
placeholder="Type a command or jump to... (e.g. users, metrics, export, new)"
|
|
511
|
+
autocomplete="off"
|
|
512
|
+
spellcheck="false"
|
|
513
|
+
role="combobox"
|
|
514
|
+
aria-autocomplete="list"
|
|
515
|
+
aria-expanded="${commandPaletteFilteredItems.length > 0 ? 'true' : 'false'}"
|
|
516
|
+
aria-haspopup="listbox"
|
|
517
|
+
aria-controls="command-palette-results"
|
|
518
|
+
${commandPaletteFilteredItems.length > 0 ? 'aria-activedescendant="command-palette-item-0"' : ''}
|
|
519
|
+
oninput="handleCommandPaletteInput(this.value)"
|
|
520
|
+
onkeydown="handleCommandPaletteKeyDown(event)"
|
|
521
|
+
/>
|
|
522
|
+
<span class="command-palette-esc-badge" onclick="closeCommandPalette()" role="button" aria-label="Close command palette">ESC</span>
|
|
523
|
+
</div>
|
|
524
|
+
<div class="command-palette-results" id="command-palette-results" role="listbox" aria-label="Commands and collections">
|
|
525
|
+
${renderCommandPaletteResultsHtml(commandPaletteFilteredItems, 0)}
|
|
526
|
+
</div>
|
|
527
|
+
<div class="command-palette-footer">
|
|
528
|
+
<div class="command-palette-footer-shortcuts">
|
|
529
|
+
<span><kbd class="palette-kbd">↑</kbd><kbd class="palette-kbd">↓</kbd> navigate</span>
|
|
530
|
+
<span><kbd class="palette-kbd">↵</kbd> select</span>
|
|
531
|
+
<span><kbd class="palette-kbd">esc</kbd> close</span>
|
|
532
|
+
</div>
|
|
533
|
+
<div style="font-size:10px; opacity:0.7;">NodeStack Quick Jump</div>
|
|
534
|
+
</div>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
537
|
+
`;
|
|
538
|
+
|
|
539
|
+
setTimeout(() => {
|
|
540
|
+
const input = document.getElementById('command-palette-input');
|
|
541
|
+
if (input) input.focus();
|
|
542
|
+
}, 20);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function closeCommandPalette() {
|
|
546
|
+
const root = document.getElementById('command-palette-root');
|
|
547
|
+
if (root) root.innerHTML = '';
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function handleCommandPaletteBackdrop(e) {
|
|
551
|
+
if (e.target && e.target.id === 'command-palette-backdrop') {
|
|
552
|
+
closeCommandPalette();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function toggleCommandPalette() {
|
|
557
|
+
const root = document.getElementById('command-palette-root');
|
|
558
|
+
if (root && root.innerHTML.trim().length > 0) {
|
|
559
|
+
closeCommandPalette();
|
|
560
|
+
} else {
|
|
561
|
+
openCommandPalette();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function handleCommandPaletteInput(val) {
|
|
566
|
+
commandPaletteActiveIndex = 0;
|
|
567
|
+
commandPaletteFilteredItems = filterCommandPaletteItems(val);
|
|
568
|
+
const container = document.getElementById('command-palette-results');
|
|
569
|
+
const input = document.getElementById('command-palette-input');
|
|
570
|
+
|
|
571
|
+
if (container) {
|
|
572
|
+
container.innerHTML = renderCommandPaletteResultsHtml(commandPaletteFilteredItems, 0);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (input) {
|
|
576
|
+
if (commandPaletteFilteredItems.length > 0) {
|
|
577
|
+
input.setAttribute('aria-expanded', 'true');
|
|
578
|
+
input.setAttribute('aria-activedescendant', 'command-palette-item-0');
|
|
579
|
+
} else {
|
|
580
|
+
input.setAttribute('aria-expanded', 'false');
|
|
581
|
+
input.removeAttribute('aria-activedescendant');
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function handleCommandPaletteKeyDown(e) {
|
|
587
|
+
if (e.key === 'ArrowDown') {
|
|
588
|
+
e.preventDefault();
|
|
589
|
+
if (commandPaletteFilteredItems.length > 0) {
|
|
590
|
+
commandPaletteActiveIndex = (commandPaletteActiveIndex + 1) % commandPaletteFilteredItems.length;
|
|
591
|
+
updateCommandPaletteActiveItem();
|
|
592
|
+
}
|
|
593
|
+
} else if (e.key === 'ArrowUp') {
|
|
594
|
+
e.preventDefault();
|
|
595
|
+
if (commandPaletteFilteredItems.length > 0) {
|
|
596
|
+
commandPaletteActiveIndex = (commandPaletteActiveIndex - 1 + commandPaletteFilteredItems.length) % commandPaletteFilteredItems.length;
|
|
597
|
+
updateCommandPaletteActiveItem();
|
|
598
|
+
}
|
|
599
|
+
} else if (e.key === 'Enter') {
|
|
600
|
+
e.preventDefault();
|
|
601
|
+
executeCommandPaletteItem(commandPaletteActiveIndex);
|
|
602
|
+
} else if (e.key === 'Escape') {
|
|
603
|
+
e.preventDefault();
|
|
604
|
+
e.stopPropagation();
|
|
605
|
+
closeCommandPalette();
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function updateCommandPaletteActiveItem() {
|
|
610
|
+
const input = document.getElementById('command-palette-input');
|
|
611
|
+
const items = document.querySelectorAll('.command-palette-item');
|
|
612
|
+
let activeId = null;
|
|
613
|
+
|
|
614
|
+
items.forEach((el, idx) => {
|
|
615
|
+
if (idx === commandPaletteActiveIndex) {
|
|
616
|
+
el.classList.add('selected');
|
|
617
|
+
el.setAttribute('aria-selected', 'true');
|
|
618
|
+
activeId = el.id;
|
|
619
|
+
if (typeof el.scrollIntoView === 'function') {
|
|
620
|
+
el.scrollIntoView({ block: 'nearest' });
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
el.classList.remove('selected');
|
|
624
|
+
el.setAttribute('aria-selected', 'false');
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
if (input) {
|
|
629
|
+
if (activeId) {
|
|
630
|
+
input.setAttribute('aria-activedescendant', activeId);
|
|
631
|
+
} else {
|
|
632
|
+
input.removeAttribute('aria-activedescendant');
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function setCommandPaletteActiveIndex(idx) {
|
|
638
|
+
commandPaletteActiveIndex = idx;
|
|
639
|
+
const input = document.getElementById('command-palette-input');
|
|
640
|
+
const items = document.querySelectorAll('.command-palette-item');
|
|
641
|
+
let activeId = null;
|
|
642
|
+
|
|
643
|
+
items.forEach((el, i) => {
|
|
644
|
+
if (i === idx) {
|
|
645
|
+
el.classList.add('selected');
|
|
646
|
+
el.setAttribute('aria-selected', 'true');
|
|
647
|
+
activeId = el.id;
|
|
648
|
+
} else {
|
|
649
|
+
el.classList.remove('selected');
|
|
650
|
+
el.setAttribute('aria-selected', 'false');
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
if (input) {
|
|
655
|
+
if (activeId) {
|
|
656
|
+
input.setAttribute('aria-activedescendant', activeId);
|
|
657
|
+
} else {
|
|
658
|
+
input.removeAttribute('aria-activedescendant');
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function executeCommandPaletteItem(index) {
|
|
664
|
+
const item = commandPaletteFilteredItems[index];
|
|
665
|
+
if (!item) return;
|
|
666
|
+
closeCommandPalette();
|
|
667
|
+
if (typeof item.action === 'function') {
|
|
668
|
+
item.action();
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Expose helpers on window for browser event handlers & tests
|
|
673
|
+
if (typeof window !== 'undefined') {
|
|
674
|
+
window.openCommandPalette = openCommandPalette;
|
|
675
|
+
window.closeCommandPalette = closeCommandPalette;
|
|
676
|
+
window.toggleCommandPalette = toggleCommandPalette;
|
|
677
|
+
window.getAllCommandPaletteItems = getAllCommandPaletteItems;
|
|
678
|
+
window.filterCommandPaletteItems = filterCommandPaletteItems;
|
|
679
|
+
window.executeCommandPaletteItem = executeCommandPaletteItem;
|
|
680
|
+
window.handleCommandPaletteInput = handleCommandPaletteInput;
|
|
681
|
+
window.handleCommandPaletteKeyDown = handleCommandPaletteKeyDown;
|
|
682
|
+
window.setCommandPaletteActiveIndex = setCommandPaletteActiveIndex;
|
|
683
|
+
}
|