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.
- package/README.md +92 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +393 -0
- package/dist/runtime/app/assets/css/main.css +1 -0
- package/dist/runtime/app/components/ObserveActivityFeed.d.vue.ts +13 -0
- package/dist/runtime/app/components/ObserveActivityFeed.vue +77 -0
- package/dist/runtime/app/components/ObserveActivityFeed.vue.d.ts +13 -0
- package/dist/runtime/app/components/ObserveActivityTable.d.vue.ts +30 -0
- package/dist/runtime/app/components/ObserveActivityTable.vue +187 -0
- package/dist/runtime/app/components/ObserveActivityTable.vue.d.ts +30 -0
- package/dist/runtime/app/components/ObserveCan.d.vue.ts +27 -0
- package/dist/runtime/app/components/ObserveCan.vue +16 -0
- package/dist/runtime/app/components/ObserveCan.vue.d.ts +27 -0
- package/dist/runtime/app/components/ObserveErrorsTable.d.vue.ts +19 -0
- package/dist/runtime/app/components/ObserveErrorsTable.vue +105 -0
- package/dist/runtime/app/components/ObserveErrorsTable.vue.d.ts +19 -0
- package/dist/runtime/app/components/ObserveHealthHero.d.vue.ts +16 -0
- package/dist/runtime/app/components/ObserveHealthHero.vue +114 -0
- package/dist/runtime/app/components/ObserveHealthHero.vue.d.ts +16 -0
- package/dist/runtime/app/components/ObserveJourneySearch.d.vue.ts +13 -0
- package/dist/runtime/app/components/ObserveJourneySearch.vue +55 -0
- package/dist/runtime/app/components/ObserveJourneySearch.vue.d.ts +13 -0
- package/dist/runtime/app/components/ObserveJourneyTimeline.d.vue.ts +14 -0
- package/dist/runtime/app/components/ObserveJourneyTimeline.vue +119 -0
- package/dist/runtime/app/components/ObserveJourneyTimeline.vue.d.ts +14 -0
- package/dist/runtime/app/components/ObserveLogDetail.d.vue.ts +12 -0
- package/dist/runtime/app/components/ObserveLogDetail.vue +187 -0
- package/dist/runtime/app/components/ObserveLogDetail.vue.d.ts +12 -0
- package/dist/runtime/app/components/ObserveLogLevelBadge.d.vue.ts +10 -0
- package/dist/runtime/app/components/ObserveLogLevelBadge.vue +29 -0
- package/dist/runtime/app/components/ObserveLogLevelBadge.vue.d.ts +10 -0
- package/dist/runtime/app/components/ObserveLogsFilterBar.d.vue.ts +20 -0
- package/dist/runtime/app/components/ObserveLogsFilterBar.vue +134 -0
- package/dist/runtime/app/components/ObserveLogsFilterBar.vue.d.ts +20 -0
- package/dist/runtime/app/components/ObserveLogsTable.d.vue.ts +20 -0
- package/dist/runtime/app/components/ObserveLogsTable.vue +92 -0
- package/dist/runtime/app/components/ObserveLogsTable.vue.d.ts +20 -0
- package/dist/runtime/app/components/ObservePeriodSelector.d.vue.ts +3 -0
- package/dist/runtime/app/components/ObservePeriodSelector.vue +22 -0
- package/dist/runtime/app/components/ObservePeriodSelector.vue.d.ts +3 -0
- package/dist/runtime/app/components/ObserveRegressionAlert.d.vue.ts +12 -0
- package/dist/runtime/app/components/ObserveRegressionAlert.vue +27 -0
- package/dist/runtime/app/components/ObserveRegressionAlert.vue.d.ts +12 -0
- package/dist/runtime/app/components/ObserveServiceSwitcher.d.vue.ts +3 -0
- package/dist/runtime/app/components/ObserveServiceSwitcher.vue +49 -0
- package/dist/runtime/app/components/ObserveServiceSwitcher.vue.d.ts +3 -0
- package/dist/runtime/app/components/ObserveServicesTable.d.vue.ts +15 -0
- package/dist/runtime/app/components/ObserveServicesTable.vue +109 -0
- package/dist/runtime/app/components/ObserveServicesTable.vue.d.ts +15 -0
- package/dist/runtime/app/components/ObserveStatCard.d.vue.ts +14 -0
- package/dist/runtime/app/components/ObserveStatCard.vue +34 -0
- package/dist/runtime/app/components/ObserveStatCard.vue.d.ts +14 -0
- package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.d.vue.ts +15 -0
- package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.vue +170 -0
- package/dist/runtime/app/components/charts/ObserveErrorRateChart.client.vue.d.ts +15 -0
- package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.d.vue.ts +17 -0
- package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.vue +208 -0
- package/dist/runtime/app/components/charts/ObserveServiceBreakdownChart.client.vue.d.ts +17 -0
- package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.d.vue.ts +14 -0
- package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.vue +208 -0
- package/dist/runtime/app/components/charts/ObserveVersionAdoptionChart.client.vue.d.ts +14 -0
- package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.d.vue.ts +14 -0
- package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.vue +190 -0
- package/dist/runtime/app/components/charts/ObserveVersionCompareChart.client.vue.d.ts +14 -0
- package/dist/runtime/app/components/charts/ObserveVolumeChart.client.d.vue.ts +16 -0
- package/dist/runtime/app/components/charts/ObserveVolumeChart.client.vue +199 -0
- package/dist/runtime/app/components/charts/ObserveVolumeChart.client.vue.d.ts +16 -0
- package/dist/runtime/app/components/charts/chart-core.d.ts +64 -0
- package/dist/runtime/app/components/charts/chart-core.js +136 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyPanel.d.vue.ts +8 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyPanel.vue +145 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyPanel.vue.d.ts +8 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.d.vue.ts +19 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.vue +106 -0
- package/dist/runtime/app/components/settings/ObserveApiKeyRevealModal.vue.d.ts +19 -0
- package/dist/runtime/app/components/settings/ObserveAssignmentEditor.d.vue.ts +12 -0
- package/dist/runtime/app/components/settings/ObserveAssignmentEditor.vue +67 -0
- package/dist/runtime/app/components/settings/ObserveAssignmentEditor.vue.d.ts +12 -0
- package/dist/runtime/app/components/settings/ObserveGroupFormModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/settings/ObserveGroupFormModal.vue +60 -0
- package/dist/runtime/app/components/settings/ObserveGroupFormModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.d.vue.ts +20 -0
- package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.vue +21 -0
- package/dist/runtime/app/components/settings/ObserveGroupMembershipEditor.vue.d.ts +20 -0
- package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.d.vue.ts +15 -0
- package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.vue +63 -0
- package/dist/runtime/app/components/settings/ObserveOriginAllowlistEditor.vue.d.ts +15 -0
- package/dist/runtime/app/components/settings/ObserveServiceEditForm.d.vue.ts +38 -0
- package/dist/runtime/app/components/settings/ObserveServiceEditForm.vue +216 -0
- package/dist/runtime/app/components/settings/ObserveServiceEditForm.vue.d.ts +38 -0
- package/dist/runtime/app/components/settings/ObserveServiceFormModal.d.vue.ts +37 -0
- package/dist/runtime/app/components/settings/ObserveServiceFormModal.vue +192 -0
- package/dist/runtime/app/components/settings/ObserveServiceFormModal.vue.d.ts +37 -0
- package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.d.vue.ts +11 -0
- package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.vue +18 -0
- package/dist/runtime/app/components/settings/ObserveServiceTypeBadge.vue.d.ts +11 -0
- package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.d.vue.ts +19 -0
- package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.vue +132 -0
- package/dist/runtime/app/components/settings/ObserveSettingsServicesTable.vue.d.ts +19 -0
- package/dist/runtime/app/components/settings/ObserveUserFormModal.d.vue.ts +27 -0
- package/dist/runtime/app/components/settings/ObserveUserFormModal.vue +108 -0
- package/dist/runtime/app/components/settings/ObserveUserFormModal.vue.d.ts +27 -0
- package/dist/runtime/app/components/settings/ObserveVersionTrackingField.d.vue.ts +17 -0
- package/dist/runtime/app/components/settings/ObserveVersionTrackingField.vue +20 -0
- package/dist/runtime/app/components/settings/ObserveVersionTrackingField.vue.d.ts +17 -0
- package/dist/runtime/app/composables/useObserveAbility.d.ts +15 -0
- package/dist/runtime/app/composables/useObserveAbility.js +20 -0
- package/dist/runtime/app/composables/useObserveActivity.d.ts +22 -0
- package/dist/runtime/app/composables/useObserveActivity.js +44 -0
- package/dist/runtime/app/composables/useObserveApiKeys.d.ts +15 -0
- package/dist/runtime/app/composables/useObserveApiKeys.js +19 -0
- package/dist/runtime/app/composables/useObserveAssignments.d.ts +19 -0
- package/dist/runtime/app/composables/useObserveAssignments.js +16 -0
- package/dist/runtime/app/composables/useObserveErrors.d.ts +33 -0
- package/dist/runtime/app/composables/useObserveErrors.js +85 -0
- package/dist/runtime/app/composables/useObserveGroups.d.ts +27 -0
- package/dist/runtime/app/composables/useObserveGroups.js +33 -0
- package/dist/runtime/app/composables/useObserveJourney.d.ts +19 -0
- package/dist/runtime/app/composables/useObserveJourney.js +19 -0
- package/dist/runtime/app/composables/useObserveLogFacets.d.ts +11 -0
- package/dist/runtime/app/composables/useObserveLogFacets.js +21 -0
- package/dist/runtime/app/composables/useObserveLogs.d.ts +28 -0
- package/dist/runtime/app/composables/useObserveLogs.js +100 -0
- package/dist/runtime/app/composables/useObserveMigrations.d.ts +17 -0
- package/dist/runtime/app/composables/useObserveMigrations.js +49 -0
- package/dist/runtime/app/composables/useObserveOverview.d.ts +14 -0
- package/dist/runtime/app/composables/useObserveOverview.js +23 -0
- package/dist/runtime/app/composables/useObservePeriod.d.ts +11 -0
- package/dist/runtime/app/composables/useObservePeriod.js +18 -0
- package/dist/runtime/app/composables/useObserveRollout.d.ts +20 -0
- package/dist/runtime/app/composables/useObserveRollout.js +55 -0
- package/dist/runtime/app/composables/useObserveScope.d.ts +13 -0
- package/dist/runtime/app/composables/useObserveScope.js +17 -0
- package/dist/runtime/app/composables/useObserveServices.d.ts +26 -0
- package/dist/runtime/app/composables/useObserveServices.js +33 -0
- package/dist/runtime/app/composables/useObserveStats.d.ts +14 -0
- package/dist/runtime/app/composables/useObserveStats.js +23 -0
- package/dist/runtime/app/composables/useObserveUsers.d.ts +29 -0
- package/dist/runtime/app/composables/useObserveUsers.js +33 -0
- package/dist/runtime/app/layouts/observe.d.vue.ts +13 -0
- package/dist/runtime/app/layouts/observe.vue +138 -0
- package/dist/runtime/app/layouts/observe.vue.d.ts +13 -0
- package/dist/runtime/app/middleware/observe-auth.global.d.ts +9 -0
- package/dist/runtime/app/middleware/observe-auth.global.js +8 -0
- package/dist/runtime/app/pages/activity.d.vue.ts +3 -0
- package/dist/runtime/app/pages/activity.vue +54 -0
- package/dist/runtime/app/pages/activity.vue.d.ts +3 -0
- package/dist/runtime/app/pages/error-detail.d.vue.ts +3 -0
- package/dist/runtime/app/pages/error-detail.vue +190 -0
- package/dist/runtime/app/pages/error-detail.vue.d.ts +3 -0
- package/dist/runtime/app/pages/errors.d.vue.ts +3 -0
- package/dist/runtime/app/pages/errors.vue +47 -0
- package/dist/runtime/app/pages/errors.vue.d.ts +3 -0
- package/dist/runtime/app/pages/journey.d.vue.ts +3 -0
- package/dist/runtime/app/pages/journey.vue +96 -0
- package/dist/runtime/app/pages/journey.vue.d.ts +3 -0
- package/dist/runtime/app/pages/log-detail.d.vue.ts +3 -0
- package/dist/runtime/app/pages/log-detail.vue +35 -0
- package/dist/runtime/app/pages/log-detail.vue.d.ts +3 -0
- package/dist/runtime/app/pages/login.d.vue.ts +3 -0
- package/dist/runtime/app/pages/login.vue +69 -0
- package/dist/runtime/app/pages/login.vue.d.ts +3 -0
- package/dist/runtime/app/pages/logs.d.vue.ts +3 -0
- package/dist/runtime/app/pages/logs.vue +36 -0
- package/dist/runtime/app/pages/logs.vue.d.ts +3 -0
- package/dist/runtime/app/pages/metrics.d.vue.ts +3 -0
- package/dist/runtime/app/pages/metrics.vue +68 -0
- package/dist/runtime/app/pages/metrics.vue.d.ts +3 -0
- package/dist/runtime/app/pages/overview.d.vue.ts +3 -0
- package/dist/runtime/app/pages/overview.vue +65 -0
- package/dist/runtime/app/pages/overview.vue.d.ts +3 -0
- package/dist/runtime/app/pages/rollout.d.vue.ts +3 -0
- package/dist/runtime/app/pages/rollout.vue +188 -0
- package/dist/runtime/app/pages/rollout.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/group-detail.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/group-detail.vue +149 -0
- package/dist/runtime/app/pages/settings/group-detail.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/groups.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/groups.vue +107 -0
- package/dist/runtime/app/pages/settings/groups.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/index.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/index.vue +47 -0
- package/dist/runtime/app/pages/settings/index.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/migrations.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/migrations.vue +275 -0
- package/dist/runtime/app/pages/settings/migrations.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/service-detail.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/service-detail.vue +133 -0
- package/dist/runtime/app/pages/settings/service-detail.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/services.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/services.vue +66 -0
- package/dist/runtime/app/pages/settings/services.vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/users/[id].d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/users/[id].vue +243 -0
- package/dist/runtime/app/pages/settings/users/[id].vue.d.ts +3 -0
- package/dist/runtime/app/pages/settings/users/index.d.vue.ts +3 -0
- package/dist/runtime/app/pages/settings/users/index.vue +129 -0
- package/dist/runtime/app/pages/settings/users/index.vue.d.ts +3 -0
- package/dist/runtime/options.d.ts +1 -0
- package/dist/runtime/options.js +1 -0
- package/dist/runtime/server/api/observe/activity.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/activity.get.js +30 -0
- package/dist/runtime/server/api/observe/auth/login.post.d.ts +4 -0
- package/dist/runtime/server/api/observe/auth/login.post.js +13 -0
- package/dist/runtime/server/api/observe/auth/logout.post.d.ts +4 -0
- package/dist/runtime/server/api/observe/auth/logout.post.js +6 -0
- package/dist/runtime/server/api/observe/auth/me.get.d.ts +2 -0
- package/dist/runtime/server/api/observe/auth/me.get.js +3 -0
- package/dist/runtime/server/api/observe/errors/[fingerprint].get.d.ts +3 -0
- package/dist/runtime/server/api/observe/errors/[fingerprint].get.js +56 -0
- package/dist/runtime/server/api/observe/errors/index.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/errors/index.get.js +41 -0
- package/dist/runtime/server/api/observe/facets.get.d.ts +8 -0
- package/dist/runtime/server/api/observe/facets.get.js +12 -0
- package/dist/runtime/server/api/observe/groups/[id]/assignments.put.d.ts +3 -0
- package/dist/runtime/server/api/observe/groups/[id]/assignments.put.js +12 -0
- package/dist/runtime/server/api/observe/groups/[id]/services.put.d.ts +5 -0
- package/dist/runtime/server/api/observe/groups/[id]/services.put.js +13 -0
- package/dist/runtime/server/api/observe/groups/[id].delete.d.ts +5 -0
- package/dist/runtime/server/api/observe/groups/[id].delete.js +11 -0
- package/dist/runtime/server/api/observe/groups/[id].get.d.ts +6 -0
- package/dist/runtime/server/api/observe/groups/[id].get.js +14 -0
- package/dist/runtime/server/api/observe/groups/[id].patch.d.ts +3 -0
- package/dist/runtime/server/api/observe/groups/[id].patch.js +12 -0
- package/dist/runtime/server/api/observe/groups/index.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/groups/index.get.js +7 -0
- package/dist/runtime/server/api/observe/groups/index.post.d.ts +3 -0
- package/dist/runtime/server/api/observe/groups/index.post.js +11 -0
- package/dist/runtime/server/api/observe/health.get.d.ts +6 -0
- package/dist/runtime/server/api/observe/health.get.js +10 -0
- package/dist/runtime/server/api/observe/ingest/frogger.d.ts +5 -0
- package/dist/runtime/server/api/observe/ingest/frogger.js +42 -0
- package/dist/runtime/server/api/observe/ingest.d.ts +5 -0
- package/dist/runtime/server/api/observe/ingest.js +38 -0
- package/dist/runtime/server/api/observe/journey.get.d.ts +9 -0
- package/dist/runtime/server/api/observe/journey.get.js +31 -0
- package/dist/runtime/server/api/observe/logs/[id].get.d.ts +3 -0
- package/dist/runtime/server/api/observe/logs/[id].get.js +19 -0
- package/dist/runtime/server/api/observe/logs.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/logs.get.js +54 -0
- package/dist/runtime/server/api/observe/migrations/index.get.d.ts +9 -0
- package/dist/runtime/server/api/observe/migrations/index.get.js +14 -0
- package/dist/runtime/server/api/observe/migrations/run.post.d.ts +13 -0
- package/dist/runtime/server/api/observe/migrations/run.post.js +35 -0
- package/dist/runtime/server/api/observe/overview.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/overview.get.js +19 -0
- package/dist/runtime/server/api/observe/rollout/compare.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/rollout/compare.get.js +24 -0
- package/dist/runtime/server/api/observe/rollout/regressions.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/rollout/regressions.get.js +31 -0
- package/dist/runtime/server/api/observe/rollout/versions.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/rollout/versions.get.js +20 -0
- package/dist/runtime/server/api/observe/services/[id]/assignments.put.d.ts +7 -0
- package/dist/runtime/server/api/observe/services/[id]/assignments.put.js +12 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/[keyId]/rotate.post.d.ts +4 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/[keyId]/rotate.post.js +14 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/[keyId].delete.d.ts +4 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/[keyId].delete.js +14 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/index.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/index.get.js +10 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/index.post.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/[id]/keys/index.post.js +11 -0
- package/dist/runtime/server/api/observe/services/[id]/restore.post.d.ts +4 -0
- package/dist/runtime/server/api/observe/services/[id]/restore.post.js +11 -0
- package/dist/runtime/server/api/observe/services/[id].delete.d.ts +11 -0
- package/dist/runtime/server/api/observe/services/[id].delete.js +11 -0
- package/dist/runtime/server/api/observe/services/[id].get.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/[id].get.js +12 -0
- package/dist/runtime/server/api/observe/services/[id].patch.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/[id].patch.js +13 -0
- package/dist/runtime/server/api/observe/services/index.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/index.get.js +7 -0
- package/dist/runtime/server/api/observe/services/index.post.d.ts +3 -0
- package/dist/runtime/server/api/observe/services/index.post.js +16 -0
- package/dist/runtime/server/api/observe/stats.get.d.ts +3 -0
- package/dist/runtime/server/api/observe/stats.get.js +28 -0
- package/dist/runtime/server/api/observe/users/[id]/assignments.put.d.ts +3 -0
- package/dist/runtime/server/api/observe/users/[id]/assignments.put.js +14 -0
- package/dist/runtime/server/api/observe/users/[id].delete.d.ts +4 -0
- package/dist/runtime/server/api/observe/users/[id].delete.js +15 -0
- package/dist/runtime/server/api/observe/users/[id].get.d.ts +3 -0
- package/dist/runtime/server/api/observe/users/[id].get.js +11 -0
- package/dist/runtime/server/api/observe/users/[id].patch.d.ts +3 -0
- package/dist/runtime/server/api/observe/users/[id].patch.js +25 -0
- package/dist/runtime/server/api/observe/users/index.get.d.ts +8 -0
- package/dist/runtime/server/api/observe/users/index.get.js +7 -0
- package/dist/runtime/server/api/observe/users/index.post.d.ts +3 -0
- package/dist/runtime/server/api/observe/users/index.post.js +29 -0
- package/dist/runtime/server/auth/authorization.d.ts +7 -0
- package/dist/runtime/server/auth/authorization.js +5 -0
- package/dist/runtime/server/auth/provider.d.ts +17 -0
- package/dist/runtime/server/auth/provider.js +44 -0
- package/dist/runtime/server/auth/providers/config-provider.d.ts +18 -0
- package/dist/runtime/server/auth/providers/config-provider.js +54 -0
- package/dist/runtime/server/auth/providers/db-provider.d.ts +16 -0
- package/dist/runtime/server/auth/providers/db-provider.js +42 -0
- package/dist/runtime/server/auth/providers/jwt-provider.d.ts +24 -0
- package/dist/runtime/server/auth/providers/jwt-provider.js +72 -0
- package/dist/runtime/server/migrations/0001-services-kind.d.ts +8 -0
- package/dist/runtime/server/migrations/0001-services-kind.js +14 -0
- package/dist/runtime/server/migrations/0002-services-type.d.ts +7 -0
- package/dist/runtime/server/migrations/0002-services-type.js +14 -0
- package/dist/runtime/server/migrations/0003-services-deleted-at.d.ts +6 -0
- package/dist/runtime/server/migrations/0003-services-deleted-at.js +14 -0
- package/dist/runtime/server/migrations/0004-logs-error-fingerprint.d.ts +11 -0
- package/dist/runtime/server/migrations/0004-logs-error-fingerprint.js +15 -0
- package/dist/runtime/server/migrations/0005-users-columns.d.ts +9 -0
- package/dist/runtime/server/migrations/0005-users-columns.js +25 -0
- package/dist/runtime/server/migrations/index.d.ts +13 -0
- package/dist/runtime/server/migrations/index.js +13 -0
- package/dist/runtime/server/migrations/types.d.ts +15 -0
- package/dist/runtime/server/migrations/types.js +0 -0
- package/dist/runtime/server/plugins/observe-migrate.server.d.ts +2 -0
- package/dist/runtime/server/plugins/observe-migrate.server.js +18 -0
- package/dist/runtime/server/tasks/backfill-fingerprints.d.ts +11 -0
- package/dist/runtime/server/tasks/backfill-fingerprints.js +41 -0
- package/dist/runtime/server/tasks/purge.d.ts +5 -0
- package/dist/runtime/server/tasks/purge.js +12 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/activity-query.d.ts +28 -0
- package/dist/runtime/server/utils/activity-query.js +70 -0
- package/dist/runtime/server/utils/api-keys.d.ts +48 -0
- package/dist/runtime/server/utils/api-keys.js +67 -0
- package/dist/runtime/server/utils/authz.d.ts +50 -0
- package/dist/runtime/server/utils/authz.js +60 -0
- package/dist/runtime/server/utils/db/users.d.ts +91 -0
- package/dist/runtime/server/utils/db/users.js +128 -0
- package/dist/runtime/server/utils/db.d.ts +10 -0
- package/dist/runtime/server/utils/db.js +5 -0
- package/dist/runtime/server/utils/frogger-adapter.d.ts +40 -0
- package/dist/runtime/server/utils/frogger-adapter.js +97 -0
- package/dist/runtime/server/utils/groups.d.ts +35 -0
- package/dist/runtime/server/utils/groups.js +59 -0
- package/dist/runtime/server/utils/ingest-cors.d.ts +23 -0
- package/dist/runtime/server/utils/ingest-cors.js +27 -0
- package/dist/runtime/server/utils/journey.d.ts +20 -0
- package/dist/runtime/server/utils/journey.js +44 -0
- package/dist/runtime/server/utils/logs.d.ts +50 -0
- package/dist/runtime/server/utils/logs.js +154 -0
- package/dist/runtime/server/utils/loop-guard.d.ts +11 -0
- package/dist/runtime/server/utils/loop-guard.js +11 -0
- package/dist/runtime/server/utils/migrate.d.ts +21 -0
- package/dist/runtime/server/utils/migrate.js +144 -0
- package/dist/runtime/server/utils/migration-runner.d.ts +42 -0
- package/dist/runtime/server/utils/migration-runner.js +129 -0
- package/dist/runtime/server/utils/observe-errors.d.ts +58 -0
- package/dist/runtime/server/utils/observe-errors.js +206 -0
- package/dist/runtime/server/utils/overview.d.ts +20 -0
- package/dist/runtime/server/utils/overview.js +119 -0
- package/dist/runtime/server/utils/provisioning.d.ts +62 -0
- package/dist/runtime/server/utils/provisioning.js +299 -0
- package/dist/runtime/server/utils/rate-limit.d.ts +11 -0
- package/dist/runtime/server/utils/rate-limit.js +22 -0
- package/dist/runtime/server/utils/require-observe-session.d.ts +15 -0
- package/dist/runtime/server/utils/require-observe-session.js +25 -0
- package/dist/runtime/server/utils/rollout.d.ts +19 -0
- package/dist/runtime/server/utils/rollout.js +56 -0
- package/dist/runtime/server/utils/scope.d.ts +14 -0
- package/dist/runtime/server/utils/scope.js +28 -0
- package/dist/runtime/server/utils/seed.d.ts +18 -0
- package/dist/runtime/server/utils/seed.js +70 -0
- package/dist/runtime/server/utils/services.d.ts +91 -0
- package/dist/runtime/server/utils/services.js +142 -0
- package/dist/runtime/server/utils/stats-query.d.ts +40 -0
- package/dist/runtime/server/utils/stats-query.js +104 -0
- package/dist/runtime/shared/auth/roles.d.ts +34 -0
- package/dist/runtime/shared/auth/roles.js +6 -0
- package/dist/runtime/shared/auth/schema.d.ts +85 -0
- package/dist/runtime/shared/auth/schema.js +41 -0
- package/dist/runtime/shared/auth/types.d.ts +68 -0
- package/dist/runtime/shared/auth/types.js +0 -0
- package/dist/runtime/shared/rbac/capabilities.d.ts +46 -0
- package/dist/runtime/shared/rbac/capabilities.js +48 -0
- package/dist/runtime/shared/schema/activity.d.ts +77 -0
- package/dist/runtime/shared/schema/activity.js +22 -0
- package/dist/runtime/shared/schema/adapters/frogger.d.ts +52 -0
- package/dist/runtime/shared/schema/adapters/frogger.js +17 -0
- package/dist/runtime/shared/schema/batch.d.ts +33 -0
- package/dist/runtime/shared/schema/batch.js +9 -0
- package/dist/runtime/shared/schema/error-fingerprint.d.ts +53 -0
- package/dist/runtime/shared/schema/error-fingerprint.js +47 -0
- package/dist/runtime/shared/schema/errors-query.d.ts +136 -0
- package/dist/runtime/shared/schema/errors-query.js +47 -0
- package/dist/runtime/shared/schema/event.d.ts +48 -0
- package/dist/runtime/shared/schema/event.js +41 -0
- package/dist/runtime/shared/schema/frogger-map.d.ts +62 -0
- package/dist/runtime/shared/schema/frogger-map.js +30 -0
- package/dist/runtime/shared/schema/index.d.ts +17 -0
- package/dist/runtime/shared/schema/index.js +17 -0
- package/dist/runtime/shared/schema/journey.d.ts +99 -0
- package/dist/runtime/shared/schema/journey.js +96 -0
- package/dist/runtime/shared/schema/levels.d.ts +37 -0
- package/dist/runtime/shared/schema/levels.js +72 -0
- package/dist/runtime/shared/schema/log-row.d.ts +31 -0
- package/dist/runtime/shared/schema/log-row.js +0 -0
- package/dist/runtime/shared/schema/logs-query.d.ts +91 -0
- package/dist/runtime/shared/schema/logs-query.js +72 -0
- package/dist/runtime/shared/schema/migrations.d.ts +34 -0
- package/dist/runtime/shared/schema/migrations.js +0 -0
- package/dist/runtime/shared/schema/overview.d.ts +78 -0
- package/dist/runtime/shared/schema/overview.js +9 -0
- package/dist/runtime/shared/schema/provisioning.d.ts +230 -0
- package/dist/runtime/shared/schema/provisioning.js +52 -0
- package/dist/runtime/shared/schema/registry.d.ts +115 -0
- package/dist/runtime/shared/schema/registry.js +27 -0
- package/dist/runtime/shared/schema/rollout.d.ts +103 -0
- package/dist/runtime/shared/schema/rollout.js +66 -0
- package/dist/runtime/shared/schema/stats.d.ts +64 -0
- package/dist/runtime/shared/schema/stats.js +15 -0
- package/dist/runtime/shared/schema/tiers.d.ts +5 -0
- package/dist/runtime/shared/schema/tiers.js +9 -0
- package/dist/runtime/shared/types/module-options.d.ts +119 -0
- package/dist/runtime/shared/types/module-options.js +13 -0
- package/dist/runtime/shared/types/storage.d.ts +31 -0
- package/dist/runtime/shared/types/storage.js +0 -0
- package/dist/runtime/shared/utils/format-relative.d.ts +7 -0
- package/dist/runtime/shared/utils/format-relative.js +11 -0
- package/dist/runtime/shared/utils/frogger-snippet.d.ts +19 -0
- package/dist/runtime/shared/utils/frogger-snippet.js +33 -0
- package/dist/runtime/shared/utils/observe-config.d.ts +9 -0
- package/dist/runtime/shared/utils/observe-config.js +17 -0
- package/dist/runtime/shared/utils/period.d.ts +13 -0
- package/dist/runtime/shared/utils/period.js +15 -0
- package/dist/runtime/shared/utils/slug.d.ts +1 -0
- package/dist/runtime/shared/utils/slug.js +5 -0
- package/dist/runtime/shared/utils/uuid.d.ts +187 -0
- package/dist/runtime/shared/utils/uuid.js +345 -0
- package/dist/runtime/types/nuxt-auth-utils-imports.d.ts +25 -0
- package/dist/runtime/types/observe-app-imports.d.ts +20 -0
- package/dist/runtime/types/session.d.ts +17 -0
- package/dist/schema.d.mts +1318 -0
- package/dist/schema.mjs +629 -0
- package/dist/types.d.mts +3 -0
- package/package.json +93 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedQuery } from "h3";
|
|
2
|
+
import { overviewQuerySchema } from "../../../shared/schema/overview.js";
|
|
3
|
+
import { periodToRange } from "../../../shared/utils/period.js";
|
|
4
|
+
import { requireCapability, getAllowedServiceIds } from "../../utils/authz.js";
|
|
5
|
+
import { resolveEffectiveScope } from "../../utils/scope.js";
|
|
6
|
+
import { getOverview, emptyOverview } from "../../utils/overview.js";
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
const { principal } = await requireCapability(event, "stats.read");
|
|
9
|
+
const { period, service, group } = await getValidatedQuery(event, overviewQuerySchema.parse);
|
|
10
|
+
const allowed = await getAllowedServiceIds(event, principal);
|
|
11
|
+
const effective = await resolveEffectiveScope(event, principal, allowed, { service, group });
|
|
12
|
+
const { from, to, label } = periodToRange(period);
|
|
13
|
+
const scope = {
|
|
14
|
+
serviceIds: effective === "*" ? [] : effective,
|
|
15
|
+
isAll: effective === "*"
|
|
16
|
+
};
|
|
17
|
+
const data = effective !== "*" && effective.length === 0 ? emptyOverview() : await getOverview(effective, from, to);
|
|
18
|
+
return { period: { from, to, label }, scope, ...data };
|
|
19
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedQuery, createError, H3Error } from "h3";
|
|
2
|
+
import { rolloutQuerySchema } from "../../../../shared/schema/rollout.js";
|
|
3
|
+
import { periodToRange } from "../../../../shared/utils/period.js";
|
|
4
|
+
import { requireCapability, getAllowedServiceIds } from "../../../utils/authz.js";
|
|
5
|
+
import { resolveEffectiveScope } from "../../../utils/scope.js";
|
|
6
|
+
import { getVersionSeries } from "../../../utils/rollout.js";
|
|
7
|
+
import { DEFAULT_BUCKET_MS, MAX_BUCKETS } from "../../../utils/stats-query.js";
|
|
8
|
+
export default defineEventHandler(async (event) => {
|
|
9
|
+
const { principal } = await requireCapability(event, "stats.read");
|
|
10
|
+
const { period, service, group, env, bucketMs } = await getValidatedQuery(event, rolloutQuerySchema.parse);
|
|
11
|
+
const allowed = await getAllowedServiceIds(event, principal);
|
|
12
|
+
const effective = await resolveEffectiveScope(event, principal, allowed, { service, group });
|
|
13
|
+
const { from, to } = periodToRange(period);
|
|
14
|
+
const bucket = bucketMs ?? DEFAULT_BUCKET_MS[period];
|
|
15
|
+
if ((to - from) / bucket > MAX_BUCKETS) {
|
|
16
|
+
throw createError({ statusCode: 400, statusMessage: "bucketMs too small for window" });
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return await getVersionSeries(effective, from, to, bucket, { env });
|
|
20
|
+
} catch (e) {
|
|
21
|
+
if (e instanceof H3Error) throw e;
|
|
22
|
+
throw createError({ statusCode: 500, statusMessage: "Rollout query failed" });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedQuery, createError, H3Error } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
|
+
import { rolloutQuerySchema, detectRegressions } from "../../../../shared/schema/rollout.js";
|
|
4
|
+
import { periodToRange } from "../../../../shared/utils/period.js";
|
|
5
|
+
import { requireCapability, getAllowedServiceIds } from "../../../utils/authz.js";
|
|
6
|
+
import { resolveEffectiveScope } from "../../../utils/scope.js";
|
|
7
|
+
import { getServiceBySlug } from "../../../utils/services.js";
|
|
8
|
+
import { getVersionSummary } from "../../../utils/rollout.js";
|
|
9
|
+
export default defineEventHandler(async (event) => {
|
|
10
|
+
const { principal } = await requireCapability(event, "stats.read");
|
|
11
|
+
const { period, service, env } = await getValidatedQuery(event, rolloutQuerySchema.parse);
|
|
12
|
+
if (!service) {
|
|
13
|
+
throw createError({ statusCode: 400, statusMessage: "rollout/regressions requires a ?service" });
|
|
14
|
+
}
|
|
15
|
+
const allowed = await getAllowedServiceIds(event, principal);
|
|
16
|
+
await resolveEffectiveScope(event, principal, allowed, { service });
|
|
17
|
+
const svc = await getServiceBySlug(service);
|
|
18
|
+
if (!svc || svc.version_tracking === 0) {
|
|
19
|
+
return { trackingEnabled: false, findings: [] };
|
|
20
|
+
}
|
|
21
|
+
const { from, to } = periodToRange(period);
|
|
22
|
+
try {
|
|
23
|
+
const stats = await getVersionSummary([svc.id], from, to, { env });
|
|
24
|
+
const config = useRuntimeConfig(event).observe.rollout.regression;
|
|
25
|
+
const findings = detectRegressions(stats, config, Date.now());
|
|
26
|
+
return { trackingEnabled: true, findings };
|
|
27
|
+
} catch (e) {
|
|
28
|
+
if (e instanceof H3Error) throw e;
|
|
29
|
+
throw createError({ statusCode: 500, statusMessage: "Rollout query failed" });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedQuery, createError, H3Error } from "h3";
|
|
2
|
+
import { rolloutQuerySchema } from "../../../../shared/schema/rollout.js";
|
|
3
|
+
import { periodToRange } from "../../../../shared/utils/period.js";
|
|
4
|
+
import { requireCapability, getAllowedServiceIds } from "../../../utils/authz.js";
|
|
5
|
+
import { resolveEffectiveScope } from "../../../utils/scope.js";
|
|
6
|
+
import { getVersionSummary } from "../../../utils/rollout.js";
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
const { principal } = await requireCapability(event, "stats.read");
|
|
9
|
+
const { period, service, group, env } = await getValidatedQuery(event, rolloutQuerySchema.parse);
|
|
10
|
+
const allowed = await getAllowedServiceIds(event, principal);
|
|
11
|
+
const effective = await resolveEffectiveScope(event, principal, allowed, { service, group });
|
|
12
|
+
const { from, to } = periodToRange(period);
|
|
13
|
+
try {
|
|
14
|
+
if (effective !== "*" && effective.length === 0) return [];
|
|
15
|
+
return await getVersionSummary(effective, from, to, { env });
|
|
16
|
+
} catch (e) {
|
|
17
|
+
if (e instanceof H3Error) throw e;
|
|
18
|
+
throw createError({ statusCode: 500, statusMessage: "Rollout query failed" });
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 1: assignments are declared in `observe.auth.users` (config), and the config
|
|
3
|
+
* auth provider never reads user_service_roles, so a runtime write here would silently
|
|
4
|
+
* no-op until CP16 ships the DB provider. We refuse rather than mislead (CP11 §11 R1).
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<never>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { serviceIdParams } from "../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability } from "../../../../utils/authz.js";
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
await requireCapability(event, "users.manage");
|
|
6
|
+
await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
7
|
+
throw createError({
|
|
8
|
+
statusCode: 501,
|
|
9
|
+
statusMessage: "Not Implemented",
|
|
10
|
+
data: { error: "ASSIGNMENTS_MANAGED_IN_CONFIG", hint: "Edit observe.auth.users; runtime assignment lands in CP16." }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MintedKey } from '../../../../../../../shared/schema/provisioning.js';
|
|
2
|
+
/** Atomic revoke-old + mint-new. The new raw key is returned exactly once. */
|
|
3
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<MintedKey>>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { keyIdParams, keyCreateSchema } from "../../../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../../../../utils/authz.js";
|
|
4
|
+
import { keyBelongsToService, rotateKey } from "../../../../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.manage");
|
|
7
|
+
const { id, keyId } = await getValidatedRouterParams(event, keyIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
if (!await keyBelongsToService(keyId, id)) {
|
|
10
|
+
throw createError({ statusCode: 404, statusMessage: "Key not found" });
|
|
11
|
+
}
|
|
12
|
+
const { label } = await readValidatedBody(event, keyCreateSchema.parse);
|
|
13
|
+
return await rotateKey(event, id, keyId, label);
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { keyIdParams } from "../../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../../../utils/authz.js";
|
|
4
|
+
import { keyBelongsToService, revokeKey } from "../../../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.manage");
|
|
7
|
+
const { id, keyId } = await getValidatedRouterParams(event, keyIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
if (!await keyBelongsToService(keyId, id)) {
|
|
10
|
+
throw createError({ statusCode: 404, statusMessage: "Key not found" });
|
|
11
|
+
}
|
|
12
|
+
await revokeKey(keyId);
|
|
13
|
+
return { ok: true };
|
|
14
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams } from "h3";
|
|
2
|
+
import { serviceIdParams } from "../../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../../../utils/authz.js";
|
|
4
|
+
import { listKeyMeta } from "../../../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.manage");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
return await listKeyMeta(id);
|
|
10
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, readValidatedBody } from "h3";
|
|
2
|
+
import { serviceIdParams, keyCreateSchema } from "../../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../../../utils/authz.js";
|
|
4
|
+
import { mintKey } from "../../../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.manage");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
const { label } = await readValidatedBody(event, keyCreateSchema.parse);
|
|
10
|
+
return await mintKey(event, id, label);
|
|
11
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ServiceDetail } from '../../../../../shared/schema/provisioning.js';
|
|
2
|
+
/** Undo a soft-delete before the retention window elapses. Admin-only (services.create). */
|
|
3
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<ServiceDetail>>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { serviceIdParams } from "../../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability } from "../../../../utils/authz.js";
|
|
4
|
+
import { restoreServiceById } from "../../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
await requireCapability(event, "services.create");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
const restored = await restoreServiceById(id);
|
|
9
|
+
if (!restored) throw createError({ statusCode: 404, statusMessage: "Service not found" });
|
|
10
|
+
return restored;
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soft-delete: the service leaves the active list immediately but is recoverable via
|
|
3
|
+
* the restore route until the retention window elapses (see SERVICE_DELETE_RETENTION_MS).
|
|
4
|
+
* Admin-only (services.create) since there is no separate services.delete capability.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
7
|
+
ok: true;
|
|
8
|
+
deletedAt: number;
|
|
9
|
+
purgeAt: number;
|
|
10
|
+
}>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { serviceIdParams } from "../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
4
|
+
import { softDeleteServiceById } from "../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
await requireCapability(event, "services.create");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
const result = await softDeleteServiceById(id);
|
|
9
|
+
if (!result) throw createError({ statusCode: 404, statusMessage: "Service not found" });
|
|
10
|
+
return { ok: true, deletedAt: result.deletedAt, purgeAt: result.purgeAt };
|
|
11
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { serviceIdParams } from "../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../utils/authz.js";
|
|
4
|
+
import { getServiceDetail } from "../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.read");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
const detail = await getServiceDetail(id);
|
|
10
|
+
if (!detail) throw createError({ statusCode: 404, statusMessage: "Service not found" });
|
|
11
|
+
return detail;
|
|
12
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { serviceIdParams, serviceUpdateSchema } from "../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability, assertServiceInScope } from "../../../utils/authz.js";
|
|
4
|
+
import { updateServiceFromInput } from "../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.manage");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, serviceIdParams.parse);
|
|
8
|
+
await assertServiceInScope(event, principal, id);
|
|
9
|
+
const patch = await readValidatedBody(event, serviceUpdateSchema.parse);
|
|
10
|
+
const updated = await updateServiceFromInput(id, patch);
|
|
11
|
+
if (!updated) throw createError({ statusCode: 404, statusMessage: "Service not found" });
|
|
12
|
+
return updated;
|
|
13
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { defineEventHandler } from "h3";
|
|
2
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
3
|
+
import { listServicesForPrincipal } from "../../../utils/provisioning.js";
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
const { principal } = await requireCapability(event, "services.read");
|
|
6
|
+
return await listServicesForPrincipal(event, principal);
|
|
7
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineEventHandler, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { serviceCreateSchema } from "../../../../shared/schema/provisioning.js";
|
|
3
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
4
|
+
import { createServiceFromInput } from "../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
const { principal } = await requireCapability(event, "services.create");
|
|
7
|
+
const input = await readValidatedBody(event, serviceCreateSchema.parse);
|
|
8
|
+
try {
|
|
9
|
+
return await createServiceFromInput(input, principal);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
if (e instanceof Error && /UNIQUE/i.test(e.message)) {
|
|
12
|
+
throw createError({ statusCode: 409, statusMessage: "Service slug already exists" });
|
|
13
|
+
}
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedQuery, createError, H3Error } from "h3";
|
|
2
|
+
import { statsQuerySchema } from "../../../shared/schema/stats.js";
|
|
3
|
+
import { periodToRange } from "../../../shared/utils/period.js";
|
|
4
|
+
import { requireCapability, getAllowedServiceIds } from "../../utils/authz.js";
|
|
5
|
+
import { resolveEffectiveScope } from "../../utils/scope.js";
|
|
6
|
+
import { getStats, emptyStats, DEFAULT_BUCKET_MS, MAX_BUCKETS } from "../../utils/stats-query.js";
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
const { principal } = await requireCapability(event, "stats.read");
|
|
9
|
+
const { period, service, group, version, level, bucketMs } = await getValidatedQuery(event, statsQuerySchema.parse);
|
|
10
|
+
const allowed = await getAllowedServiceIds(event, principal);
|
|
11
|
+
const effective = await resolveEffectiveScope(event, principal, allowed, { service, group });
|
|
12
|
+
const { from, to, label } = periodToRange(period);
|
|
13
|
+
const bucket = bucketMs ?? DEFAULT_BUCKET_MS[period];
|
|
14
|
+
if ((to - from) / bucket > MAX_BUCKETS) {
|
|
15
|
+
throw createError({ statusCode: 400, statusMessage: "bucketMs too small for window" });
|
|
16
|
+
}
|
|
17
|
+
const scope = {
|
|
18
|
+
serviceIds: effective === "*" ? [] : effective,
|
|
19
|
+
isAll: effective === "*"
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
const data = effective !== "*" && effective.length === 0 ? emptyStats(from, to, bucket) : await getStats(effective, from, to, bucket, { version, level });
|
|
23
|
+
return { period: { from, to, label }, scope, bucketMs: bucket, ...data };
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (e instanceof H3Error) throw e;
|
|
26
|
+
throw createError({ statusCode: 500, statusMessage: "Stats query failed" });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { userIdParams, userAssignmentsSchema } from "../../../../../shared/auth/schema.js";
|
|
3
|
+
import { requireCapability } from "../../../../utils/authz.js";
|
|
4
|
+
import { getUserById, setUserAssignments } from "../../../../utils/db/users.js";
|
|
5
|
+
import { getUserDetail } from "../../../../utils/provisioning.js";
|
|
6
|
+
export default defineEventHandler(async (event) => {
|
|
7
|
+
await requireCapability(event, "users.manage");
|
|
8
|
+
const { id } = await getValidatedRouterParams(event, userIdParams.parse);
|
|
9
|
+
const input = await readValidatedBody(event, userAssignmentsSchema.parse);
|
|
10
|
+
const target = await getUserById(id);
|
|
11
|
+
if (!target) throw createError({ statusCode: 404, statusMessage: "User not found" });
|
|
12
|
+
await setUserAssignments(id, input);
|
|
13
|
+
return await getUserDetail(id);
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { userIdParams } from "../../../../shared/auth/schema.js";
|
|
3
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
4
|
+
import { getUserById, deleteUser, countAdmins } from "../../../utils/db/users.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
await requireCapability(event, "users.manage");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, userIdParams.parse);
|
|
8
|
+
const target = await getUserById(id);
|
|
9
|
+
if (!target) throw createError({ statusCode: 404, statusMessage: "User not found" });
|
|
10
|
+
if (target.role === "admin" && !target.disabled && await countAdmins() <= 1) {
|
|
11
|
+
throw createError({ statusCode: 409, statusMessage: "Cannot delete the last admin", data: { error: "LAST_ADMIN" } });
|
|
12
|
+
}
|
|
13
|
+
await deleteUser(id);
|
|
14
|
+
return { ok: true };
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, createError } from "h3";
|
|
2
|
+
import { userIdParams } from "../../../../shared/auth/schema.js";
|
|
3
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
4
|
+
import { getUserDetail } from "../../../utils/provisioning.js";
|
|
5
|
+
export default defineEventHandler(async (event) => {
|
|
6
|
+
await requireCapability(event, "users.manage");
|
|
7
|
+
const { id } = await getValidatedRouterParams(event, userIdParams.parse);
|
|
8
|
+
const detail = await getUserDetail(id);
|
|
9
|
+
if (!detail) throw createError({ statusCode: 404, statusMessage: "User not found" });
|
|
10
|
+
return detail;
|
|
11
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineEventHandler, getValidatedRouterParams, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { hashPassword } from "#imports";
|
|
3
|
+
import { userIdParams, patchUserSchema } from "../../../../shared/auth/schema.js";
|
|
4
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
5
|
+
import { getUserById, updateUser, countAdmins } from "../../../utils/db/users.js";
|
|
6
|
+
import { getUserDetail } from "../../../utils/provisioning.js";
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
await requireCapability(event, "users.manage");
|
|
9
|
+
const { id } = await getValidatedRouterParams(event, userIdParams.parse);
|
|
10
|
+
const patch = await readValidatedBody(event, patchUserSchema.parse);
|
|
11
|
+
const target = await getUserById(id);
|
|
12
|
+
if (!target) throw createError({ statusCode: 404, statusMessage: "User not found" });
|
|
13
|
+
const isEnabledAdmin = target.role === "admin" && !target.disabled;
|
|
14
|
+
const willLoseAdmin = patch.role !== void 0 && patch.role !== "admin" || patch.disabled === true;
|
|
15
|
+
if (isEnabledAdmin && willLoseAdmin && await countAdmins() <= 1) {
|
|
16
|
+
throw createError({ statusCode: 409, statusMessage: "Cannot remove the last admin", data: { error: "LAST_ADMIN" } });
|
|
17
|
+
}
|
|
18
|
+
await updateUser(id, {
|
|
19
|
+
...patch.displayName !== void 0 ? { displayName: patch.displayName } : {},
|
|
20
|
+
...patch.role !== void 0 ? { role: patch.role } : {},
|
|
21
|
+
...patch.disabled !== void 0 ? { disabled: patch.disabled } : {},
|
|
22
|
+
...patch.password !== void 0 ? { passwordHash: await hashPassword(patch.password) } : {}
|
|
23
|
+
});
|
|
24
|
+
return await getUserDetail(id);
|
|
25
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UserPick } from '../../../../shared/schema/provisioning.js';
|
|
2
|
+
/**
|
|
3
|
+
* Admin-only user list. Data source follows the active provider: DB rows when the db provider
|
|
4
|
+
* is active, config-seeded users (observe.auth.users) otherwise. Same UserPick wire shape
|
|
5
|
+
* either way, so the CP11 composable + UI are reused rather than forked.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<UserPick[]>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { defineEventHandler } from "h3";
|
|
2
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
3
|
+
import { listUsers, listDbUsers, isDbProviderActive } from "../../../utils/provisioning.js";
|
|
4
|
+
export default defineEventHandler(async (event) => {
|
|
5
|
+
await requireCapability(event, "users.manage");
|
|
6
|
+
return isDbProviderActive() ? await listDbUsers() : listUsers();
|
|
7
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineEventHandler, readValidatedBody, createError } from "h3";
|
|
2
|
+
import { hashPassword } from "#imports";
|
|
3
|
+
import { createUserSchema } from "../../../../shared/auth/schema.js";
|
|
4
|
+
import { requireCapability } from "../../../utils/authz.js";
|
|
5
|
+
import { getUserByUsername, createUser } from "../../../utils/db/users.js";
|
|
6
|
+
import { getUserDetail } from "../../../utils/provisioning.js";
|
|
7
|
+
export default defineEventHandler(async (event) => {
|
|
8
|
+
const { principal } = await requireCapability(event, "users.manage");
|
|
9
|
+
const input = await readValidatedBody(event, createUserSchema.parse);
|
|
10
|
+
if (await getUserByUsername(input.username)) {
|
|
11
|
+
throw createError({ statusCode: 409, statusMessage: "Username already exists", data: { error: "DUPLICATE_USERNAME" } });
|
|
12
|
+
}
|
|
13
|
+
const passwordHash = input.password ? await hashPassword(input.password) : null;
|
|
14
|
+
try {
|
|
15
|
+
const row = await createUser({
|
|
16
|
+
username: input.username,
|
|
17
|
+
displayName: input.displayName ?? null,
|
|
18
|
+
role: input.role,
|
|
19
|
+
passwordHash,
|
|
20
|
+
createdBy: principal.sub
|
|
21
|
+
});
|
|
22
|
+
return await getUserDetail(row.id);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
if (e instanceof Error && /UNIQUE/i.test(e.message)) {
|
|
25
|
+
throw createError({ statusCode: 409, statusMessage: "Username already exists", data: { error: "DUPLICATE_USERNAME" } });
|
|
26
|
+
}
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AuthorizationStore } from '../../shared/auth/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Identity store: the principal already carries its assignment (built by the provider),
|
|
4
|
+
* so CP5 returns it verbatim. CP16's db store will look this up by principal.sub; CP6
|
|
5
|
+
* adds capability checks (the roles.ts matrix) here / in require-observe-session.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ConfigAuthorizationStore: AuthorizationStore;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuthProvider } from '../../shared/auth/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the configured PRIMARY provider once per process. runtimeConfig.observe.auth.provider
|
|
4
|
+
* selects it. This file is Nitro-only (never node-unit-imported), so importing the ambient
|
|
5
|
+
* hashPassword/verifyPassword from '#imports' is safe here; they are then INJECTED into the
|
|
6
|
+
* factories, which themselves stay '#imports'-free for node tests (CP5-HANDOFF §3.4).
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAuthProvider(): AuthProvider;
|
|
9
|
+
/**
|
|
10
|
+
* The JWT provider consulted by the Bearer fallback (require-observe-session.ts) REGARDLESS
|
|
11
|
+
* of which primary provider is selected, whenever `observe.auth.jwt.enabled`. Memoised
|
|
12
|
+
* separately from the primary so a `provider:'db'` install can still accept Bearer tokens.
|
|
13
|
+
* Returns null when JWT is not enabled.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getJwtAuthProvider(): AuthProvider | null;
|
|
16
|
+
/** Test-only: drop the memoized singletons between fixtures. */
|
|
17
|
+
export declare function __resetAuthProviderForTests(): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
2
|
+
import { hashPassword, verifyPassword } from "#imports";
|
|
3
|
+
import { createConfigAuthProvider } from "./providers/config-provider.js";
|
|
4
|
+
import { createDbAuthProvider } from "./providers/db-provider.js";
|
|
5
|
+
import { createJwtAuthProvider } from "./providers/jwt-provider.js";
|
|
6
|
+
let _provider;
|
|
7
|
+
let _jwtProvider;
|
|
8
|
+
function authRuntime() {
|
|
9
|
+
return useRuntimeConfig().observe.auth ?? {};
|
|
10
|
+
}
|
|
11
|
+
export function getAuthProvider() {
|
|
12
|
+
if (_provider) return _provider;
|
|
13
|
+
const auth = authRuntime();
|
|
14
|
+
switch (auth.provider ?? "config") {
|
|
15
|
+
case "db":
|
|
16
|
+
_provider = createDbAuthProvider({
|
|
17
|
+
hashPassword,
|
|
18
|
+
verifyPassword,
|
|
19
|
+
// The config user seed becomes the gated bootstrap-admin fallback (roles.ts lifecycle).
|
|
20
|
+
configFallback: createConfigAuthProvider({ users: auth.users ?? [], hashPassword, verifyPassword })
|
|
21
|
+
});
|
|
22
|
+
break;
|
|
23
|
+
case "jwt":
|
|
24
|
+
_provider = createJwtAuthProvider(auth.jwt ?? {});
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
_provider = createConfigAuthProvider({
|
|
28
|
+
users: auth.users ?? [],
|
|
29
|
+
hashPassword,
|
|
30
|
+
verifyPassword
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return _provider;
|
|
34
|
+
}
|
|
35
|
+
export function getJwtAuthProvider() {
|
|
36
|
+
if (_jwtProvider !== void 0) return _jwtProvider;
|
|
37
|
+
const jwt = authRuntime().jwt;
|
|
38
|
+
_jwtProvider = jwt?.enabled ? createJwtAuthProvider(jwt) : null;
|
|
39
|
+
return _jwtProvider;
|
|
40
|
+
}
|
|
41
|
+
export function __resetAuthProviderForTests() {
|
|
42
|
+
_provider = void 0;
|
|
43
|
+
_jwtProvider = void 0;
|
|
44
|
+
}
|