@nodestackapp/server 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +3 -1
  2. package/dist/NodeStack.d.ts +4 -0
  3. package/dist/NodeStack.d.ts.map +1 -1
  4. package/dist/NodeStack.js +44 -6
  5. package/dist/NodeStack.js.map +1 -1
  6. package/dist/admin/AdminUIBundler.d.ts.map +1 -1
  7. package/dist/admin/AdminUIBundler.js +1 -0
  8. package/dist/admin/AdminUIBundler.js.map +1 -1
  9. package/dist/admin/ui/css/main.css +6 -3
  10. package/dist/admin/ui/index.html +2345 -55
  11. package/dist/admin/ui/js/api.js +8 -0
  12. package/dist/admin/ui/js/app.js +38 -7
  13. package/dist/admin/ui/js/apps.js +18 -0
  14. package/dist/admin/ui/js/command-palette.js +10 -0
  15. package/dist/admin/ui/js/cron.js +1706 -0
  16. package/dist/admin/ui/js/database.js +10 -0
  17. package/dist/admin/ui/js/flows-designer.js +94 -0
  18. package/dist/admin/ui/js/flows.js +43 -4
  19. package/dist/admin/ui/js/functions-workbench.js +18 -0
  20. package/dist/admin/ui/js/functions.js +6 -3
  21. package/dist/admin/ui/js/snapshots.js +338 -0
  22. package/dist/admin/ui/js/views.js +1 -1
  23. package/dist/apps/AppManager.d.ts.map +1 -1
  24. package/dist/apps/AppManager.js +7 -3
  25. package/dist/apps/AppManager.js.map +1 -1
  26. package/dist/apps/AppScope.d.ts +2 -0
  27. package/dist/apps/AppScope.d.ts.map +1 -1
  28. package/dist/apps/AppScope.js +22 -2
  29. package/dist/apps/AppScope.js.map +1 -1
  30. package/dist/auth/ApiKeyService.d.ts +1 -0
  31. package/dist/auth/ApiKeyService.d.ts.map +1 -1
  32. package/dist/auth/ApiKeyService.js +16 -1
  33. package/dist/auth/ApiKeyService.js.map +1 -1
  34. package/dist/cli/cli.js +1 -1
  35. package/dist/core/container/Tokens.d.ts +2 -0
  36. package/dist/core/container/Tokens.d.ts.map +1 -1
  37. package/dist/core/container/Tokens.js +2 -0
  38. package/dist/core/container/Tokens.js.map +1 -1
  39. package/dist/cron/CronParser.d.ts +83 -0
  40. package/dist/cron/CronParser.d.ts.map +1 -0
  41. package/dist/cron/CronParser.js +538 -0
  42. package/dist/cron/CronParser.js.map +1 -0
  43. package/dist/cron/CronService.d.ts +74 -0
  44. package/dist/cron/CronService.d.ts.map +1 -0
  45. package/dist/cron/CronService.js +1254 -0
  46. package/dist/cron/CronService.js.map +1 -0
  47. package/dist/cron/types.d.ts +98 -0
  48. package/dist/cron/types.d.ts.map +1 -0
  49. package/dist/cron/types.js +3 -0
  50. package/dist/cron/types.js.map +1 -0
  51. package/dist/database/DatabaseService.d.ts +3 -1
  52. package/dist/database/DatabaseService.d.ts.map +1 -1
  53. package/dist/database/DatabaseService.js +10 -3
  54. package/dist/database/DatabaseService.js.map +1 -1
  55. package/dist/database/config/DatabaseConfigService.d.ts +1 -0
  56. package/dist/database/config/DatabaseConfigService.d.ts.map +1 -1
  57. package/dist/database/config/DatabaseConfigService.js +4 -2
  58. package/dist/database/config/DatabaseConfigService.js.map +1 -1
  59. package/dist/database/drivers/DriverPackageLoader.d.ts +11 -0
  60. package/dist/database/drivers/DriverPackageLoader.d.ts.map +1 -0
  61. package/dist/database/drivers/DriverPackageLoader.js +112 -0
  62. package/dist/database/drivers/DriverPackageLoader.js.map +1 -0
  63. package/dist/database/drivers/MssqlDriver.d.ts.map +1 -1
  64. package/dist/database/drivers/MssqlDriver.js +5 -6
  65. package/dist/database/drivers/MssqlDriver.js.map +1 -1
  66. package/dist/database/drivers/PostgresDriver.d.ts.map +1 -1
  67. package/dist/database/drivers/PostgresDriver.js +4 -5
  68. package/dist/database/drivers/PostgresDriver.js.map +1 -1
  69. package/dist/database/migration/DatabaseMigrationService.d.ts +1 -0
  70. package/dist/database/migration/DatabaseMigrationService.d.ts.map +1 -1
  71. package/dist/database/migration/DatabaseMigrationService.js +51 -0
  72. package/dist/database/migration/DatabaseMigrationService.js.map +1 -1
  73. package/dist/database/migrations/SystemMigrations.d.ts.map +1 -1
  74. package/dist/database/migrations/SystemMigrations.js +138 -0
  75. package/dist/database/migrations/SystemMigrations.js.map +1 -1
  76. package/dist/flows/FlowService.d.ts +3 -0
  77. package/dist/flows/FlowService.d.ts.map +1 -1
  78. package/dist/flows/FlowService.js +106 -7
  79. package/dist/flows/FlowService.js.map +1 -1
  80. package/dist/flows/FlowValidator.d.ts +1 -1
  81. package/dist/flows/FlowValidator.d.ts.map +1 -1
  82. package/dist/flows/FlowValidator.js +13 -3
  83. package/dist/flows/FlowValidator.js.map +1 -1
  84. package/dist/flows/types.d.ts +6 -1
  85. package/dist/flows/types.d.ts.map +1 -1
  86. package/dist/functions/FunctionService.d.ts +5 -1
  87. package/dist/functions/FunctionService.d.ts.map +1 -1
  88. package/dist/functions/FunctionService.js +190 -7
  89. package/dist/functions/FunctionService.js.map +1 -1
  90. package/dist/functions/runtime/QuickJsWasmRuntime.d.ts.map +1 -1
  91. package/dist/functions/runtime/QuickJsWasmRuntime.js +183 -180
  92. package/dist/functions/runtime/QuickJsWasmRuntime.js.map +1 -1
  93. package/dist/functions/types.d.ts +15 -0
  94. package/dist/functions/types.d.ts.map +1 -1
  95. package/dist/http/HttpServer.d.ts +4 -1
  96. package/dist/http/HttpServer.d.ts.map +1 -1
  97. package/dist/http/HttpServer.js +34 -2
  98. package/dist/http/HttpServer.js.map +1 -1
  99. package/dist/http/controllers/CronController.d.ts +63 -0
  100. package/dist/http/controllers/CronController.d.ts.map +1 -0
  101. package/dist/http/controllers/CronController.js +92 -0
  102. package/dist/http/controllers/CronController.js.map +1 -0
  103. package/dist/http/controllers/DatabaseController.d.ts.map +1 -1
  104. package/dist/http/controllers/DatabaseController.js +53 -0
  105. package/dist/http/controllers/DatabaseController.js.map +1 -1
  106. package/dist/http/controllers/HealthController.js +2 -2
  107. package/dist/schema/OpenApiGenerator.js +3 -3
  108. package/dist/snapshots/SnapshotService.d.ts.map +1 -1
  109. package/dist/snapshots/SnapshotService.js +21 -9
  110. package/dist/snapshots/SnapshotService.js.map +1 -1
  111. package/dist/snapshots/drivers/LogicalSnapshotDriver.d.ts.map +1 -1
  112. package/dist/snapshots/drivers/LogicalSnapshotDriver.js +2 -0
  113. package/dist/snapshots/drivers/LogicalSnapshotDriver.js.map +1 -1
  114. package/dist/webhooks/WebhookService.js +1 -1
  115. package/package.json +3 -2
@@ -147,6 +147,9 @@
147
147
  if (typeof loadFlows === 'function') {
148
148
  loadFlows();
149
149
  }
150
+ if (typeof loadCronStats === 'function') {
151
+ loadCronStats();
152
+ }
150
153
  loadCollections().then(() => {
151
154
  if (state.activeCollection) {
152
155
  if (state.collectionTab === 'records') loadRecords();
@@ -239,6 +242,9 @@
239
242
  if (typeof loadQueueStats === 'function') {
240
243
  loadQueueStats();
241
244
  }
245
+ if (typeof loadCronStats === 'function') {
246
+ loadCronStats();
247
+ }
242
248
  try {
243
249
  const pRes = await fetch('/api/plugins');
244
250
  if (pRes.ok) {
@@ -328,6 +334,7 @@
328
334
  if (typeof loadFunctionStats === 'function') loadFunctionStats();
329
335
  if (typeof loadFlows === 'function') loadFlows();
330
336
  if (typeof loadQueueStats === 'function') loadQueueStats();
337
+ if (typeof loadCronStats === 'function') loadCronStats();
331
338
  initRealtime();
332
339
  if (typeof parseUrlAndNavigate === 'function') {
333
340
  await parseUrlAndNavigate(false);
@@ -402,6 +409,7 @@
402
409
  if (typeof loadFunctionStats === 'function') loadFunctionStats();
403
410
  if (typeof loadFlows === 'function') loadFlows();
404
411
  if (typeof loadQueueStats === 'function') loadQueueStats();
412
+ if (typeof loadCronStats === 'function') loadCronStats();
405
413
  initRealtime();
406
414
  if (typeof parseUrlAndNavigate === 'function') {
407
415
  await parseUrlAndNavigate(false);
@@ -54,6 +54,9 @@ async function parseUrlAndNavigate(initial = false) {
54
54
  try {
55
55
  await loadCollections();
56
56
  } catch (_) {}
57
+ if (typeof loadCronStats === 'function') {
58
+ try { await loadCronStats(); } catch (_) {}
59
+ }
57
60
  }
58
61
  } else if (!initial && state.activeApp && state.activeApp.slug !== 'default') {
59
62
  // Navigating back/forward (popstate) to a route without ?app= query parameter; restore default app
@@ -68,6 +71,9 @@ async function parseUrlAndNavigate(initial = false) {
68
71
  try {
69
72
  await loadCollections();
70
73
  } catch (_) {}
74
+ if (typeof loadCronStats === 'function') {
75
+ try { await loadCronStats(); } catch (_) {}
76
+ }
71
77
  }
72
78
  }
73
79
 
@@ -175,6 +181,17 @@ async function parseUrlAndNavigate(initial = false) {
175
181
  } else {
176
182
  if (typeof switchQueuesTab === 'function') switchQueuesTab('queues', false);
177
183
  }
184
+ } else if (root === 'schedules') {
185
+ const isHistory = parts[1] === 'history' || parts[1] === 'runs';
186
+ if (typeof cronState !== 'undefined') {
187
+ cronState.subTab = isHistory ? 'history' : 'schedules';
188
+ }
189
+ await selectNav('schedules', false);
190
+ if (isHistory) {
191
+ if (typeof switchCronTab === 'function') switchCronTab('history', false);
192
+ } else {
193
+ if (typeof switchCronTab === 'function') switchCronTab('schedules', false);
194
+ }
178
195
  } else if (root === 'webhooks') {
179
196
  if (typeof webhooksState !== 'undefined') {
180
197
  webhooksState.subTab = (parts[1] === 'deliveries') ? 'deliveries' : 'webhooks';
@@ -236,6 +253,7 @@ function initRouter() {
236
253
  if (typeof closeApiKeyDrawer === 'function') closeApiKeyDrawer();
237
254
  if (typeof closeApiKeySecretModal === 'function') closeApiKeySecretModal();
238
255
  if (typeof closeCommandPalette === 'function') closeCommandPalette();
256
+ if (typeof closeScheduleDrawer === 'function') closeScheduleDrawer();
239
257
 
240
258
  await parseUrlAndNavigate(false);
241
259
  });
@@ -243,7 +261,7 @@ function initRouter() {
243
261
 
244
262
 
245
263
  function showPageView(viewName) {
246
- const views = ['home', 'collections', 'plugins', 'webhooks', 'functions', 'flows', 'queues', 'api-keys', 'analytics', 'snapshots', 'database', 'logs'];
264
+ const views = ['home', 'collections', 'plugins', 'webhooks', 'functions', 'flows', 'queues', 'schedules', 'api-keys', 'analytics', 'snapshots', 'database', 'logs'];
247
265
  for (const v of views) {
248
266
  const el = document.getElementById('page-view-' + v);
249
267
  if (el) {
@@ -257,7 +275,7 @@ function showPageView(viewName) {
257
275
  }
258
276
 
259
277
  function clearSidebarNavActive() {
260
- const navIds = ['nav-home', 'nav-collections', 'nav-plugins', 'nav-webhooks', 'nav-functions', 'nav-flows', 'nav-queues', 'nav-api-keys', 'nav-analytics', 'nav-snapshots', 'nav-database', 'nav-logs'];
278
+ const navIds = ['nav-home', 'nav-collections', 'nav-plugins', 'nav-webhooks', 'nav-functions', 'nav-flows', 'nav-queues', 'nav-schedules', 'nav-api-keys', 'nav-analytics', 'nav-snapshots', 'nav-database', 'nav-logs'];
261
279
  for (const id of navIds) {
262
280
  document.getElementById(id)?.classList.remove('active');
263
281
  }
@@ -296,6 +314,7 @@ async function selectNav(nav, pushState = true) {
296
314
  if (typeof closeApiKeyDrawer === 'function') closeApiKeyDrawer();
297
315
  if (typeof closeApiKeySecretModal === 'function') closeApiKeySecretModal();
298
316
  if (typeof closeCommandPalette === 'function') closeCommandPalette();
317
+ if (typeof closeScheduleDrawer === 'function') closeScheduleDrawer();
299
318
  }
300
319
 
301
320
  if (nav === 'home') {
@@ -414,6 +433,20 @@ async function selectNav(nav, pushState = true) {
414
433
  document.getElementById('view-title').style.display = 'none';
415
434
  document.getElementById('view-actions').innerHTML = '';
416
435
  if (typeof renderQueuesView === 'function') renderQueuesView();
436
+ } else if (nav === 'schedules') {
437
+ state.activeCollection = null;
438
+ if (pushState && typeof cronState !== 'undefined') {
439
+ cronState.subTab = 'schedules';
440
+ }
441
+ if (typeof renderCollectionsList === 'function') renderCollectionsList();
442
+ showPageView('schedules');
443
+ document.getElementById('collection-tabs').style.display = 'none';
444
+ document.getElementById('view-badge').style.display = 'none';
445
+ document.getElementById('nav-schedules')?.classList.add('active');
446
+ document.getElementById('view-title').textContent = 'Schedules Manager';
447
+ document.getElementById('view-title').style.display = 'none';
448
+ document.getElementById('view-actions').innerHTML = '';
449
+ if (typeof renderSchedulesView === 'function') renderSchedulesView();
417
450
  } else if (nav === 'api-keys') {
418
451
  state.activeCollection = null;
419
452
  if (typeof renderCollectionsList === 'function') renderCollectionsList();
@@ -448,11 +481,7 @@ async function selectNav(nav, pushState = true) {
448
481
  document.getElementById('view-badge').style.display = 'none';
449
482
  document.getElementById('nav-snapshots')?.classList.add('active');
450
483
  document.getElementById('view-title').textContent = 'Snapshots';
451
- document.getElementById('view-actions').innerHTML = `
452
- <button class="btn btn-primary btn-sm" onclick="openCreateSnapshotModal()" style="font-weight:600;">
453
- + Create Snapshot
454
- </button>
455
- `;
484
+ document.getElementById('view-actions').innerHTML = '';
456
485
  if (typeof renderSnapshotsView === 'function') renderSnapshotsView();
457
486
  } else if (nav === 'database') {
458
487
  state.activeCollection = null;
@@ -521,6 +550,8 @@ async function selectNav(nav, pushState = true) {
521
550
  updateUrl('/_/flows');
522
551
  } else if (nav === 'queues') {
523
552
  updateUrl('/_/queues');
553
+ } else if (nav === 'schedules') {
554
+ updateUrl('/_/schedules');
524
555
  } else if (nav === 'api-keys') {
525
556
  updateUrl('/_/api-keys');
526
557
  } else if (nav === 'analytics') {
@@ -157,6 +157,16 @@ async function selectApp(slugOrId) {
157
157
  apiKeysState.keys = [];
158
158
  if (typeof updateSidebarApiKeysBadge === 'function') updateSidebarApiKeysBadge([]);
159
159
  }
160
+ if (typeof cronState !== 'undefined') {
161
+ cronState.schedules = [];
162
+ cronState.runs = [];
163
+ cronState.functionsList = [];
164
+ cronState.flowsList = [];
165
+ cronState.stats = { totalSchedules: 0, activeSchedules: 0, successfulRuns: 0, failedRuns: 0, skippedRuns: 0, byTarget: { function: 0, flow: 0, snapshot: 0 } };
166
+ }
167
+ if (typeof closeScheduleDrawer === 'function') {
168
+ closeScheduleDrawer();
169
+ }
160
170
 
161
171
  try {
162
172
  if (typeof loadCollections === 'function') {
@@ -195,6 +205,12 @@ async function selectApp(slugOrId) {
195
205
  if (typeof loadApiKeys === 'function' && state.activeNav === 'api-keys') {
196
206
  await loadApiKeys();
197
207
  }
208
+ if (typeof loadCronStats === 'function') {
209
+ await loadCronStats();
210
+ }
211
+ if (typeof loadCronData === 'function' && state.activeNav === 'schedules') {
212
+ await loadCronData();
213
+ }
198
214
 
199
215
  // Refresh plugin catalog and nav items for the switched app
200
216
  try {
@@ -210,6 +226,8 @@ async function selectApp(slugOrId) {
210
226
 
211
227
  if (state.activeNav === 'home' && typeof renderHomeView === 'function') {
212
228
  renderHomeView();
229
+ } else if (state.activeNav === 'schedules' && typeof renderSchedulesView === 'function') {
230
+ renderSchedulesView();
213
231
  } else if (state.activeNav === 'snapshots' && typeof renderSnapshotsView === 'function') {
214
232
  renderSnapshotsView();
215
233
  } else if (state.activeNav === 'database' && typeof renderDatabaseView === 'function') {
@@ -103,6 +103,16 @@ function getAllCommandPaletteItems() {
103
103
  keywords: ['queues', 'queue', 'jobs', 'messages', 'dlq', 'dead letter', 'worker', 'background', 'concurrency'],
104
104
  action: () => selectNav('queues')
105
105
  },
106
+ {
107
+ id: 'nav-schedules',
108
+ title: 'Schedules Manager',
109
+ description: 'Configure cron schedules, timezone wall-clock triggers, and automated background jobs',
110
+ category: 'Navigation',
111
+ badge: 'PAGE',
112
+ icon: '⏱️',
113
+ keywords: ['schedules', 'cron', 'timer', 'scheduled', 'triggers', 'backup', 'automation', 'misfire'],
114
+ action: () => selectNav('schedules')
115
+ },
106
116
  {
107
117
  id: 'nav-api-keys',
108
118
  title: 'API Keys',