chore: migrate audit DDP methods to /v1/audit.* REST endpoints (EE)#40736
chore: migrate audit DDP methods to /v1/audit.* REST endpoints (EE)#40736ggazzo wants to merge 2 commits into
Conversation
Added three new REST endpoints (EE-only, license: auditing) covering the audit flows that previously only existed as DDP methods: - GET /v1/audit.auditions (auditGetAuditions) - POST /v1/audit.messages (auditGetMessages) - POST /v1/audit.omnichannel.messages (auditGetOmnichannelMessages) Method bodies extracted into apps/meteor/ee/server/lib/audit/functions.ts and reused by both DDP entrypoints (now thin + deprecation-logged) and the new REST handlers. Each REST endpoint: - requires the same per-action permission (can-audit / can-audit-log). - is rate-limited at 10/60s matching the DDP DDPRateLimiter rules. - writes the same AuditLog entry the DDP path produced. - accepts dates as ISO strings on the wire (parsed server-side). Client AuditLogTable + useAuditMutation swapped from useMethod to useEndpoint; date params serialized via toISOString(). DDP methods stay registered with deprecation logs pointing at the new routes until 9.0.0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 4a5e8a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40736 +/- ##
===========================================
- Coverage 69.76% 69.74% -0.02%
===========================================
Files 3327 3327
Lines 123134 123134
Branches 21963 21955 -8
===========================================
- Hits 85902 85881 -21
- Misses 33873 33893 +20
- Partials 3359 3360 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
- Add response schemas to /v1/audit.{auditions,messages,omnichannel.messages}
so TypedOptions infers queryParams/bodyParams correctly.
- mapMessageFromApi() each REST message in useAuditMutation so caller
AuditResult receives IMessage[] (Date) instead of Serialized<IMessage>[].
- Cast AuditLogEntry value through unknown→IAuditLog since the REST
response carries dates as strings while the consumer reads IAuditLog
(the component formats the Date itself, so the cast is just to satisfy
TS — same pattern other audit-adjacent code uses).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Continues the DDP→REST sweep (#40659, #40711, #40675, #40724, #40728, #40734). This batch migrates the three
auditGet*DDP methods that backed the EE audit panel. DDP methods stay registered for external SDK/mobile clients with deprecation logs pointing at the new routes.New endpoints (EE —
auditinglicense required)auditGetAuditionsGET /v1/audit.auditionscan-audit-log?startDate=&endDate=(ISO)auditGetMessagesPOST /v1/audit.messagescan-audit{ rid?, startDate, endDate, users, msg, type, visitor?, agent? }auditGetOmnichannelMessagesPOST /v1/audit.omnichannel.messagescan-audit{ startDate, endDate, users, msg, type, visitor?, agent? }Each endpoint is rate-limited at 10/60s (matching the DDP
DDPRateLimiterrules) and writes the sameAuditLogentry the DDP path produced. Dates are serialized as ISO strings on the wire.Implementation
apps/meteor/ee/server/lib/audit/functions.ts; DDP entrypoints become thin + deprecation-logged.messagesandomnichannel.messagesarePOSTbecause the audit log insertion is a side effect (write) and the query params include arrays (users) that don't serialize cleanly into query strings.Client changes
AuditLogTable→useEndpoint('GET', '/v1/audit.auditions')useAuditMutation→useEndpoint('POST', '/v1/audit.messages')+useEndpoint('POST', '/v1/audit.omnichannel.messages').toISOString().Test plan
can-audit-logperm) → past entries rendercurland confirm 403 without license/permission, 200 with both🤖 Generated with Claude Code