Skip to content

feat(structures): add AuditLog structure#11402

Open
keston-dev wants to merge 5 commits intodiscordjs:mainfrom
keston-dev:feat/audit-log-structure
Open

feat(structures): add AuditLog structure#11402
keston-dev wants to merge 5 commits intodiscordjs:mainfrom
keston-dev:feat/audit-log-structure

Conversation

@keston-dev
Copy link

This PR will add the AuditLog structure and subsequent substructures.

This current commit has the AuditLogEntry and AuditLogOptions substructures.

Mentioning #10981 for visibility.

@vercel
Copy link

vercel bot commented Jan 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
discord-js Skipped Skipped Feb 21, 2026 5:26pm
discord-js-guide Skipped Skipped Feb 21, 2026 5:26pm

Request Review

@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 25, 2026 06:06 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 25, 2026 06:06 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 25, 2026 15:04 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 25, 2026 15:04 Inactive
@keston-dev keston-dev marked this pull request as ready for review January 25, 2026 15:04
@keston-dev keston-dev requested a review from a team as a code owner January 25, 2026 15:04
@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

Introduces a new audit log module containing three TypeScript classes—AuditLog, AuditLogEntry, and AuditLogOptions—that wrap Discord API audit log types. Classes extend a generic Structure base, provide typed constructors, and expose public property getters for accessing underlying API data with minimal transformation (e.g., timestamp conversion).

Changes

Cohort / File(s) Summary
Core Audit Log Classes
packages/structures/src/auditlog/AuditLog.ts, packages/structures/src/auditlog/AuditLogEntry.ts, packages/structures/src/auditlog/AuditLogOptions.ts
New generic classes extending Structure that wrap APIAuditLog, APIAuditLogEntry, and APIAuditLogOptions types; provide constructors and public getters for property access with timestamp derivation logic in AuditLogEntry
Module Exports
packages/structures/src/auditlog/index.ts, packages/structures/src/index.ts
New index file re-exporting the three audit log classes; main structures index updated to export the new auditlog module

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(structures): add AuditLog structure' accurately describes the main change: introducing a new AuditLog structure to the structures package.
Description check ✅ Passed The description is directly related to the changeset, explaining that the PR adds AuditLog structure and its substructures (AuditLogEntry and AuditLogOptions).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3550b49 and 018cf18.

📒 Files selected for processing (5)
  • packages/structures/src/auditlog/AuditLog.ts
  • packages/structures/src/auditlog/AuditLogEntry.ts
  • packages/structures/src/auditlog/AuditLogOptions.ts
  • packages/structures/src/auditlog/index.ts
  • packages/structures/src/index.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/structures/src/auditlog/AuditLogEntry.ts (3)
packages/structures/src/utils/symbols.ts (1)
  • kData (1-1)
packages/structures/src/utils/type-guards.ts (1)
  • isIdSet (1-3)
packages/discord.js/typings/index.d.ts (1)
  • DiscordSnowflake (3267-3267)
🔇 Additional comments (5)
packages/structures/src/auditlog/AuditLogOptions.ts (1)

12-99: LGTM: consistent raw-field accessors for audit log options.

The accessors cleanly mirror the API payload fields via the structure data symbol without unintended transformations.

packages/structures/src/auditlog/AuditLog.ts (1)

12-18: LGTM: minimal wrapper is clear and aligned with intent.

packages/structures/src/auditlog/AuditLogEntry.ts (1)

15-74: LGTM: getters and derived timestamp/date are clear and consistent.

packages/structures/src/auditlog/index.ts (1)

1-3: LGTM: clean aggregation of audit log exports.

packages/structures/src/index.ts (1)

1-1: LGTM: public export added in the right place.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 0% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.97%. Comparing base (3550b49) to head (018cf18).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/structures/src/auditlog/AuditLogOptions.ts 0.00% 24 Missing ⚠️
packages/structures/src/auditlog/AuditLogEntry.ts 0.00% 17 Missing ⚠️
packages/structures/src/auditlog/AuditLog.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11402      +/-   ##
==========================================
- Coverage   32.07%   31.97%   -0.11%     
==========================================
  Files         375      378       +3     
  Lines       13720    13763      +43     
  Branches     1078     1080       +2     
==========================================
  Hits         4401     4401              
- Misses       9184     9227      +43     
  Partials      135      135              
Flag Coverage Δ
structures 39.85% <0.00%> (-1.41%) ⬇️
voice 55.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* Represents an audit log entry on Discord.
*
* @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate`
* @remarks Intentionally does not export `changes` so that extending classes can resolve array to `AuditLogChange[]`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuditLogChange should be a substructure too and is missing completely

@github-project-automation github-project-automation bot moved this from Todo to Review in Progress in discord.js Jan 27, 2026
@vercel vercel bot temporarily deployed to Preview – discord-js February 21, 2026 17:26 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 21, 2026 17:26 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 21, 2026 17:26 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 21, 2026 17:26 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review in Progress

Development

Successfully merging this pull request may close these issues.

3 participants