nuxt-observe 0.0.2

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 (435) hide show
  1. package/README.md +92 -0
  2. package/dist/module.d.mts +7 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +393 -0
  5. package/dist/runtime/app/assets/css/main.css +1 -0
  6. package/dist/runtime/app/components/ObserveActivityFeed.d.vue.ts +13 -0
  7. package/dist/runtime/app/components/ObserveActivityFeed.vue +77 -0
  8. package/dist/runtime/app/components/ObserveActivityFeed.vue.d.ts +13 -0
  9. package/dist/runtime/app/components/ObserveActivityTable.d.vue.ts +30 -0
  10. package/dist/runtime/app/components/ObserveActivityTable.vue +187 -0
  11. package/dist/runtime/app/components/ObserveActivityTable.vue.d.ts +30 -0
  12. package/dist/runtime/app/components/ObserveCan.d.vue.ts +27 -0
  13. package/dist/runtime/app/components/ObserveCan.vue +16 -0
  14. package/dist/runtime/app/components/ObserveCan.vue.d.ts +27 -0
  15. package/dist/runtime/app/components/ObserveErrorsTable.d.vue.ts +19 -0
  16. package/dist/runtime/app/components/ObserveErrorsTable.vue +105 -0
  17. package/dist/runtime/app/components/ObserveErrorsTable.vue.d.ts +19 -0
  18. package/dist/runtime/app/components/ObserveHealthHero.d.vue.ts +16 -0
  19. package/dist/runtime/app/components/ObserveHealthHero.vue +114 -0
  20. package/dist/runtime/app/components/ObserveHealthHero.vue.d.ts +16 -0
  21. package/dist/runtime/app/components/ObserveJourneySearch.d.vue.ts +13 -0
  22. package/dist/runtime/app/components/ObserveJourneySearch.vue +55 -0
  23. package/dist/runtime/app/components/ObserveJourneySearch.vue.d.ts +13 -0
  24. package/dist/runtime/app/components/ObserveJourneyTimeline.d.vue.ts +14 -0
  25. package/dist/runtime/app/components/ObserveJourneyTimeline.vue +119 -0
  26. package/dist/runtime/app/components/ObserveJourneyTimeline.vue.d.ts +14 -0
  27. package/dist/runtime/app/components/ObserveLogDetail.d.vue.ts +12 -0
  28. package/dist/runtime/app/components/ObserveLogDetail.vue +187 -0
  29. package/dist/runtime/app/components/ObserveLogDetail.vue.d.ts +12 -0
  30. package/dist/runtime/app/components/ObserveLogLevelBadge.d.vue.ts +10 -0
  31. package/dist/runtime/app/components/ObserveLogLevelBadge.vue +29 -0
  32. package/dist/runtime/app/components/ObserveLogLevelBadge.vue.d.ts +10 -0
  33. package/dist/runtime/app/components/ObserveLogsFilterBar.d.vue.ts +20 -0
  34. package/dist/runtime/app/components/ObserveLogsFilterBar.vue +134 -0
  35. package/dist/runtime/app/components/ObserveLogsFilterBar.vue.d.ts +20 -0
  36. package/dist/runtime/app/components/ObserveLogsTable.d.vue.ts +20 -0
  37. package/dist/runtime/app/components/ObserveLogsTable.vue +92 -0
  38. package/dist/runtime/app/components/ObserveLogsTable.vue.d.ts +20 -0
  39. package/dist/runtime/app/components/ObservePeriodSelector.d.vue.ts +3 -0
  40. package/dist/runtime/app/components/ObservePeriodSelector.vue +22 -0
  41. package/dist/runtime/app/components/ObservePeriodSelector.vue.d.ts +3 -0
  42. package/dist/runtime/app/components/ObserveRegressionAlert.d.vue.ts +12 -0
  43. package/dist/runtime/app/components/ObserveRegressionAlert.vue +27 -0
  44. package/dist/runtime/app/components/ObserveRegressionAlert.vue.d.ts +12 -0
  45. package/dist/runtime/app/components/ObserveServiceSwitcher.d.vue.ts +3 -0
  46. package/dist/runtime/app/components/ObserveServiceSwitcher.vue +49 -0
  47. package/dist/runtime/app/components/ObserveServiceSwitcher.vue.d.ts +3 -0
  48. package/dist/runtime/app/components/ObserveServicesTable.d.vue.ts +15 -0
  49. package/dist/runtime/app/components/ObserveServicesTable.vue +109 -0
  50. package/dist/runtime/app/components/ObserveServicesTable.vue.d.ts +15 -0
  51. package/dist/runtime/app/components/ObserveStatCard.d.vue.ts +14 -0
  52. package/dist/runtime/app/components/ObserveStatCard.vue +34 -0
  53. package/dist/runtime/app/components/ObserveStatCard.vue.d.ts +14 -0
  54. package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.d.vue.ts +15 -0
  55. package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.vue +170 -0
  56. package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.vue.d.ts +15 -0
  57. package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.d.vue.ts +17 -0
  58. package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.vue +208 -0
  59. package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.vue.d.ts +17 -0
  60. package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.d.vue.ts +14 -0
  61. package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.vue +208 -0
  62. package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.vue.d.ts +14 -0
  63. package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.d.vue.ts +14 -0
  64. package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.vue +190 -0
  65. package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.vue.d.ts +14 -0
  66. package/dist/runtime/app/components/charts/ObserveVolumeChart.client.d.vue.ts +16 -0
  67. package/dist/runtime/app/components/charts/ObserveVolumeChart.client.vue +199 -0
  68. package/dist/runtime/app/components/charts/ObserveVolumeChart.client.vue.d.ts +16 -0
  69. package/dist/runtime/app/components/charts/chart-core.d.ts +64 -0
  70. package/dist/runtime/app/components/charts/chart-core.js +136 -0
  71. package/dist/runtime/app/components/settings/ObserveApiKeyPanel.d.vue.ts +8 -0
  72. package/dist/runtime/app/components/settings/ObserveApiKeyPanel.vue +145 -0
  73. package/dist/runtime/app/components/settings/ObserveApiKeyPanel.vue.d.ts +8 -0
  74. package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.d.vue.ts +19 -0
  75. package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.vue +106 -0
  76. package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.vue.d.ts +19 -0
  77. package/dist/runtime/app/components/settings/ObserveAssignmentEditor.d.vue.ts +12 -0
  78. package/dist/runtime/app/components/settings/ObserveAssignmentEditor.vue +67 -0
  79. package/dist/runtime/app/components/settings/ObserveAssignmentEditor.vue.d.ts +12 -0
  80. package/dist/runtime/app/components/settings/ObserveGroupFormModal.d.vue.ts +18 -0
  81. package/dist/runtime/app/components/settings/ObserveGroupFormModal.vue +60 -0
  82. package/dist/runtime/app/components/settings/ObserveGroupFormModal.vue.d.ts +18 -0
  83. package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.d.vue.ts +20 -0
  84. package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.vue +21 -0
  85. package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.vue.d.ts +20 -0
  86. package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.d.vue.ts +15 -0
  87. package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.vue +63 -0
  88. package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.vue.d.ts +15 -0
  89. package/dist/runtime/app/components/settings/ObserveServiceEditForm.d.vue.ts +38 -0
  90. package/dist/runtime/app/components/settings/ObserveServiceEditForm.vue +216 -0
  91. package/dist/runtime/app/components/settings/ObserveServiceEditForm.vue.d.ts +38 -0
  92. package/dist/runtime/app/components/settings/ObserveServiceFormModal.d.vue.ts +37 -0
  93. package/dist/runtime/app/components/settings/ObserveServiceFormModal.vue +192 -0
  94. package/dist/runtime/app/components/settings/ObserveServiceFormModal.vue.d.ts +37 -0
  95. package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.d.vue.ts +11 -0
  96. package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.vue +18 -0
  97. package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.vue.d.ts +11 -0
  98. package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.d.vue.ts +19 -0
  99. package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.vue +132 -0
  100. package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.vue.d.ts +19 -0
  101. package/dist/runtime/app/components/settings/ObserveUserFormModal.d.vue.ts +27 -0
  102. package/dist/runtime/app/components/settings/ObserveUserFormModal.vue +108 -0
  103. package/dist/runtime/app/components/settings/ObserveUserFormModal.vue.d.ts +27 -0
  104. package/dist/runtime/app/components/settings/ObserveVersionTrackingField.d.vue.ts +17 -0
  105. package/dist/runtime/app/components/settings/ObserveVersionTrackingField.vue +20 -0
  106. package/dist/runtime/app/components/settings/ObserveVersionTrackingField.vue.d.ts +17 -0
  107. package/dist/runtime/app/composables/useObserveAbility.d.ts +15 -0
  108. package/dist/runtime/app/composables/useObserveAbility.js +20 -0
  109. package/dist/runtime/app/composables/useObserveActivity.d.ts +22 -0
  110. package/dist/runtime/app/composables/useObserveActivity.js +44 -0
  111. package/dist/runtime/app/composables/useObserveApiKeys.d.ts +15 -0
  112. package/dist/runtime/app/composables/useObserveApiKeys.js +19 -0
  113. package/dist/runtime/app/composables/useObserveAssignments.d.ts +19 -0
  114. package/dist/runtime/app/composables/useObserveAssignments.js +16 -0
  115. package/dist/runtime/app/composables/useObserveErrors.d.ts +33 -0
  116. package/dist/runtime/app/composables/useObserveErrors.js +85 -0
  117. package/dist/runtime/app/composables/useObserveGroups.d.ts +27 -0
  118. package/dist/runtime/app/composables/useObserveGroups.js +33 -0
  119. package/dist/runtime/app/composables/useObserveJourney.d.ts +19 -0
  120. package/dist/runtime/app/composables/useObserveJourney.js +19 -0
  121. package/dist/runtime/app/composables/useObserveLogFacets.d.ts +11 -0
  122. package/dist/runtime/app/composables/useObserveLogFacets.js +21 -0
  123. package/dist/runtime/app/composables/useObserveLogs.d.ts +28 -0
  124. package/dist/runtime/app/composables/useObserveLogs.js +100 -0
  125. package/dist/runtime/app/composables/useObserveMigrations.d.ts +17 -0
  126. package/dist/runtime/app/composables/useObserveMigrations.js +49 -0
  127. package/dist/runtime/app/composables/useObserveOverview.d.ts +14 -0
  128. package/dist/runtime/app/composables/useObserveOverview.js +23 -0
  129. package/dist/runtime/app/composables/useObservePeriod.d.ts +11 -0
  130. package/dist/runtime/app/composables/useObservePeriod.js +18 -0
  131. package/dist/runtime/app/composables/useObserveRollout.d.ts +20 -0
  132. package/dist/runtime/app/composables/useObserveRollout.js +55 -0
  133. package/dist/runtime/app/composables/useObserveScope.d.ts +13 -0
  134. package/dist/runtime/app/composables/useObserveScope.js +17 -0
  135. package/dist/runtime/app/composables/useObserveServices.d.ts +26 -0
  136. package/dist/runtime/app/composables/useObserveServices.js +33 -0
  137. package/dist/runtime/app/composables/useObserveStats.d.ts +14 -0
  138. package/dist/runtime/app/composables/useObserveStats.js +23 -0
  139. package/dist/runtime/app/composables/useObserveUsers.d.ts +29 -0
  140. package/dist/runtime/app/composables/useObserveUsers.js +33 -0
  141. package/dist/runtime/app/layouts/observe.d.vue.ts +13 -0
  142. package/dist/runtime/app/layouts/observe.vue +138 -0
  143. package/dist/runtime/app/layouts/observe.vue.d.ts +13 -0
  144. package/dist/runtime/app/middleware/observe-auth.global.d.ts +9 -0
  145. package/dist/runtime/app/middleware/observe-auth.global.js +8 -0
  146. package/dist/runtime/app/pages/activity.d.vue.ts +3 -0
  147. package/dist/runtime/app/pages/activity.vue +54 -0
  148. package/dist/runtime/app/pages/activity.vue.d.ts +3 -0
  149. package/dist/runtime/app/pages/error-detail.d.vue.ts +3 -0
  150. package/dist/runtime/app/pages/error-detail.vue +190 -0
  151. package/dist/runtime/app/pages/error-detail.vue.d.ts +3 -0
  152. package/dist/runtime/app/pages/errors.d.vue.ts +3 -0
  153. package/dist/runtime/app/pages/errors.vue +47 -0
  154. package/dist/runtime/app/pages/errors.vue.d.ts +3 -0
  155. package/dist/runtime/app/pages/journey.d.vue.ts +3 -0
  156. package/dist/runtime/app/pages/journey.vue +96 -0
  157. package/dist/runtime/app/pages/journey.vue.d.ts +3 -0
  158. package/dist/runtime/app/pages/log-detail.d.vue.ts +3 -0
  159. package/dist/runtime/app/pages/log-detail.vue +35 -0
  160. package/dist/runtime/app/pages/log-detail.vue.d.ts +3 -0
  161. package/dist/runtime/app/pages/login.d.vue.ts +3 -0
  162. package/dist/runtime/app/pages/login.vue +69 -0
  163. package/dist/runtime/app/pages/login.vue.d.ts +3 -0
  164. package/dist/runtime/app/pages/logs.d.vue.ts +3 -0
  165. package/dist/runtime/app/pages/logs.vue +36 -0
  166. package/dist/runtime/app/pages/logs.vue.d.ts +3 -0
  167. package/dist/runtime/app/pages/metrics.d.vue.ts +3 -0
  168. package/dist/runtime/app/pages/metrics.vue +68 -0
  169. package/dist/runtime/app/pages/metrics.vue.d.ts +3 -0
  170. package/dist/runtime/app/pages/overview.d.vue.ts +3 -0
  171. package/dist/runtime/app/pages/overview.vue +65 -0
  172. package/dist/runtime/app/pages/overview.vue.d.ts +3 -0
  173. package/dist/runtime/app/pages/rollout.d.vue.ts +3 -0
  174. package/dist/runtime/app/pages/rollout.vue +188 -0
  175. package/dist/runtime/app/pages/rollout.vue.d.ts +3 -0
  176. package/dist/runtime/app/pages/settings/group-detail.d.vue.ts +3 -0
  177. package/dist/runtime/app/pages/settings/group-detail.vue +149 -0
  178. package/dist/runtime/app/pages/settings/group-detail.vue.d.ts +3 -0
  179. package/dist/runtime/app/pages/settings/groups.d.vue.ts +3 -0
  180. package/dist/runtime/app/pages/settings/groups.vue +107 -0
  181. package/dist/runtime/app/pages/settings/groups.vue.d.ts +3 -0
  182. package/dist/runtime/app/pages/settings/index.d.vue.ts +3 -0
  183. package/dist/runtime/app/pages/settings/index.vue +47 -0
  184. package/dist/runtime/app/pages/settings/index.vue.d.ts +3 -0
  185. package/dist/runtime/app/pages/settings/migrations.d.vue.ts +3 -0
  186. package/dist/runtime/app/pages/settings/migrations.vue +275 -0
  187. package/dist/runtime/app/pages/settings/migrations.vue.d.ts +3 -0
  188. package/dist/runtime/app/pages/settings/service-detail.d.vue.ts +3 -0
  189. package/dist/runtime/app/pages/settings/service-detail.vue +133 -0
  190. package/dist/runtime/app/pages/settings/service-detail.vue.d.ts +3 -0
  191. package/dist/runtime/app/pages/settings/services.d.vue.ts +3 -0
  192. package/dist/runtime/app/pages/settings/services.vue +66 -0
  193. package/dist/runtime/app/pages/settings/services.vue.d.ts +3 -0
  194. package/dist/runtime/app/pages/settings/users/[id].d.vue.ts +3 -0
  195. package/dist/runtime/app/pages/settings/users/[id].vue +243 -0
  196. package/dist/runtime/app/pages/settings/users/[id].vue.d.ts +3 -0
  197. package/dist/runtime/app/pages/settings/users/index.d.vue.ts +3 -0
  198. package/dist/runtime/app/pages/settings/users/index.vue +129 -0
  199. package/dist/runtime/app/pages/settings/users/index.vue.d.ts +3 -0
  200. package/dist/runtime/options.d.ts +1 -0
  201. package/dist/runtime/options.js +1 -0
  202. package/dist/runtime/server/api/observe/activity.get.d.ts +3 -0
  203. package/dist/runtime/server/api/observe/activity.get.js +30 -0
  204. package/dist/runtime/server/api/observe/auth/login.post.d.ts +4 -0
  205. package/dist/runtime/server/api/observe/auth/login.post.js +13 -0
  206. package/dist/runtime/server/api/observe/auth/logout.post.d.ts +4 -0
  207. package/dist/runtime/server/api/observe/auth/logout.post.js +6 -0
  208. package/dist/runtime/server/api/observe/auth/me.get.d.ts +2 -0
  209. package/dist/runtime/server/api/observe/auth/me.get.js +3 -0
  210. package/dist/runtime/server/api/observe/errors/[fingerprint].get.d.ts +3 -0
  211. package/dist/runtime/server/api/observe/errors/[fingerprint].get.js +56 -0
  212. package/dist/runtime/server/api/observe/errors/index.get.d.ts +3 -0
  213. package/dist/runtime/server/api/observe/errors/index.get.js +41 -0
  214. package/dist/runtime/server/api/observe/facets.get.d.ts +8 -0
  215. package/dist/runtime/server/api/observe/facets.get.js +12 -0
  216. package/dist/runtime/server/api/observe/groups/[id]/assignments.put.d.ts +3 -0
  217. package/dist/runtime/server/api/observe/groups/[id]/assignments.put.js +12 -0
  218. package/dist/runtime/server/api/observe/groups/[id]/services.put.d.ts +5 -0
  219. package/dist/runtime/server/api/observe/groups/[id]/services.put.js +13 -0
  220. package/dist/runtime/server/api/observe/groups/[id].delete.d.ts +5 -0
  221. package/dist/runtime/server/api/observe/groups/[id].delete.js +11 -0
  222. package/dist/runtime/server/api/observe/groups/[id].get.d.ts +6 -0
  223. package/dist/runtime/server/api/observe/groups/[id].get.js +14 -0
  224. package/dist/runtime/server/api/observe/groups/[id].patch.d.ts +3 -0
  225. package/dist/runtime/server/api/observe/groups/[id].patch.js +12 -0
  226. package/dist/runtime/server/api/observe/groups/index.get.d.ts +3 -0
  227. package/dist/runtime/server/api/observe/groups/index.get.js +7 -0
  228. package/dist/runtime/server/api/observe/groups/index.post.d.ts +3 -0
  229. package/dist/runtime/server/api/observe/groups/index.post.js +11 -0
  230. package/dist/runtime/server/api/observe/health.get.d.ts +6 -0
  231. package/dist/runtime/server/api/observe/health.get.js +10 -0
  232. package/dist/runtime/server/api/observe/ingest/frogger.d.ts +5 -0
  233. package/dist/runtime/server/api/observe/ingest/frogger.js +42 -0
  234. package/dist/runtime/server/api/observe/ingest.d.ts +5 -0
  235. package/dist/runtime/server/api/observe/ingest.js +38 -0
  236. package/dist/runtime/server/api/observe/journey.get.d.ts +9 -0
  237. package/dist/runtime/server/api/observe/journey.get.js +31 -0
  238. package/dist/runtime/server/api/observe/logs/[id].get.d.ts +3 -0
  239. package/dist/runtime/server/api/observe/logs/[id].get.js +19 -0
  240. package/dist/runtime/server/api/observe/logs.get.d.ts +3 -0
  241. package/dist/runtime/server/api/observe/logs.get.js +54 -0
  242. package/dist/runtime/server/api/observe/migrations/index.get.d.ts +9 -0
  243. package/dist/runtime/server/api/observe/migrations/index.get.js +14 -0
  244. package/dist/runtime/server/api/observe/migrations/run.post.d.ts +13 -0
  245. package/dist/runtime/server/api/observe/migrations/run.post.js +35 -0
  246. package/dist/runtime/server/api/observe/overview.get.d.ts +3 -0
  247. package/dist/runtime/server/api/observe/overview.get.js +19 -0
  248. package/dist/runtime/server/api/observe/rollout/compare.get.d.ts +3 -0
  249. package/dist/runtime/server/api/observe/rollout/compare.get.js +24 -0
  250. package/dist/runtime/server/api/observe/rollout/regressions.get.d.ts +3 -0
  251. package/dist/runtime/server/api/observe/rollout/regressions.get.js +31 -0
  252. package/dist/runtime/server/api/observe/rollout/versions.get.d.ts +3 -0
  253. package/dist/runtime/server/api/observe/rollout/versions.get.js +20 -0
  254. package/dist/runtime/server/api/observe/services/[id]/assignments.put.d.ts +7 -0
  255. package/dist/runtime/server/api/observe/services/[id]/assignments.put.js +12 -0
  256. package/dist/runtime/server/api/observe/services/[id]/keys/[keyId]/rotate.post.d.ts +4 -0
  257. package/dist/runtime/server/api/observe/services/[id]/keys/[keyId]/rotate.post.js +14 -0
  258. package/dist/runtime/server/api/observe/services/[id]/keys/[keyId].delete.d.ts +4 -0
  259. package/dist/runtime/server/api/observe/services/[id]/keys/[keyId].delete.js +14 -0
  260. package/dist/runtime/server/api/observe/services/[id]/keys/index.get.d.ts +3 -0
  261. package/dist/runtime/server/api/observe/services/[id]/keys/index.get.js +10 -0
  262. package/dist/runtime/server/api/observe/services/[id]/keys/index.post.d.ts +3 -0
  263. package/dist/runtime/server/api/observe/services/[id]/keys/index.post.js +11 -0
  264. package/dist/runtime/server/api/observe/services/[id]/restore.post.d.ts +4 -0
  265. package/dist/runtime/server/api/observe/services/[id]/restore.post.js +11 -0
  266. package/dist/runtime/server/api/observe/services/[id].delete.d.ts +11 -0
  267. package/dist/runtime/server/api/observe/services/[id].delete.js +11 -0
  268. package/dist/runtime/server/api/observe/services/[id].get.d.ts +3 -0
  269. package/dist/runtime/server/api/observe/services/[id].get.js +12 -0
  270. package/dist/runtime/server/api/observe/services/[id].patch.d.ts +3 -0
  271. package/dist/runtime/server/api/observe/services/[id].patch.js +13 -0
  272. package/dist/runtime/server/api/observe/services/index.get.d.ts +3 -0
  273. package/dist/runtime/server/api/observe/services/index.get.js +7 -0
  274. package/dist/runtime/server/api/observe/services/index.post.d.ts +3 -0
  275. package/dist/runtime/server/api/observe/services/index.post.js +16 -0
  276. package/dist/runtime/server/api/observe/stats.get.d.ts +3 -0
  277. package/dist/runtime/server/api/observe/stats.get.js +28 -0
  278. package/dist/runtime/server/api/observe/users/[id]/assignments.put.d.ts +3 -0
  279. package/dist/runtime/server/api/observe/users/[id]/assignments.put.js +14 -0
  280. package/dist/runtime/server/api/observe/users/[id].delete.d.ts +4 -0
  281. package/dist/runtime/server/api/observe/users/[id].delete.js +15 -0
  282. package/dist/runtime/server/api/observe/users/[id].get.d.ts +3 -0
  283. package/dist/runtime/server/api/observe/users/[id].get.js +11 -0
  284. package/dist/runtime/server/api/observe/users/[id].patch.d.ts +3 -0
  285. package/dist/runtime/server/api/observe/users/[id].patch.js +25 -0
  286. package/dist/runtime/server/api/observe/users/index.get.d.ts +8 -0
  287. package/dist/runtime/server/api/observe/users/index.get.js +7 -0
  288. package/dist/runtime/server/api/observe/users/index.post.d.ts +3 -0
  289. package/dist/runtime/server/api/observe/users/index.post.js +29 -0
  290. package/dist/runtime/server/auth/authorization.d.ts +7 -0
  291. package/dist/runtime/server/auth/authorization.js +5 -0
  292. package/dist/runtime/server/auth/provider.d.ts +17 -0
  293. package/dist/runtime/server/auth/provider.js +44 -0
  294. package/dist/runtime/server/auth/providers/config-provider.d.ts +18 -0
  295. package/dist/runtime/server/auth/providers/config-provider.js +54 -0
  296. package/dist/runtime/server/auth/providers/db-provider.d.ts +16 -0
  297. package/dist/runtime/server/auth/providers/db-provider.js +42 -0
  298. package/dist/runtime/server/auth/providers/jwt-provider.d.ts +24 -0
  299. package/dist/runtime/server/auth/providers/jwt-provider.js +72 -0
  300. package/dist/runtime/server/migrations/0001-services-kind.d.ts +8 -0
  301. package/dist/runtime/server/migrations/0001-services-kind.js +14 -0
  302. package/dist/runtime/server/migrations/0002-services-type.d.ts +7 -0
  303. package/dist/runtime/server/migrations/0002-services-type.js +14 -0
  304. package/dist/runtime/server/migrations/0003-services-deleted-at.d.ts +6 -0
  305. package/dist/runtime/server/migrations/0003-services-deleted-at.js +14 -0
  306. package/dist/runtime/server/migrations/0004-logs-error-fingerprint.d.ts +11 -0
  307. package/dist/runtime/server/migrations/0004-logs-error-fingerprint.js +15 -0
  308. package/dist/runtime/server/migrations/0005-users-columns.d.ts +9 -0
  309. package/dist/runtime/server/migrations/0005-users-columns.js +25 -0
  310. package/dist/runtime/server/migrations/index.d.ts +13 -0
  311. package/dist/runtime/server/migrations/index.js +13 -0
  312. package/dist/runtime/server/migrations/types.d.ts +15 -0
  313. package/dist/runtime/server/migrations/types.js +0 -0
  314. package/dist/runtime/server/plugins/observe-migrate.server.d.ts +2 -0
  315. package/dist/runtime/server/plugins/observe-migrate.server.js +18 -0
  316. package/dist/runtime/server/tasks/backfill-fingerprints.d.ts +11 -0
  317. package/dist/runtime/server/tasks/backfill-fingerprints.js +41 -0
  318. package/dist/runtime/server/tasks/purge.d.ts +5 -0
  319. package/dist/runtime/server/tasks/purge.js +12 -0
  320. package/dist/runtime/server/tsconfig.json +3 -0
  321. package/dist/runtime/server/utils/activity-query.d.ts +28 -0
  322. package/dist/runtime/server/utils/activity-query.js +70 -0
  323. package/dist/runtime/server/utils/api-keys.d.ts +48 -0
  324. package/dist/runtime/server/utils/api-keys.js +67 -0
  325. package/dist/runtime/server/utils/authz.d.ts +50 -0
  326. package/dist/runtime/server/utils/authz.js +60 -0
  327. package/dist/runtime/server/utils/db/users.d.ts +91 -0
  328. package/dist/runtime/server/utils/db/users.js +128 -0
  329. package/dist/runtime/server/utils/db.d.ts +10 -0
  330. package/dist/runtime/server/utils/db.js +5 -0
  331. package/dist/runtime/server/utils/frogger-adapter.d.ts +40 -0
  332. package/dist/runtime/server/utils/frogger-adapter.js +97 -0
  333. package/dist/runtime/server/utils/groups.d.ts +35 -0
  334. package/dist/runtime/server/utils/groups.js +59 -0
  335. package/dist/runtime/server/utils/ingest-cors.d.ts +23 -0
  336. package/dist/runtime/server/utils/ingest-cors.js +27 -0
  337. package/dist/runtime/server/utils/journey.d.ts +20 -0
  338. package/dist/runtime/server/utils/journey.js +44 -0
  339. package/dist/runtime/server/utils/logs.d.ts +50 -0
  340. package/dist/runtime/server/utils/logs.js +154 -0
  341. package/dist/runtime/server/utils/loop-guard.d.ts +11 -0
  342. package/dist/runtime/server/utils/loop-guard.js +11 -0
  343. package/dist/runtime/server/utils/migrate.d.ts +21 -0
  344. package/dist/runtime/server/utils/migrate.js +144 -0
  345. package/dist/runtime/server/utils/migration-runner.d.ts +42 -0
  346. package/dist/runtime/server/utils/migration-runner.js +129 -0
  347. package/dist/runtime/server/utils/observe-errors.d.ts +58 -0
  348. package/dist/runtime/server/utils/observe-errors.js +206 -0
  349. package/dist/runtime/server/utils/overview.d.ts +20 -0
  350. package/dist/runtime/server/utils/overview.js +119 -0
  351. package/dist/runtime/server/utils/provisioning.d.ts +62 -0
  352. package/dist/runtime/server/utils/provisioning.js +299 -0
  353. package/dist/runtime/server/utils/rate-limit.d.ts +11 -0
  354. package/dist/runtime/server/utils/rate-limit.js +22 -0
  355. package/dist/runtime/server/utils/require-observe-session.d.ts +15 -0
  356. package/dist/runtime/server/utils/require-observe-session.js +25 -0
  357. package/dist/runtime/server/utils/rollout.d.ts +19 -0
  358. package/dist/runtime/server/utils/rollout.js +56 -0
  359. package/dist/runtime/server/utils/scope.d.ts +14 -0
  360. package/dist/runtime/server/utils/scope.js +28 -0
  361. package/dist/runtime/server/utils/seed.d.ts +18 -0
  362. package/dist/runtime/server/utils/seed.js +70 -0
  363. package/dist/runtime/server/utils/services.d.ts +91 -0
  364. package/dist/runtime/server/utils/services.js +142 -0
  365. package/dist/runtime/server/utils/stats-query.d.ts +40 -0
  366. package/dist/runtime/server/utils/stats-query.js +104 -0
  367. package/dist/runtime/shared/auth/roles.d.ts +34 -0
  368. package/dist/runtime/shared/auth/roles.js +6 -0
  369. package/dist/runtime/shared/auth/schema.d.ts +85 -0
  370. package/dist/runtime/shared/auth/schema.js +41 -0
  371. package/dist/runtime/shared/auth/types.d.ts +68 -0
  372. package/dist/runtime/shared/auth/types.js +0 -0
  373. package/dist/runtime/shared/rbac/capabilities.d.ts +46 -0
  374. package/dist/runtime/shared/rbac/capabilities.js +48 -0
  375. package/dist/runtime/shared/schema/activity.d.ts +77 -0
  376. package/dist/runtime/shared/schema/activity.js +22 -0
  377. package/dist/runtime/shared/schema/adapters/frogger.d.ts +52 -0
  378. package/dist/runtime/shared/schema/adapters/frogger.js +17 -0
  379. package/dist/runtime/shared/schema/batch.d.ts +33 -0
  380. package/dist/runtime/shared/schema/batch.js +9 -0
  381. package/dist/runtime/shared/schema/error-fingerprint.d.ts +53 -0
  382. package/dist/runtime/shared/schema/error-fingerprint.js +47 -0
  383. package/dist/runtime/shared/schema/errors-query.d.ts +136 -0
  384. package/dist/runtime/shared/schema/errors-query.js +47 -0
  385. package/dist/runtime/shared/schema/event.d.ts +48 -0
  386. package/dist/runtime/shared/schema/event.js +41 -0
  387. package/dist/runtime/shared/schema/frogger-map.d.ts +62 -0
  388. package/dist/runtime/shared/schema/frogger-map.js +30 -0
  389. package/dist/runtime/shared/schema/index.d.ts +17 -0
  390. package/dist/runtime/shared/schema/index.js +17 -0
  391. package/dist/runtime/shared/schema/journey.d.ts +99 -0
  392. package/dist/runtime/shared/schema/journey.js +96 -0
  393. package/dist/runtime/shared/schema/levels.d.ts +37 -0
  394. package/dist/runtime/shared/schema/levels.js +72 -0
  395. package/dist/runtime/shared/schema/log-row.d.ts +31 -0
  396. package/dist/runtime/shared/schema/log-row.js +0 -0
  397. package/dist/runtime/shared/schema/logs-query.d.ts +91 -0
  398. package/dist/runtime/shared/schema/logs-query.js +72 -0
  399. package/dist/runtime/shared/schema/migrations.d.ts +34 -0
  400. package/dist/runtime/shared/schema/migrations.js +0 -0
  401. package/dist/runtime/shared/schema/overview.d.ts +78 -0
  402. package/dist/runtime/shared/schema/overview.js +9 -0
  403. package/dist/runtime/shared/schema/provisioning.d.ts +230 -0
  404. package/dist/runtime/shared/schema/provisioning.js +52 -0
  405. package/dist/runtime/shared/schema/registry.d.ts +115 -0
  406. package/dist/runtime/shared/schema/registry.js +27 -0
  407. package/dist/runtime/shared/schema/rollout.d.ts +103 -0
  408. package/dist/runtime/shared/schema/rollout.js +66 -0
  409. package/dist/runtime/shared/schema/stats.d.ts +64 -0
  410. package/dist/runtime/shared/schema/stats.js +15 -0
  411. package/dist/runtime/shared/schema/tiers.d.ts +5 -0
  412. package/dist/runtime/shared/schema/tiers.js +9 -0
  413. package/dist/runtime/shared/types/module-options.d.ts +119 -0
  414. package/dist/runtime/shared/types/module-options.js +13 -0
  415. package/dist/runtime/shared/types/storage.d.ts +31 -0
  416. package/dist/runtime/shared/types/storage.js +0 -0
  417. package/dist/runtime/shared/utils/format-relative.d.ts +7 -0
  418. package/dist/runtime/shared/utils/format-relative.js +11 -0
  419. package/dist/runtime/shared/utils/frogger-snippet.d.ts +19 -0
  420. package/dist/runtime/shared/utils/frogger-snippet.js +33 -0
  421. package/dist/runtime/shared/utils/observe-config.d.ts +9 -0
  422. package/dist/runtime/shared/utils/observe-config.js +17 -0
  423. package/dist/runtime/shared/utils/period.d.ts +13 -0
  424. package/dist/runtime/shared/utils/period.js +15 -0
  425. package/dist/runtime/shared/utils/slug.d.ts +1 -0
  426. package/dist/runtime/shared/utils/slug.js +5 -0
  427. package/dist/runtime/shared/utils/uuid.d.ts +187 -0
  428. package/dist/runtime/shared/utils/uuid.js +345 -0
  429. package/dist/runtime/types/nuxt-auth-utils-imports.d.ts +25 -0
  430. package/dist/runtime/types/observe-app-imports.d.ts +20 -0
  431. package/dist/runtime/types/session.d.ts +17 -0
  432. package/dist/schema.d.mts +1318 -0
  433. package/dist/schema.mjs +629 -0
  434. package/dist/types.d.mts +3 -0
  435. package/package.json +93 -0
@@ -0,0 +1,59 @@
1
+ import { uuidv7 } from "../../shared/utils/uuid.js";
2
+ import { useObserveDb } from "./db.js";
3
+ export async function createGroup(input, opts = {}) {
4
+ const db = opts.db ?? useObserveDb();
5
+ const id = uuidv7();
6
+ const now = Date.now();
7
+ await db.sql`INSERT INTO groups (id, slug, name, created_at, updated_at) VALUES (${id}, ${input.slug}, ${input.name}, ${now}, ${now})`;
8
+ return await getGroupById(id, opts);
9
+ }
10
+ export async function getGroupById(id, opts = {}) {
11
+ const db = opts.db ?? useObserveDb();
12
+ const row = await db.prepare("SELECT * FROM groups WHERE id = ?").get(id);
13
+ return row ?? null;
14
+ }
15
+ export async function getGroupBySlug(slug, opts = {}) {
16
+ const db = opts.db ?? useObserveDb();
17
+ const row = await db.prepare("SELECT * FROM groups WHERE slug = ?").get(slug);
18
+ return row ?? null;
19
+ }
20
+ export async function listGroups(opts = {}) {
21
+ const db = opts.db ?? useObserveDb();
22
+ return await db.prepare("SELECT * FROM groups ORDER BY created_at").all();
23
+ }
24
+ export async function updateGroup(id, patch, opts = {}) {
25
+ const db = opts.db ?? useObserveDb();
26
+ const existing = await getGroupById(id, opts);
27
+ if (!existing) return null;
28
+ await db.sql`UPDATE groups SET name = ${patch.name}, updated_at = ${Date.now()} WHERE id = ${id}`;
29
+ return await getGroupById(id, opts);
30
+ }
31
+ export async function deleteGroup(id, opts = {}) {
32
+ const db = opts.db ?? useObserveDb();
33
+ const existing = await getGroupById(id, opts);
34
+ if (!existing) return false;
35
+ await db.sql`BEGIN`;
36
+ try {
37
+ await db.sql`UPDATE services SET group_id = NULL, updated_at = ${Date.now()} WHERE group_id = ${id}`;
38
+ await db.sql`DELETE FROM groups WHERE id = ${id}`;
39
+ await db.sql`COMMIT`;
40
+ } catch (e) {
41
+ await db.sql`ROLLBACK`;
42
+ throw e;
43
+ }
44
+ return true;
45
+ }
46
+ export async function assignServiceToGroup(serviceId, groupId, opts = {}) {
47
+ const db = opts.db ?? useObserveDb();
48
+ await db.sql`UPDATE services SET group_id = ${groupId}, updated_at = ${Date.now()} WHERE id = ${serviceId}`;
49
+ }
50
+ export async function listServicesInGroup(groupId, opts = {}) {
51
+ const db = opts.db ?? useObserveDb();
52
+ return await db.prepare("SELECT * FROM services WHERE group_id = ? ORDER BY created_at").all(groupId);
53
+ }
54
+ export async function getGroupWithServices(groupId, opts = {}) {
55
+ const group = await getGroupById(groupId, opts);
56
+ if (!group) return null;
57
+ const services = await listServicesInGroup(groupId, opts);
58
+ return { group, services };
59
+ }
@@ -0,0 +1,23 @@
1
+ import { type H3Event, type H3CorsOptions } from 'h3';
2
+ import type { ServiceCorsMeta } from './services.js';
3
+ /**
4
+ * Pure origin-decision for the ingest CORS policy, extracted so it is unit
5
+ * testable without an H3Event. A browser service with a non-empty allowlist
6
+ * echoes those origins ('*' if the list holds the wildcard). Every other case
7
+ * (server client, keyless, revoked, empty allowlist) yields the configured
8
+ * fallback, which never affects server-side clients (they send no Origin).
9
+ */
10
+ export declare function resolveIngestCorsOrigin(corsMeta: ServiceCorsMeta | null | undefined, fallbackOrigin: H3CorsOptions['origin']): H3CorsOptions['origin'];
11
+ /**
12
+ * Per-service CORS. `corsMeta` is resolved by the handler from ?key= BEFORE this
13
+ * call. CORS only ever governs browsers: the API key is the sole ingest gate, so
14
+ * a null meta (server/keyless/revoked) simply grants no cross-origin access and
15
+ * lets the request proceed to normal key auth. Returns true if a preflight was
16
+ * answered (the handler must then `return` immediately).
17
+ *
18
+ * The default fallback origin is `[]` (no grant unless the service opts in), a
19
+ * deliberate change from the pre-CP10.5 `'*'`; set `observe.ingest.cors.origin`
20
+ * to restore a global collector. No `credentials: true` because the key rides
21
+ * `?key=`/`x-api-key`, not a cookie.
22
+ */
23
+ export declare function handleCorsForIngest(event: H3Event, corsMeta?: ServiceCorsMeta | null): boolean;
@@ -0,0 +1,27 @@
1
+ import { handleCors } from "h3";
2
+ import { useRuntimeConfig } from "nitropack/runtime";
3
+ const DEFAULT_ALLOW_HEADERS = [
4
+ "content-type",
5
+ "x-api-key",
6
+ "traceparent",
7
+ "x-frogger-reporter",
8
+ "x-frogger-reporter-id",
9
+ "x-frogger-processed",
10
+ "x-frogger-source"
11
+ ];
12
+ export function resolveIngestCorsOrigin(corsMeta, fallbackOrigin) {
13
+ if (corsMeta && corsMeta.kind === "browser" && corsMeta.allowedOrigins.length) {
14
+ return corsMeta.allowedOrigins.includes("*") ? "*" : corsMeta.allowedOrigins;
15
+ }
16
+ return fallbackOrigin;
17
+ }
18
+ export function handleCorsForIngest(event, corsMeta) {
19
+ const cors = useRuntimeConfig().observe?.ingest?.cors;
20
+ const fallbackOrigin = cors?.origin ?? [];
21
+ return handleCors(event, {
22
+ origin: resolveIngestCorsOrigin(corsMeta, fallbackOrigin),
23
+ methods: cors?.methods ?? ["POST", "OPTIONS"],
24
+ allowHeaders: cors?.allowHeaders ?? DEFAULT_ALLOW_HEADERS,
25
+ maxAge: cors?.maxAge ?? "600"
26
+ });
27
+ }
@@ -0,0 +1,20 @@
1
+ import type { LogRow } from '../../shared/schema/log-row.js';
2
+ import type { Database } from './db.js';
3
+ import type { JourneyEvent, JourneyMode } from '../../shared/schema/journey.js';
4
+ /**
5
+ * The journey query layer (CP12). A thin wrapper over the ONE tested query path
6
+ * (queryLogs / LogFilter): reusing it inherits CP6 scoping (serviceIds), ordering,
7
+ * from/to, the limit cap, and the `user_id AS user` SELECT alias for free, instead
8
+ * of a second hand-rolled WHERE. Correlation is a plain equality on an indexed
9
+ * column (trace_id / session / user_id), so there is no join.
10
+ */
11
+ export interface JourneyOpts {
12
+ from?: number;
13
+ to?: number;
14
+ limit: number;
15
+ serviceIds: string[] | '*';
16
+ db?: Database;
17
+ }
18
+ /** Project a physical row to the light timeline shape, offset from the journey start. */
19
+ export declare function toJourneyEvent(row: LogRow, journeyStart: number): JourneyEvent;
20
+ export declare function getJourney(mode: JourneyMode, key: string, opts: JourneyOpts): Promise<JourneyEvent[]>;
@@ -0,0 +1,44 @@
1
+ import { queryLogs } from "./logs.js";
2
+ import { rowToDetail } from "../../shared/schema/logs-query.js";
3
+ export function toJourneyEvent(row, journeyStart) {
4
+ const d = rowToDetail(row);
5
+ return {
6
+ id: d.id,
7
+ time: d.time,
8
+ offsetMs: d.time - journeyStart,
9
+ level: d.level,
10
+ message: d.message,
11
+ app: d.app,
12
+ version: d.version,
13
+ service_id: d.service_id,
14
+ route: d.route,
15
+ feature: d.feature,
16
+ session: d.session,
17
+ error: d.error ? {
18
+ ...d.error.name ? { name: d.error.name } : {},
19
+ ...d.error.message ? { message: d.error.message } : {},
20
+ ...d.error.code ? { code: d.error.code } : {}
21
+ // stack omitted from the timeline wire
22
+ } : null,
23
+ traceId: d.trace?.traceId ?? null,
24
+ spanId: d.trace?.spanId ?? null,
25
+ parentId: d.trace?.parentId ?? null,
26
+ hasTrace: !!(d.trace?.traceId && d.trace?.spanId),
27
+ hasParent: !!d.trace?.parentId
28
+ };
29
+ }
30
+ export async function getJourney(mode, key, opts) {
31
+ const base = {
32
+ serviceIds: opts.serviceIds,
33
+ order: "asc",
34
+ // the waterfall reads earliest-first
35
+ limit: opts.limit,
36
+ // A trace link must never dangle because the navbar window moved on, so trace
37
+ // mode ignores from/to (idx_logs_trace carries the query); session/user apply them.
38
+ ...mode === "trace" ? {} : { from: opts.from, to: opts.to }
39
+ };
40
+ const filter = mode === "trace" ? { ...base, traceId: key } : mode === "session" ? { ...base, session: key } : { ...base, user: key };
41
+ const rows = await queryLogs(filter, { db: opts.db });
42
+ const start = rows.length ? rows[0].time : 0;
43
+ return rows.map((r) => toJourneyEvent(r, start));
44
+ }
@@ -0,0 +1,50 @@
1
+ import type { CanonicalEvent } from '../../shared/schema/event.js';
2
+ import type { LogRow } from '../../shared/schema/log-row.js';
3
+ import type { LogFilter } from '../../shared/types/storage.js';
4
+ import { type Database } from './db.js';
5
+ /**
6
+ * Pure canonical -> physical-row mapper: flattens `error` into `error_*`, splits
7
+ * `source`/`trace`, JSON-encodes `tags`/`ctx` (null when absent), clamps `level`.
8
+ * Assigns a time-sortable uuidv7 id. No DB access.
9
+ */
10
+ export declare function eventToRow(event: CanonicalEvent, receivedAt: number, serviceId?: string | null): LogRow;
11
+ /**
12
+ * Insert a batch as a single all-or-nothing transaction. `serviceId` is stamped
13
+ * onto every row. Rolls back and rethrows on any per-row error.
14
+ */
15
+ export declare function insertEvents(events: CanonicalEvent[], opts?: {
16
+ db?: Database;
17
+ serviceId?: string | null;
18
+ }): Promise<{
19
+ inserted: number;
20
+ }>;
21
+ /** Escape LIKE metacharacters so user text matches literally. Exported for tests. */
22
+ export declare function escapeLike(s: string): string;
23
+ export declare function queryLogs(filter: LogFilter, opts?: {
24
+ db?: Database;
25
+ }): Promise<LogRow[]>;
26
+ export declare function countLogs(filter: LogFilter, opts?: {
27
+ db?: Database;
28
+ }): Promise<number>;
29
+ /** Single row by PK, unscoped: the handler decides 404 vs 403 from the row's service_id. */
30
+ export declare function getLogById(id: string, opts?: {
31
+ db?: Database;
32
+ }): Promise<LogRow | null>;
33
+ /** Distinct non-null versions over the caller's resolved scope, newest-ish first. */
34
+ export declare function queryDistinctVersions(scope: string[] | '*', opts?: {
35
+ db?: Database;
36
+ }): Promise<string[]>;
37
+ /**
38
+ * Deletes rows with `time < now - retentionDays*DAY_MS`. Returns the deleted
39
+ * count. `retentionDays`/`now` are injectable so the cutoff is unit-testable
40
+ * without a running Nitro; when omitted, retention falls back to
41
+ * runtimeConfig.observe.retentionDays (default 30). Strict `<` keeps a row
42
+ * sitting exactly on the boundary.
43
+ */
44
+ export declare function purgeOldLogs(opts?: {
45
+ db?: Database;
46
+ now?: number;
47
+ retentionDays?: number;
48
+ }): Promise<{
49
+ deleted: number;
50
+ }>;
@@ -0,0 +1,154 @@
1
+ import { useRuntimeConfig } from "nitropack/runtime";
2
+ import { uuidv7 } from "../../shared/utils/uuid.js";
3
+ import { fingerprintError } from "../../shared/schema/error-fingerprint.js";
4
+ import { useObserveDb } from "./db.js";
5
+ const DAY_MS = 864e5;
6
+ const DEFAULT_RETENTION_DAYS = 30;
7
+ const clampLevel = (n) => n < 0 ? 0 : n > 5 ? 5 : Math.trunc(n);
8
+ export function eventToRow(event, receivedAt, serviceId) {
9
+ return {
10
+ id: uuidv7(),
11
+ time: event.time,
12
+ received_at: receivedAt,
13
+ level: clampLevel(event.level),
14
+ message: event.message,
15
+ error_name: event.error?.name,
16
+ error_message: event.error?.message,
17
+ error_stack: event.error?.stack,
18
+ error_code: event.error?.code === void 0 ? void 0 : String(event.error.code),
19
+ // Stable error grouping key (CP14): computed once at ingest, NULL for non-error rows.
20
+ error_fingerprint: event.error ? fingerprintError(event.error).fingerprint : void 0,
21
+ app: event.source?.app ?? "",
22
+ version: event.source?.version,
23
+ env: event.source?.env,
24
+ service_id: serviceId ?? void 0,
25
+ trace_id: event.trace?.traceId,
26
+ span_id: event.trace?.spanId,
27
+ parent_id: event.trace?.parentId,
28
+ session: event.session,
29
+ user: event.user,
30
+ route: event.route,
31
+ feature: event.feature,
32
+ tags: event.tags ? JSON.stringify(event.tags) : void 0,
33
+ ctx: event.ctx ? JSON.stringify(event.ctx) : void 0
34
+ };
35
+ }
36
+ export async function insertEvents(events, opts = {}) {
37
+ const db = opts.db ?? useObserveDb();
38
+ const receivedAt = Date.now();
39
+ const rows = events.map((e) => eventToRow(e, receivedAt, opts.serviceId));
40
+ await db.sql`BEGIN`;
41
+ try {
42
+ for (const r of rows) {
43
+ await db.sql`
44
+ INSERT INTO logs (
45
+ id, time, received_at, level, message,
46
+ error_name, error_message, error_stack, error_code, error_fingerprint,
47
+ app, version, env, service_id,
48
+ trace_id, span_id, parent_id,
49
+ session, user_id, route, feature, tags, ctx
50
+ ) VALUES (
51
+ ${r.id}, ${r.time}, ${r.received_at}, ${r.level}, ${r.message},
52
+ ${r.error_name ?? null}, ${r.error_message ?? null}, ${r.error_stack ?? null}, ${r.error_code ?? null}, ${r.error_fingerprint ?? null},
53
+ ${r.app}, ${r.version ?? null}, ${r.env ?? null}, ${r.service_id ?? null},
54
+ ${r.trace_id ?? null}, ${r.span_id ?? null}, ${r.parent_id ?? null},
55
+ ${r.session ?? null}, ${r.user ?? null}, ${r.route ?? null}, ${r.feature ?? null}, ${r.tags ?? null}, ${r.ctx ?? null}
56
+ )
57
+ `;
58
+ }
59
+ await db.sql`COMMIT`;
60
+ } catch (e) {
61
+ await db.sql`ROLLBACK`;
62
+ throw e;
63
+ }
64
+ return { inserted: rows.length };
65
+ }
66
+ function buildWhere(filter) {
67
+ const conds = [];
68
+ const params = [];
69
+ const eq = (col, val) => {
70
+ if (val !== void 0 && val !== null) {
71
+ conds.push(`${col} = ?`);
72
+ params.push(val);
73
+ }
74
+ };
75
+ const range = (col, val) => {
76
+ if (val !== void 0) {
77
+ conds.push(col);
78
+ params.push(val);
79
+ }
80
+ };
81
+ range("time >= ?", filter.from);
82
+ range("time <= ?", filter.to);
83
+ range("level = ?", filter.level);
84
+ range("level <= ?", filter.minLevel);
85
+ eq("app", filter.app);
86
+ eq("service_id", filter.serviceId);
87
+ eq("trace_id", filter.traceId);
88
+ eq("session", filter.session);
89
+ eq("user_id", filter.user);
90
+ eq("route", filter.route);
91
+ eq("feature", filter.feature);
92
+ eq("version", filter.version);
93
+ eq("error_fingerprint", filter.errorFingerprint);
94
+ if (filter.levels && filter.levels.length > 0) {
95
+ conds.push(`level IN (${filter.levels.map(() => "?").join(",")})`);
96
+ params.push(...filter.levels);
97
+ }
98
+ if (filter.versions && filter.versions.length > 0) {
99
+ conds.push(`version IN (${filter.versions.map(() => "?").join(",")})`);
100
+ params.push(...filter.versions);
101
+ }
102
+ if (filter.q) {
103
+ conds.push(`message LIKE ? ESCAPE '\\'`);
104
+ params.push(`%${escapeLike(filter.q)}%`);
105
+ }
106
+ if (filter.serviceIds && filter.serviceIds !== "*") {
107
+ if (filter.serviceIds.length === 0) {
108
+ conds.push("1=0");
109
+ } else {
110
+ conds.push(`service_id IN (${filter.serviceIds.map(() => "?").join(",")})`);
111
+ params.push(...filter.serviceIds);
112
+ }
113
+ }
114
+ return { clause: conds.length ? `WHERE ${conds.join(" AND ")}` : "", params };
115
+ }
116
+ export function escapeLike(s) {
117
+ return s.replace(/[\\%_]/g, (m) => `\\${m}`);
118
+ }
119
+ const SELECT_COLS = "*, user_id AS user";
120
+ export async function queryLogs(filter, opts = {}) {
121
+ const db = opts.db ?? useObserveDb();
122
+ const { clause, params } = buildWhere(filter);
123
+ const order = filter.order === "asc" ? "ASC" : "DESC";
124
+ const limit = filter.limit ?? 100;
125
+ const offset = filter.offset ?? 0;
126
+ const sql = `SELECT ${SELECT_COLS} FROM logs ${clause} ORDER BY time ${order}, id ${order} LIMIT ? OFFSET ?`;
127
+ return await db.prepare(sql).all(...params, limit, offset);
128
+ }
129
+ export async function countLogs(filter, opts = {}) {
130
+ const db = opts.db ?? useObserveDb();
131
+ const { clause, params } = buildWhere(filter);
132
+ const row = await db.prepare(`SELECT COUNT(*) AS n FROM logs ${clause}`).get(...params);
133
+ return row.n;
134
+ }
135
+ export async function getLogById(id, opts = {}) {
136
+ const db = opts.db ?? useObserveDb();
137
+ const row = await db.prepare(`SELECT ${SELECT_COLS} FROM logs WHERE id = ?`).get(id);
138
+ return row ?? null;
139
+ }
140
+ export async function queryDistinctVersions(scope, opts = {}) {
141
+ const db = opts.db ?? useObserveDb();
142
+ const scoped = scope === "*" ? { clause: "", params: [] } : scope.length === 0 ? { clause: "AND 1=0", params: [] } : { clause: `AND service_id IN (${scope.map(() => "?").join(",")})`, params: [...scope] };
143
+ const rows = await db.prepare(
144
+ `SELECT DISTINCT version FROM logs WHERE version IS NOT NULL ${scoped.clause} ORDER BY version DESC`
145
+ ).all(...scoped.params);
146
+ return rows.map((r) => r.version);
147
+ }
148
+ export async function purgeOldLogs(opts = {}) {
149
+ const db = opts.db ?? useObserveDb();
150
+ const retentionDays = opts.retentionDays ?? useRuntimeConfig().observe?.retentionDays ?? DEFAULT_RETENTION_DAYS;
151
+ const cutoff = (opts.now ?? Date.now()) - retentionDays * DAY_MS;
152
+ const res = await db.sql`DELETE FROM logs WHERE time < ${cutoff}`;
153
+ return { deleted: res.changes ?? 0 };
154
+ }
@@ -0,0 +1,11 @@
1
+ import type { H3Event } from 'h3';
2
+ /**
3
+ * Lightweight port of frogger's detectLoggingLoop (logger.post.ts:21-84), minus
4
+ * its NUXT_APP_NAME self-source check (meaningless in a sink, which never relays).
5
+ * observe rejects only a circular processChain or a >10min-stale batch; the
6
+ * x-frogger-* headers are advisory here. `meta` is the batch meta object.
7
+ */
8
+ export declare function checkIngestLoop(_event: H3Event, meta: unknown): {
9
+ reject: boolean;
10
+ reason?: string;
11
+ };
@@ -0,0 +1,11 @@
1
+ const STALE_MS = 6e5;
2
+ export function checkIngestLoop(_event, meta) {
3
+ const m = meta ?? {};
4
+ if (Array.isArray(m.processChain) && new Set(m.processChain).size !== m.processChain.length) {
5
+ return { reject: true, reason: "Circular processing chain" };
6
+ }
7
+ if (typeof m.time === "number" && Date.now() - m.time > STALE_MS) {
8
+ return { reject: true, reason: "Stale batch (>10m) \u2014 possible retry loop" };
9
+ }
10
+ return { reject: false };
11
+ }
@@ -0,0 +1,21 @@
1
+ import { type Database } from './db.js';
2
+ /**
3
+ * Full baseline schema as a single multi-statement string. Every statement is
4
+ * `CREATE ... IF NOT EXISTS`, so running it repeatedly is a no-op. It includes the
5
+ * `schema_migrations` ledger (CP17), created here so it exists before the runner queries
6
+ * it on the very first boot. Additive column changes on already-existing tables now live
7
+ * in the versioned migration registry (server/migrations/), not in `ensure*` helpers here;
8
+ * the runner applies and records them (server/utils/migration-runner.ts).
9
+ */
10
+ export declare const OBSERVE_DDL = "\nCREATE TABLE IF NOT EXISTS schema_migrations (\n id TEXT PRIMARY KEY, -- e.g. '0004-logs-error-fingerprint'\n class TEXT NOT NULL, -- 'additive' | 'destructive' (audit record)\n checksum TEXT NOT NULL, -- sha1 of the migration's up() source at author time\n applied_at INTEGER NOT NULL, -- ms epoch\n duration_ms INTEGER NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS groups (\n id TEXT PRIMARY KEY,\n slug TEXT NOT NULL UNIQUE,\n name TEXT NOT NULL,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS services (\n id TEXT PRIMARY KEY,\n slug TEXT NOT NULL UNIQUE,\n name TEXT NOT NULL,\n group_id TEXT NULL REFERENCES groups(id),\n env TEXT NULL,\n version_tracking INTEGER NOT NULL DEFAULT 0,\n current_version TEXT NULL,\n kind TEXT NOT NULL DEFAULT 'server', -- 'server' | 'browser'; toggles browser CORS only\n type TEXT NOT NULL DEFAULT 'service', -- descriptive category; UI badge only, no runtime effect\n deleted_at INTEGER NULL, -- soft-delete marker; NULL = active. Purged after the retention window.\n created_by TEXT NULL,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\nCREATE INDEX IF NOT EXISTS idx_services_group ON services(group_id);\n\nCREATE TABLE IF NOT EXISTS service_app_names (\n service_id TEXT NOT NULL REFERENCES services(id),\n app_name TEXT NOT NULL UNIQUE,\n PRIMARY KEY (service_id, app_name)\n);\n\nCREATE TABLE IF NOT EXISTS service_allowed_origins (\n service_id TEXT NOT NULL REFERENCES services(id),\n origin TEXT NOT NULL,\n PRIMARY KEY (service_id, origin)\n);\n\nCREATE TABLE IF NOT EXISTS api_keys (\n id TEXT PRIMARY KEY,\n service_id TEXT NOT NULL REFERENCES services(id),\n key_hash TEXT NOT NULL UNIQUE,\n key_prefix TEXT NOT NULL,\n label TEXT NULL,\n created_at INTEGER NOT NULL,\n revoked_at INTEGER NULL,\n last_used_at INTEGER NULL\n);\nCREATE INDEX IF NOT EXISTS idx_api_keys_service ON api_keys(service_id);\n\nCREATE TABLE IF NOT EXISTS users (\n id TEXT PRIMARY KEY,\n username TEXT NOT NULL UNIQUE,\n display_name TEXT NULL,\n password_hash TEXT NULL, -- NULL => JWT-only / no local login\n role TEXT NOT NULL DEFAULT 'viewer', -- global role (drives admin/manager/viewer)\n disabled INTEGER NOT NULL DEFAULT 0, -- 0 => active, 1 => cannot authenticate\n source TEXT NOT NULL,\n created_by TEXT NULL,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NULL\n);\nCREATE TABLE IF NOT EXISTS user_service_roles (\n user_id TEXT NOT NULL,\n service_id TEXT NOT NULL,\n role TEXT NOT NULL,\n PRIMARY KEY (user_id, service_id)\n);\nCREATE TABLE IF NOT EXISTS user_group_roles (\n user_id TEXT NOT NULL,\n group_id TEXT NOT NULL,\n role TEXT NOT NULL,\n PRIMARY KEY (user_id, group_id)\n);\nCREATE TABLE IF NOT EXISTS user_identities (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n provider TEXT NOT NULL, -- 'jwt' (room for future external sources)\n subject TEXT NOT NULL, -- the token sub claim\n created_at INTEGER NOT NULL,\n UNIQUE (provider, subject)\n);\nCREATE INDEX IF NOT EXISTS idx_user_identities_user ON user_identities(user_id);\nCREATE INDEX IF NOT EXISTS idx_user_service_roles_user ON user_service_roles(user_id);\nCREATE INDEX IF NOT EXISTS idx_user_group_roles_user ON user_group_roles(user_id);\n\nCREATE TABLE IF NOT EXISTS logs (\n id TEXT PRIMARY KEY,\n time INTEGER NOT NULL,\n received_at INTEGER NOT NULL,\n level INTEGER NOT NULL,\n message TEXT,\n error_name TEXT,\n error_message TEXT,\n error_stack TEXT,\n error_code TEXT,\n app TEXT,\n version TEXT,\n env TEXT,\n service_id TEXT,\n trace_id TEXT,\n span_id TEXT,\n parent_id TEXT,\n session TEXT,\n user_id TEXT,\n route TEXT,\n feature TEXT,\n tags TEXT,\n ctx TEXT,\n error_fingerprint TEXT\n);\nCREATE INDEX IF NOT EXISTS idx_logs_time ON logs(time);\nCREATE INDEX IF NOT EXISTS idx_logs_level_time ON logs(level, time);\nCREATE INDEX IF NOT EXISTS idx_logs_app_time ON logs(app, time);\nCREATE INDEX IF NOT EXISTS idx_logs_service_time ON logs(service_id, time);\nCREATE INDEX IF NOT EXISTS idx_logs_trace ON logs(trace_id);\nCREATE INDEX IF NOT EXISTS idx_logs_session ON logs(session);\nCREATE INDEX IF NOT EXISTS idx_logs_user ON logs(user_id);\nCREATE INDEX IF NOT EXISTS idx_logs_route ON logs(route);\nCREATE INDEX IF NOT EXISTS idx_logs_feature ON logs(feature);\nCREATE INDEX IF NOT EXISTS idx_logs_version ON logs(version);\n";
11
+ /**
12
+ * Runs the baseline CREATE TABLE/INDEX IF NOT EXISTS batch, then the boot-mode migration
13
+ * runner (additive migrations only, stopping at the first pending destructive one; those
14
+ * wait for an admin, see server/migrations/ + migration-runner.ts). The cached-promise
15
+ * once-guard makes concurrent/HMR calls a no-op after the first. An install predating the
16
+ * ledger is adopted here: the runner sees the legacy additive migrations as pending, runs
17
+ * their guarded (no-op) bodies, and records them.
18
+ */
19
+ export declare function ensureObserveSchema(db?: Database): Promise<void>;
20
+ /** Resets the once-guard so a test can migrate a fresh in-memory db. */
21
+ export declare function __resetMigrationGuardForTests(): void;
@@ -0,0 +1,144 @@
1
+ import { useObserveDb } from "./db.js";
2
+ import { runPendingMigrations } from "./migration-runner.js";
3
+ export const OBSERVE_DDL = `
4
+ CREATE TABLE IF NOT EXISTS schema_migrations (
5
+ id TEXT PRIMARY KEY, -- e.g. '0004-logs-error-fingerprint'
6
+ class TEXT NOT NULL, -- 'additive' | 'destructive' (audit record)
7
+ checksum TEXT NOT NULL, -- sha1 of the migration's up() source at author time
8
+ applied_at INTEGER NOT NULL, -- ms epoch
9
+ duration_ms INTEGER NOT NULL
10
+ );
11
+
12
+ CREATE TABLE IF NOT EXISTS groups (
13
+ id TEXT PRIMARY KEY,
14
+ slug TEXT NOT NULL UNIQUE,
15
+ name TEXT NOT NULL,
16
+ created_at INTEGER NOT NULL,
17
+ updated_at INTEGER NOT NULL
18
+ );
19
+
20
+ CREATE TABLE IF NOT EXISTS services (
21
+ id TEXT PRIMARY KEY,
22
+ slug TEXT NOT NULL UNIQUE,
23
+ name TEXT NOT NULL,
24
+ group_id TEXT NULL REFERENCES groups(id),
25
+ env TEXT NULL,
26
+ version_tracking INTEGER NOT NULL DEFAULT 0,
27
+ current_version TEXT NULL,
28
+ kind TEXT NOT NULL DEFAULT 'server', -- 'server' | 'browser'; toggles browser CORS only
29
+ type TEXT NOT NULL DEFAULT 'service', -- descriptive category; UI badge only, no runtime effect
30
+ deleted_at INTEGER NULL, -- soft-delete marker; NULL = active. Purged after the retention window.
31
+ created_by TEXT NULL,
32
+ created_at INTEGER NOT NULL,
33
+ updated_at INTEGER NOT NULL
34
+ );
35
+ CREATE INDEX IF NOT EXISTS idx_services_group ON services(group_id);
36
+
37
+ CREATE TABLE IF NOT EXISTS service_app_names (
38
+ service_id TEXT NOT NULL REFERENCES services(id),
39
+ app_name TEXT NOT NULL UNIQUE,
40
+ PRIMARY KEY (service_id, app_name)
41
+ );
42
+
43
+ CREATE TABLE IF NOT EXISTS service_allowed_origins (
44
+ service_id TEXT NOT NULL REFERENCES services(id),
45
+ origin TEXT NOT NULL,
46
+ PRIMARY KEY (service_id, origin)
47
+ );
48
+
49
+ CREATE TABLE IF NOT EXISTS api_keys (
50
+ id TEXT PRIMARY KEY,
51
+ service_id TEXT NOT NULL REFERENCES services(id),
52
+ key_hash TEXT NOT NULL UNIQUE,
53
+ key_prefix TEXT NOT NULL,
54
+ label TEXT NULL,
55
+ created_at INTEGER NOT NULL,
56
+ revoked_at INTEGER NULL,
57
+ last_used_at INTEGER NULL
58
+ );
59
+ CREATE INDEX IF NOT EXISTS idx_api_keys_service ON api_keys(service_id);
60
+
61
+ CREATE TABLE IF NOT EXISTS users (
62
+ id TEXT PRIMARY KEY,
63
+ username TEXT NOT NULL UNIQUE,
64
+ display_name TEXT NULL,
65
+ password_hash TEXT NULL, -- NULL => JWT-only / no local login
66
+ role TEXT NOT NULL DEFAULT 'viewer', -- global role (drives admin/manager/viewer)
67
+ disabled INTEGER NOT NULL DEFAULT 0, -- 0 => active, 1 => cannot authenticate
68
+ source TEXT NOT NULL,
69
+ created_by TEXT NULL,
70
+ created_at INTEGER NOT NULL,
71
+ updated_at INTEGER NULL
72
+ );
73
+ CREATE TABLE IF NOT EXISTS user_service_roles (
74
+ user_id TEXT NOT NULL,
75
+ service_id TEXT NOT NULL,
76
+ role TEXT NOT NULL,
77
+ PRIMARY KEY (user_id, service_id)
78
+ );
79
+ CREATE TABLE IF NOT EXISTS user_group_roles (
80
+ user_id TEXT NOT NULL,
81
+ group_id TEXT NOT NULL,
82
+ role TEXT NOT NULL,
83
+ PRIMARY KEY (user_id, group_id)
84
+ );
85
+ CREATE TABLE IF NOT EXISTS user_identities (
86
+ id TEXT PRIMARY KEY,
87
+ user_id TEXT NOT NULL,
88
+ provider TEXT NOT NULL, -- 'jwt' (room for future external sources)
89
+ subject TEXT NOT NULL, -- the token sub claim
90
+ created_at INTEGER NOT NULL,
91
+ UNIQUE (provider, subject)
92
+ );
93
+ CREATE INDEX IF NOT EXISTS idx_user_identities_user ON user_identities(user_id);
94
+ CREATE INDEX IF NOT EXISTS idx_user_service_roles_user ON user_service_roles(user_id);
95
+ CREATE INDEX IF NOT EXISTS idx_user_group_roles_user ON user_group_roles(user_id);
96
+
97
+ CREATE TABLE IF NOT EXISTS logs (
98
+ id TEXT PRIMARY KEY,
99
+ time INTEGER NOT NULL,
100
+ received_at INTEGER NOT NULL,
101
+ level INTEGER NOT NULL,
102
+ message TEXT,
103
+ error_name TEXT,
104
+ error_message TEXT,
105
+ error_stack TEXT,
106
+ error_code TEXT,
107
+ app TEXT,
108
+ version TEXT,
109
+ env TEXT,
110
+ service_id TEXT,
111
+ trace_id TEXT,
112
+ span_id TEXT,
113
+ parent_id TEXT,
114
+ session TEXT,
115
+ user_id TEXT,
116
+ route TEXT,
117
+ feature TEXT,
118
+ tags TEXT,
119
+ ctx TEXT,
120
+ error_fingerprint TEXT
121
+ );
122
+ CREATE INDEX IF NOT EXISTS idx_logs_time ON logs(time);
123
+ CREATE INDEX IF NOT EXISTS idx_logs_level_time ON logs(level, time);
124
+ CREATE INDEX IF NOT EXISTS idx_logs_app_time ON logs(app, time);
125
+ CREATE INDEX IF NOT EXISTS idx_logs_service_time ON logs(service_id, time);
126
+ CREATE INDEX IF NOT EXISTS idx_logs_trace ON logs(trace_id);
127
+ CREATE INDEX IF NOT EXISTS idx_logs_session ON logs(session);
128
+ CREATE INDEX IF NOT EXISTS idx_logs_user ON logs(user_id);
129
+ CREATE INDEX IF NOT EXISTS idx_logs_route ON logs(route);
130
+ CREATE INDEX IF NOT EXISTS idx_logs_feature ON logs(feature);
131
+ CREATE INDEX IF NOT EXISTS idx_logs_version ON logs(version);
132
+ `;
133
+ let _migrated;
134
+ export async function ensureObserveSchema(db = useObserveDb()) {
135
+ if (_migrated) return _migrated;
136
+ _migrated = (async () => {
137
+ await db.exec(OBSERVE_DDL);
138
+ await runPendingMigrations(db, { mode: "boot" });
139
+ })();
140
+ return _migrated;
141
+ }
142
+ export function __resetMigrationGuardForTests() {
143
+ _migrated = void 0;
144
+ }
@@ -0,0 +1,42 @@
1
+ import type { Database } from './db.js';
2
+ import type { Migration, MigrationLog } from '../migrations/types.js';
3
+ import type { MigrationStatus } from '../../shared/schema/migrations.js';
4
+ /**
5
+ * The versioned migration runner (CP17). Pure functions taking an explicit `db` (and an
6
+ * optional registry override) so they are node-testable against an in-memory db0 sqlite,
7
+ * following the getStats/getJourney convention. The ledger table `schema_migrations` is the
8
+ * single source of truth for "what has run"; it is created by OBSERVE_DDL before the runner
9
+ * ever queries it. Boot mode auto-applies additive migrations only and stops at the first
10
+ * pending destructive one; admin mode applies an explicit (in-order) subset, additive or
11
+ * destructive, each wrapped in its own transaction with a pre-destructive file backup.
12
+ */
13
+ export type { MigrationStatus };
14
+ export interface RunOptions {
15
+ mode: 'boot' | 'admin';
16
+ ids?: string[];
17
+ log?: MigrationLog;
18
+ dbPath?: string;
19
+ migrations?: readonly Migration[];
20
+ }
21
+ export interface RunResult {
22
+ applied: string[];
23
+ skipped: string[];
24
+ failedAt?: string;
25
+ }
26
+ /** sha1 of the migration's up() source. Detects an accidental post-ship edit (drift). */
27
+ export declare function computeChecksum(m: Migration): string;
28
+ /**
29
+ * Applied/pending/blocked per registry entry, in id order. `blocked` is the crucial one:
30
+ * a pending migration that comes AFTER the first pending destructive migration cannot run
31
+ * (strict in-order application), so the UI shows it as held rather than runnable.
32
+ */
33
+ export declare function getMigrationStatus(db: Database, migrations?: readonly Migration[]): Promise<MigrationStatus[]>;
34
+ /**
35
+ * Apply pending migrations. Boot mode auto-applies additive migrations in strict id order
36
+ * and STOPS at the first pending destructive one, never touching it. Admin mode applies the
37
+ * requested `ids` (or all pending) in id order, but refuses to skip ahead of an earlier
38
+ * pending migration. Each migration runs in its own transaction; the ledger row is written
39
+ * inside that same transaction so a rollback leaves nothing recorded and a re-run resumes
40
+ * cleanly from the failure.
41
+ */
42
+ export declare function runPendingMigrations(db: Database, opts: RunOptions): Promise<RunResult>;