@sonicjs-cms/core 2.8.3 → 2.10.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 (87) hide show
  1. package/dist/{app-DnQ26Lho.d.cts → app-Ozl9agJG.d.cts} +1 -1
  2. package/dist/{app-DnQ26Lho.d.ts → app-Ozl9agJG.d.ts} +1 -1
  3. package/dist/{chunk-YFJJU26H.js → chunk-27AOVQTR.js} +10 -2
  4. package/dist/chunk-27AOVQTR.js.map +1 -0
  5. package/dist/{chunk-Y3VMEGY2.js → chunk-4TTMQQC7.js} +4 -4
  6. package/dist/{chunk-Y3VMEGY2.js.map → chunk-4TTMQQC7.js.map} +1 -1
  7. package/dist/{chunk-VNLR35GO.cjs → chunk-64APW3DW.cjs} +339 -2
  8. package/dist/chunk-64APW3DW.cjs.map +1 -0
  9. package/dist/{chunk-GTFMI24U.js → chunk-6O3RJV3C.js} +2 -2
  10. package/dist/{chunk-GTFMI24U.js.map → chunk-6O3RJV3C.js.map} +1 -1
  11. package/dist/{chunk-G44QUVNM.js → chunk-7JMMLHPQ.js} +337 -4
  12. package/dist/chunk-7JMMLHPQ.js.map +1 -0
  13. package/dist/chunk-CJYFSKH7.js +54 -54
  14. package/dist/chunk-CJYFSKH7.js.map +1 -1
  15. package/dist/{chunk-JDIM5AG7.cjs → chunk-EKPLKUZT.cjs} +11 -5
  16. package/dist/chunk-EKPLKUZT.cjs.map +1 -0
  17. package/dist/{chunk-MPT5PA6U.cjs → chunk-IIBRG5S5.cjs} +10 -2
  18. package/dist/chunk-IIBRG5S5.cjs.map +1 -0
  19. package/dist/{chunk-K4Q4SFJJ.cjs → chunk-IT2TC4ZD.cjs} +7 -7
  20. package/dist/{chunk-K4Q4SFJJ.cjs.map → chunk-IT2TC4ZD.cjs.map} +1 -1
  21. package/dist/{chunk-5XAI2XUF.js → chunk-IZWNIUJI.js} +11 -5
  22. package/dist/chunk-IZWNIUJI.js.map +1 -0
  23. package/dist/{chunk-CH5UHZVM.js → chunk-JTNUM7JE.js} +1218 -442
  24. package/dist/chunk-JTNUM7JE.js.map +1 -0
  25. package/dist/chunk-MNFY6DWY.cjs +54 -54
  26. package/dist/chunk-MNFY6DWY.cjs.map +1 -1
  27. package/dist/{chunk-R4WR3VTN.cjs → chunk-RCA6R6VE.cjs} +1329 -553
  28. package/dist/chunk-RCA6R6VE.cjs.map +1 -0
  29. package/dist/{chunk-HXHVU5GM.cjs → chunk-ZMVWMJ3S.cjs} +2 -2
  30. package/dist/{chunk-HXHVU5GM.cjs.map → chunk-ZMVWMJ3S.cjs.map} +1 -1
  31. package/dist/{collection-config-i8EaAF7z.d.cts → collection-config-B4PG-AaF.d.cts} +4 -2
  32. package/dist/{collection-config-i8EaAF7z.d.ts → collection-config-B4PG-AaF.d.ts} +4 -2
  33. package/dist/{filter-bar.template-Daw8ZDoq.d.cts → filter-bar.template-DlVYMk-T.d.cts} +1 -1
  34. package/dist/{filter-bar.template-Daw8ZDoq.d.ts → filter-bar.template-DlVYMk-T.d.ts} +1 -1
  35. package/dist/index.cjs +142 -141
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +8 -8
  38. package/dist/index.d.ts +8 -8
  39. package/dist/index.js +11 -10
  40. package/dist/index.js.map +1 -1
  41. package/dist/middleware.cjs +29 -29
  42. package/dist/middleware.d.cts +1 -1
  43. package/dist/middleware.d.ts +1 -1
  44. package/dist/middleware.js +3 -3
  45. package/dist/migrations-N2C2VPJU.js +4 -0
  46. package/dist/{migrations-KHWFJ2HN.js.map → migrations-N2C2VPJU.js.map} +1 -1
  47. package/dist/migrations-ONIAY6GK.cjs +13 -0
  48. package/dist/{migrations-7X4RPH7O.cjs.map → migrations-ONIAY6GK.cjs.map} +1 -1
  49. package/dist/{plugin-zvZpaiP5.d.cts → plugin-0Xogrln-.d.cts} +1 -1
  50. package/dist/{plugin-zvZpaiP5.d.ts → plugin-0Xogrln-.d.ts} +1 -1
  51. package/dist/{plugin-bootstrap-CJozpgmI.d.cts → plugin-bootstrap-WmpvYM5w.d.ts} +2 -2
  52. package/dist/{plugin-bootstrap-DU5VmuHZ.d.ts → plugin-bootstrap-fpG98Otb.d.cts} +2 -2
  53. package/dist/{plugin-manager-Baa6xXqB.d.ts → plugin-manager-Clf2gXwj.d.ts} +2 -2
  54. package/dist/{plugin-manager-vBal9Zip.d.cts → plugin-manager-GcIeb226.d.cts} +2 -2
  55. package/dist/plugins.d.cts +2 -2
  56. package/dist/plugins.d.ts +2 -2
  57. package/dist/routes.cjs +29 -29
  58. package/dist/routes.d.cts +1 -1
  59. package/dist/routes.d.ts +1 -1
  60. package/dist/routes.js +6 -6
  61. package/dist/services.cjs +44 -28
  62. package/dist/services.d.cts +29 -4
  63. package/dist/services.d.ts +29 -4
  64. package/dist/services.js +3 -3
  65. package/dist/{telemetry-UiD1i9GS.d.cts → telemetry-B9vIV4wh.d.cts} +1 -1
  66. package/dist/{telemetry-UiD1i9GS.d.ts → telemetry-B9vIV4wh.d.ts} +1 -1
  67. package/dist/templates.d.cts +1 -1
  68. package/dist/templates.d.ts +1 -1
  69. package/dist/types.d.cts +3 -3
  70. package/dist/types.d.ts +3 -3
  71. package/dist/utils.cjs +11 -11
  72. package/dist/utils.d.cts +3 -3
  73. package/dist/utils.d.ts +3 -3
  74. package/dist/utils.js +1 -1
  75. package/dist/{version-C_CXrN_T.d.cts → version-ChpccWQ1.d.cts} +1 -1
  76. package/dist/{version-C_CXrN_T.d.ts → version-ChpccWQ1.d.ts} +1 -1
  77. package/package.json +9 -3
  78. package/dist/chunk-5XAI2XUF.js.map +0 -1
  79. package/dist/chunk-CH5UHZVM.js.map +0 -1
  80. package/dist/chunk-G44QUVNM.js.map +0 -1
  81. package/dist/chunk-JDIM5AG7.cjs.map +0 -1
  82. package/dist/chunk-MPT5PA6U.cjs.map +0 -1
  83. package/dist/chunk-R4WR3VTN.cjs.map +0 -1
  84. package/dist/chunk-VNLR35GO.cjs.map +0 -1
  85. package/dist/chunk-YFJJU26H.js.map +0 -1
  86. package/dist/migrations-7X4RPH7O.cjs +0 -13
  87. package/dist/migrations-KHWFJ2HN.js +0 -4
@@ -6,6 +6,7 @@ var sqliteCore = require('drizzle-orm/sqlite-core');
6
6
  var v4 = require('zod/v4');
7
7
  var drizzleOrm = require('drizzle-orm');
8
8
  var d1 = require('drizzle-orm/d1');
9
+ var dev = require('hono/dev');
9
10
 
10
11
  // src/db/schema.ts
11
12
  var schema_exports = {};
@@ -1455,17 +1456,352 @@ function createInstallationIdentity(projectName) {
1455
1456
  }
1456
1457
  return identity;
1457
1458
  }
1459
+ var appInstance = null;
1460
+ function setAppInstance(app) {
1461
+ appInstance = app;
1462
+ }
1463
+ function getAppInstance() {
1464
+ return appInstance;
1465
+ }
1466
+ var CATEGORY_INFO = {
1467
+ "Auth": {
1468
+ title: "Authentication",
1469
+ description: "User authentication and authorization endpoints",
1470
+ icon: "🔐"
1471
+ },
1472
+ "Content": {
1473
+ title: "Content Management",
1474
+ description: "Content creation, retrieval, and management",
1475
+ icon: "📝"
1476
+ },
1477
+ "Media": {
1478
+ title: "Media Management",
1479
+ description: "File upload, storage, and media operations",
1480
+ icon: "🖼️"
1481
+ },
1482
+ "Admin": {
1483
+ title: "Admin Interface",
1484
+ description: "Administrative panel and management features",
1485
+ icon: "⚙️"
1486
+ },
1487
+ "System": {
1488
+ title: "System",
1489
+ description: "Health checks and system information",
1490
+ icon: "🔧"
1491
+ },
1492
+ "Search": {
1493
+ title: "Search",
1494
+ description: "AI-powered search, full-text search, and analytics",
1495
+ icon: "🔍"
1496
+ },
1497
+ "API Keys": {
1498
+ title: "API Keys",
1499
+ description: "API key management and authentication",
1500
+ icon: "🔑"
1501
+ },
1502
+ "Workflow": {
1503
+ title: "Workflow",
1504
+ description: "Content workflow and approval processes",
1505
+ icon: "🔄"
1506
+ },
1507
+ "Cache": {
1508
+ title: "Cache",
1509
+ description: "Cache management and invalidation",
1510
+ icon: "⚡"
1511
+ },
1512
+ "Forms": {
1513
+ title: "Forms",
1514
+ description: "Form submissions and management",
1515
+ icon: "📋"
1516
+ },
1517
+ "Files": {
1518
+ title: "Files",
1519
+ description: "File serving from R2 storage",
1520
+ icon: "📁"
1521
+ }
1522
+ };
1523
+ var ROUTE_METADATA = {
1524
+ // Auth endpoints
1525
+ "POST /auth/login": { description: "Authenticate user with email and password (returns JWT)", category: "Auth", authentication: false },
1526
+ "POST /auth/login/form": { description: "Form-based login (sets session cookie)", category: "Auth", authentication: false },
1527
+ "POST /auth/register": { description: "Register a new user account", category: "Auth", authentication: false },
1528
+ "POST /auth/logout": { description: "Log out the current user and invalidate session", category: "Auth", authentication: true },
1529
+ "GET /auth/me": { description: "Get current authenticated user information", category: "Auth", authentication: true },
1530
+ "POST /auth/refresh": { description: "Refresh authentication token", category: "Auth", authentication: true },
1531
+ "POST /auth/seed-admin": { description: "Create or reset the admin user account", category: "Auth", authentication: false },
1532
+ "POST /auth/magic-link/request": { description: "Request a magic link login email", category: "Auth", authentication: false },
1533
+ "GET /auth/magic-link/verify": { description: "Verify magic link token and authenticate", category: "Auth", authentication: false },
1534
+ "POST /auth/otp/request": { description: "Request a one-time password via email", category: "Auth", authentication: false },
1535
+ "POST /auth/otp/verify": { description: "Verify OTP code and authenticate", category: "Auth", authentication: false },
1536
+ // Content endpoints
1537
+ "GET /api/collections": { description: "List all available collections", category: "Content", authentication: false },
1538
+ "GET /api/collections/:collection/content": { description: "Get all content items from a specific collection", category: "Content", authentication: false },
1539
+ "GET /api/content/:id": { description: "Get a specific content item by ID", category: "Content", authentication: false },
1540
+ "POST /api/content": { description: "Create a new content item", category: "Content", authentication: true },
1541
+ "PUT /api/content/:id": { description: "Update an existing content item", category: "Content", authentication: true },
1542
+ "DELETE /api/content/:id": { description: "Delete a content item", category: "Content", authentication: true },
1543
+ "GET /api/content/:id/versions": { description: "Get version history for a content item", category: "Content", authentication: true },
1544
+ "POST /api/content/:id/restore/:versionId": { description: "Restore a content item to a previous version", category: "Content", authentication: true },
1545
+ // Media endpoints
1546
+ "GET /api/media": { description: "List all media files with pagination", category: "Media", authentication: false },
1547
+ "GET /api/media/:id": { description: "Get a specific media file by ID", category: "Media", authentication: false },
1548
+ "POST /api/media/upload": { description: "Upload a new media file to R2 storage", category: "Media", authentication: true },
1549
+ "DELETE /api/media/:id": { description: "Delete a media file from storage", category: "Media", authentication: true },
1550
+ // Admin API endpoints
1551
+ "GET /admin/api/stats": { description: "Get dashboard statistics (collections, content, media, users)", category: "Admin", authentication: true },
1552
+ "GET /admin/api/storage": { description: "Get storage usage information", category: "Admin", authentication: true },
1553
+ "GET /admin/api/activity": { description: "Get recent activity logs", category: "Admin", authentication: true },
1554
+ "GET /admin/api/collections": { description: "List all collections with field counts", category: "Admin", authentication: true },
1555
+ "POST /admin/api/collections": { description: "Create a new collection", category: "Admin", authentication: true },
1556
+ "GET /admin/api/collections/:id": { description: "Get a specific collection with its fields", category: "Admin", authentication: true },
1557
+ "PATCH /admin/api/collections/:id": { description: "Update an existing collection", category: "Admin", authentication: true },
1558
+ "DELETE /admin/api/collections/:id": { description: "Delete a collection (must be empty)", category: "Admin", authentication: true },
1559
+ "GET /admin/api/collections/:id/fields": { description: "Get fields for a specific collection", category: "Admin", authentication: true },
1560
+ "POST /admin/api/collections/:id/fields": { description: "Add a field to a collection", category: "Admin", authentication: true },
1561
+ "PATCH /admin/api/collections/:id/fields/:fieldId": { description: "Update a collection field", category: "Admin", authentication: true },
1562
+ "DELETE /admin/api/collections/:id/fields/:fieldId": { description: "Remove a field from a collection", category: "Admin", authentication: true },
1563
+ "POST /admin/api/collections/:id/fields/reorder": { description: "Reorder fields in a collection", category: "Admin", authentication: true },
1564
+ "GET /admin/api/migrations/status": { description: "Get database migration status", category: "Admin", authentication: true },
1565
+ "POST /admin/api/migrations/run": { description: "Run pending database migrations", category: "Admin", authentication: true },
1566
+ "GET /admin/api/content": { description: "List content items with filtering and pagination", category: "Admin", authentication: true },
1567
+ "GET /admin/api/content/:id": { description: "Get a content item for admin editing", category: "Admin", authentication: true },
1568
+ "POST /admin/api/content": { description: "Create content via admin API", category: "Admin", authentication: true },
1569
+ "PUT /admin/api/content/:id": { description: "Update content via admin API", category: "Admin", authentication: true },
1570
+ "DELETE /admin/api/content/:id": { description: "Delete content via admin API", category: "Admin", authentication: true },
1571
+ "GET /admin/api/media": { description: "List media files for admin management", category: "Admin", authentication: true },
1572
+ "POST /admin/api/media/upload": { description: "Upload media via admin interface", category: "Admin", authentication: true },
1573
+ "DELETE /admin/api/media/:id": { description: "Delete media via admin interface", category: "Admin", authentication: true },
1574
+ "GET /admin/api/users": { description: "List all users", category: "Admin", authentication: true },
1575
+ "POST /admin/api/users": { description: "Create a new user", category: "Admin", authentication: true },
1576
+ "PUT /admin/api/users/:id": { description: "Update a user", category: "Admin", authentication: true },
1577
+ "DELETE /admin/api/users/:id": { description: "Delete a user", category: "Admin", authentication: true },
1578
+ "GET /admin/api/logs": { description: "Get application logs with filtering", category: "Admin", authentication: true },
1579
+ "GET /admin/api/plugins": { description: "List all registered plugins", category: "Admin", authentication: true },
1580
+ "POST /admin/api/plugins/:id/toggle": { description: "Enable or disable a plugin", category: "Admin", authentication: true },
1581
+ "GET /admin/api/settings": { description: "Get application settings", category: "Admin", authentication: true },
1582
+ "PUT /admin/api/settings": { description: "Update application settings", category: "Admin", authentication: true },
1583
+ "GET /admin/api/forms": { description: "List all forms", category: "Admin", authentication: true },
1584
+ "GET /admin/api/forms/:id": { description: "Get form details and submissions", category: "Admin", authentication: true },
1585
+ "POST /admin/api/forms": { description: "Create a new form", category: "Admin", authentication: true },
1586
+ "PUT /admin/api/forms/:id": { description: "Update a form", category: "Admin", authentication: true },
1587
+ "DELETE /admin/api/forms/:id": { description: "Delete a form", category: "Admin", authentication: true },
1588
+ "GET /admin/api/forms/:id/submissions": { description: "Get form submissions", category: "Admin", authentication: true },
1589
+ "DELETE /admin/api/forms/:id/submissions/:submissionId": { description: "Delete a form submission", category: "Admin", authentication: true },
1590
+ // Search endpoints
1591
+ "GET /api/search": { description: "Search content using AI, FTS5, keyword, or hybrid mode", category: "Search", authentication: false },
1592
+ "POST /api/search/click": { description: "Track a search result click for analytics", category: "Search", authentication: false },
1593
+ "GET /admin/plugins/ai-search/api/status": { description: "Get search plugin status and configuration", category: "Search", authentication: true },
1594
+ "POST /admin/plugins/ai-search/api/index": { description: "Trigger content indexing for search", category: "Search", authentication: true },
1595
+ "POST /admin/plugins/ai-search/api/index/reset": { description: "Reset the search index", category: "Search", authentication: true },
1596
+ "GET /admin/plugins/ai-search/api/analytics": { description: "Get search analytics and metrics", category: "Search", authentication: true },
1597
+ "GET /admin/plugins/ai-search/api/analytics/queries": { description: "Get top search queries", category: "Search", authentication: true },
1598
+ "GET /admin/plugins/ai-search/api/analytics/clicks": { description: "Get click-through analytics", category: "Search", authentication: true },
1599
+ "GET /admin/plugins/ai-search/api/fts5/status": { description: "Get FTS5 full-text search status", category: "Search", authentication: true },
1600
+ "POST /admin/plugins/ai-search/api/fts5/rebuild": { description: "Rebuild the FTS5 search index", category: "Search", authentication: true },
1601
+ "GET /admin/plugins/ai-search/api/facets": { description: "Get available search facets", category: "Search", authentication: true },
1602
+ "GET /admin/plugins/ai-search/api/experiments": { description: "List search A/B test experiments", category: "Search", authentication: true },
1603
+ "POST /admin/plugins/ai-search/api/experiments": { description: "Create a search A/B test experiment", category: "Search", authentication: true },
1604
+ "GET /admin/plugins/ai-search/api/experiments/:id": { description: "Get experiment details", category: "Search", authentication: true },
1605
+ "PUT /admin/plugins/ai-search/api/experiments/:id": { description: "Update an experiment", category: "Search", authentication: true },
1606
+ "DELETE /admin/plugins/ai-search/api/experiments/:id": { description: "Delete an experiment", category: "Search", authentication: true },
1607
+ "POST /admin/plugins/ai-search/api/experiments/:id/start": { description: "Start an experiment", category: "Search", authentication: true },
1608
+ "POST /admin/plugins/ai-search/api/experiments/:id/stop": { description: "Stop a running experiment", category: "Search", authentication: true },
1609
+ "GET /admin/plugins/ai-search/api/experiments/:id/results": { description: "Get experiment results and statistics", category: "Search", authentication: true },
1610
+ "GET /admin/plugins/ai-search/api/quality": { description: "Get search quality agent analysis", category: "Search", authentication: true },
1611
+ "POST /admin/plugins/ai-search/api/quality/run": { description: "Run search quality analysis", category: "Search", authentication: true },
1612
+ "GET /admin/plugins/ai-search/api/quality/recommendations": { description: "Get quality improvement recommendations", category: "Search", authentication: true },
1613
+ "POST /admin/plugins/ai-search/api/quality/recommendations/:id/apply": { description: "Apply a quality recommendation", category: "Search", authentication: true },
1614
+ "POST /admin/plugins/ai-search/api/quality/recommendations/:id/dismiss": { description: "Dismiss a quality recommendation", category: "Search", authentication: true },
1615
+ "GET /admin/plugins/ai-search/api/synonyms": { description: "List search synonyms", category: "Search", authentication: true },
1616
+ "POST /admin/plugins/ai-search/api/synonyms": { description: "Add a search synonym", category: "Search", authentication: true },
1617
+ "DELETE /admin/plugins/ai-search/api/synonyms/:id": { description: "Delete a search synonym", category: "Search", authentication: true },
1618
+ "GET /admin/plugins/ai-search/api/query-rules": { description: "List search query rules", category: "Search", authentication: true },
1619
+ "POST /admin/plugins/ai-search/api/query-rules": { description: "Create a query rule", category: "Search", authentication: true },
1620
+ "PUT /admin/plugins/ai-search/api/query-rules/:id": { description: "Update a query rule", category: "Search", authentication: true },
1621
+ "DELETE /admin/plugins/ai-search/api/query-rules/:id": { description: "Delete a query rule", category: "Search", authentication: true },
1622
+ "GET /admin/plugins/ai-search/api/settings": { description: "Get search plugin settings", category: "Search", authentication: true },
1623
+ "PUT /admin/plugins/ai-search/api/settings": { description: "Update search plugin settings", category: "Search", authentication: true },
1624
+ // API Key endpoints
1625
+ "GET /admin/api-keys/api/keys": { description: "List all API keys", category: "API Keys", authentication: true },
1626
+ "POST /admin/api-keys/api/keys": { description: "Create a new API key", category: "API Keys", authentication: true },
1627
+ "DELETE /admin/api-keys/api/keys/:id": { description: "Revoke an API key", category: "API Keys", authentication: true },
1628
+ "PUT /admin/api-keys/api/keys/:id": { description: "Update an API key", category: "API Keys", authentication: true },
1629
+ // Cache endpoints
1630
+ "GET /admin/cache/api/stats": { description: "Get cache statistics", category: "Cache", authentication: true },
1631
+ "POST /admin/cache/api/purge": { description: "Purge cache entries", category: "Cache", authentication: true },
1632
+ "GET /admin/cache/api/entries": { description: "List cache entries", category: "Cache", authentication: true },
1633
+ "DELETE /admin/cache/api/entries/:key": { description: "Delete a specific cache entry", category: "Cache", authentication: true },
1634
+ // Workflow endpoints
1635
+ "GET /workflow/status/:id": { description: "Get workflow status for a content item", category: "Workflow", authentication: true },
1636
+ "POST /workflow/submit/:id": { description: "Submit content for review", category: "Workflow", authentication: true },
1637
+ "POST /workflow/approve/:id": { description: "Approve content in review", category: "Workflow", authentication: true },
1638
+ "POST /workflow/reject/:id": { description: "Reject content in review", category: "Workflow", authentication: true },
1639
+ "POST /workflow/publish/:id": { description: "Publish approved content", category: "Workflow", authentication: true },
1640
+ "POST /workflow/unpublish/:id": { description: "Unpublish content", category: "Workflow", authentication: true },
1641
+ "GET /workflow/history/:id": { description: "Get workflow history for a content item", category: "Workflow", authentication: true },
1642
+ // Form endpoints (public)
1643
+ "POST /forms/:formId/submit": { description: "Submit a form (public endpoint)", category: "Forms", authentication: false },
1644
+ "GET /forms/:formId": { description: "Get form definition for rendering", category: "Forms", authentication: false },
1645
+ "POST /api/forms/:formId/submit": { description: "Submit a form via API", category: "Forms", authentication: false },
1646
+ "GET /api/forms/:formId": { description: "Get form definition via API", category: "Forms", authentication: false },
1647
+ // System endpoints
1648
+ "GET /health": { description: "Health check endpoint for monitoring", category: "System", authentication: false },
1649
+ "GET /api/health": { description: "API health check with schema information", category: "System", authentication: false },
1650
+ "GET /api": { description: "API root - returns API information and available endpoints", category: "System", authentication: false },
1651
+ "GET /api/system/info": { description: "Get system information and version", category: "System", authentication: false },
1652
+ "GET /api/system/schema": { description: "Get database schema information", category: "System", authentication: false },
1653
+ // File serving
1654
+ "GET /files/*": { description: "Serve files from R2 storage (public access)", category: "Files", authentication: false },
1655
+ // Database tools
1656
+ "POST /admin/database-tools/api/query": { description: "Execute a database query", category: "Admin", authentication: true },
1657
+ "GET /admin/database-tools/api/tables": { description: "List database tables", category: "Admin", authentication: true },
1658
+ "GET /admin/database-tools/api/tables/:name": { description: "Get table schema and sample data", category: "Admin", authentication: true },
1659
+ // Seed data
1660
+ "POST /admin/seed-data/api/generate": { description: "Generate seed data for development", category: "Admin", authentication: true },
1661
+ "GET /admin/seed-data/api/status": { description: "Get seed data generation status", category: "Admin", authentication: true },
1662
+ // Email plugin
1663
+ "POST /admin/plugins/email/api/send": { description: "Send an email", category: "Admin", authentication: true },
1664
+ "GET /admin/plugins/email/api/templates": { description: "List email templates", category: "Admin", authentication: true },
1665
+ "POST /admin/plugins/email/api/test": { description: "Send a test email", category: "Admin", authentication: true }
1666
+ };
1667
+ var INCLUDED_ROUTE_PATTERNS = [
1668
+ /^\/api\//,
1669
+ // All /api/* routes
1670
+ /^\/api$/,
1671
+ // API root
1672
+ /^\/auth\/(?!login$|register$)/,
1673
+ // Auth routes except GET login/register HTML pages
1674
+ /^\/auth\/login$/,
1675
+ // POST /auth/login (method filtered later)
1676
+ /^\/auth\/register$/,
1677
+ // POST /auth/register (method filtered later)
1678
+ /^\/admin\/api\//,
1679
+ // Admin API endpoints
1680
+ /^\/admin\/api-keys\/api\//,
1681
+ // API key management
1682
+ /^\/admin\/cache\/api\//,
1683
+ // Cache management API
1684
+ /^\/admin\/plugins\/.*\/api\//,
1685
+ // Plugin API endpoints
1686
+ /^\/admin\/database-tools\/api\//,
1687
+ // Database tools API
1688
+ /^\/admin\/seed-data\/api\//,
1689
+ // Seed data API
1690
+ /^\/workflow\//,
1691
+ // Workflow endpoints
1692
+ /^\/health$/,
1693
+ // Health check
1694
+ /^\/files\//,
1695
+ // File serving
1696
+ /^\/forms\//
1697
+ // Public form endpoints
1698
+ ];
1699
+ var EXCLUDED_ROUTES = /* @__PURE__ */ new Set([
1700
+ "GET /auth/login",
1701
+ "GET /auth/register",
1702
+ "GET /auth/login/form"
1703
+ ]);
1704
+ var cachedRouteList = null;
1705
+ function isIncludedRoute(method, path) {
1706
+ const key = `${method} ${path}`;
1707
+ if (EXCLUDED_ROUTES.has(key)) {
1708
+ return false;
1709
+ }
1710
+ return INCLUDED_ROUTE_PATTERNS.some((pattern) => pattern.test(path));
1711
+ }
1712
+ function inferCategory(path) {
1713
+ if (path.startsWith("/auth/")) return "Auth";
1714
+ if (path.startsWith("/api/search")) return "Search";
1715
+ if (path.startsWith("/api/media")) return "Media";
1716
+ if (path.startsWith("/api/system")) return "System";
1717
+ if (path.startsWith("/api/content") || path.startsWith("/api/collections")) return "Content";
1718
+ if (path.startsWith("/api/forms")) return "Forms";
1719
+ if (path.startsWith("/admin/api-keys")) return "API Keys";
1720
+ if (path.startsWith("/admin/cache")) return "Cache";
1721
+ if (path.startsWith("/admin/plugins/ai-search")) return "Search";
1722
+ if (path.startsWith("/admin/api")) return "Admin";
1723
+ if (path.startsWith("/admin/database-tools")) return "Admin";
1724
+ if (path.startsWith("/admin/seed-data")) return "Admin";
1725
+ if (path.startsWith("/admin/plugins/email")) return "Admin";
1726
+ if (path.startsWith("/workflow/")) return "Workflow";
1727
+ if (path.startsWith("/forms/")) return "Forms";
1728
+ if (path.startsWith("/files/")) return "Files";
1729
+ if (path === "/health" || path.startsWith("/api")) return "System";
1730
+ return "Other";
1731
+ }
1732
+ function inferAuth(path) {
1733
+ if (path === "/health" || path === "/api" || path === "/api/health") return false;
1734
+ if (path === "/api/system/info" || path === "/api/system/schema") return false;
1735
+ if (path.startsWith("/files/")) return false;
1736
+ if (path.startsWith("/forms/") || path.startsWith("/api/forms/")) return false;
1737
+ if (path.startsWith("/admin/")) return true;
1738
+ if (path.startsWith("/workflow/")) return true;
1739
+ return "unknown";
1740
+ }
1741
+ function buildRouteList(app) {
1742
+ if (cachedRouteList) return cachedRouteList;
1743
+ if (!app) return [];
1744
+ try {
1745
+ const routes = dev.inspectRoutes(app);
1746
+ const seen = /* @__PURE__ */ new Set();
1747
+ const result = [];
1748
+ for (const route of routes) {
1749
+ if (route.isMiddleware) continue;
1750
+ if (route.method === "ALL") continue;
1751
+ const key = `${route.method} ${route.path}`;
1752
+ if (seen.has(key)) continue;
1753
+ seen.add(key);
1754
+ if (!isIncludedRoute(route.method, route.path)) continue;
1755
+ const meta = ROUTE_METADATA[key];
1756
+ if (meta) {
1757
+ result.push({
1758
+ method: route.method,
1759
+ path: route.path,
1760
+ description: meta.description,
1761
+ authentication: meta.authentication,
1762
+ category: meta.category,
1763
+ documented: true
1764
+ });
1765
+ } else {
1766
+ result.push({
1767
+ method: route.method,
1768
+ path: route.path,
1769
+ description: "",
1770
+ authentication: inferAuth(route.path),
1771
+ category: inferCategory(route.path),
1772
+ documented: false
1773
+ });
1774
+ }
1775
+ }
1776
+ const methodOrder = { GET: 0, POST: 1, PUT: 2, PATCH: 3, DELETE: 4 };
1777
+ result.sort((a, b) => {
1778
+ const catCmp = a.category.localeCompare(b.category);
1779
+ if (catCmp !== 0) return catCmp;
1780
+ const methCmp = (methodOrder[a.method] ?? 5) - (methodOrder[b.method] ?? 5);
1781
+ if (methCmp !== 0) return methCmp;
1782
+ return a.path.localeCompare(b.path);
1783
+ });
1784
+ cachedRouteList = result;
1785
+ return result;
1786
+ } catch (error) {
1787
+ console.error("Failed to inspect routes:", error);
1788
+ return [];
1789
+ }
1790
+ }
1458
1791
 
1459
1792
  exports.CACHE_CONFIGS = CACHE_CONFIGS;
1793
+ exports.CATEGORY_INFO = CATEGORY_INFO;
1460
1794
  exports.CacheService = CacheService;
1461
1795
  exports.Logger = Logger;
1462
1796
  exports.SettingsService = SettingsService;
1463
1797
  exports.TelemetryService = TelemetryService;
1464
1798
  exports.apiTokens = apiTokens;
1799
+ exports.buildRouteList = buildRouteList;
1465
1800
  exports.collections = collections;
1466
1801
  exports.content = content;
1467
1802
  exports.contentVersions = contentVersions;
1468
1803
  exports.createInstallationIdentity = createInstallationIdentity;
1804
+ exports.getAppInstance = getAppInstance;
1469
1805
  exports.getCacheService = getCacheService;
1470
1806
  exports.getLogger = getLogger;
1471
1807
  exports.getTelemetryService = getTelemetryService;
@@ -1503,8 +1839,9 @@ exports.selectPluginSchema = selectPluginSchema;
1503
1839
  exports.selectSystemLogSchema = selectSystemLogSchema;
1504
1840
  exports.selectUserSchema = selectUserSchema;
1505
1841
  exports.selectWorkflowHistorySchema = selectWorkflowHistorySchema;
1842
+ exports.setAppInstance = setAppInstance;
1506
1843
  exports.systemLogs = systemLogs;
1507
1844
  exports.users = users;
1508
1845
  exports.workflowHistory = workflowHistory;
1509
- //# sourceMappingURL=chunk-VNLR35GO.cjs.map
1510
- //# sourceMappingURL=chunk-VNLR35GO.cjs.map
1846
+ //# sourceMappingURL=chunk-64APW3DW.cjs.map
1847
+ //# sourceMappingURL=chunk-64APW3DW.cjs.map