Skip to content

DataStore extends NanoEmitter & many events#25

Merged
Sv443 merged 2 commits intomainfrom
develop
Mar 2, 2026
Merged

DataStore extends NanoEmitter & many events#25
Sv443 merged 2 commits intomainfrom
develop

Conversation

@Sv443
Copy link
Copy Markdown
Member

@Sv443 Sv443 commented Mar 2, 2026

No description provided.

@Sv443 Sv443 self-assigned this Mar 2, 2026
@Sv443 Sv443 added the enhancement New feature or request label Mar 2, 2026
@Sv443 Sv443 requested a review from Copilot March 2, 2026 12:59
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 2, 2026

Pull Request Test Coverage Report for Build 22577657716

Details

  • 40 of 51 (78.43%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.5%) to 95.126%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/DataStore.ts 40 51 78.43%
Files with Coverage Reduction New Missed Lines %
lib/DataStoreEngine.ts 1 93.15%
Totals Coverage Status
Change from base Build 22528962241: -0.5%
Covered Lines: 1203
Relevant Lines: 1229

💛 - Coveralls

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes DataStore event-driven by having it extend NanoEmitter, adds a strongly-typed DataStoreEventMap, emits events throughout key lifecycle operations (load/update/migrate/delete/errors), and documents/tests the new event surface.

Changes:

  • DataStore now extends NanoEmitter and emits events like loadData, updateData(Sync), migrateData, migrateId, deleteData, error, and migrationError.
  • Added extensive Vitest coverage for the new event emissions.
  • Updated documentation and added a changeset describing the new event API.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/DataStore.ts Makes DataStore extend NanoEmitter, defines DataStoreEventMap, and emits events across operations.
lib/test/DataStore.spec.ts Adds tests asserting correct event emission behavior for load/update/migration/error flows.
docs.md Documents DataStore’s inheritance from NanoEmitter, adds events section and DataStoreEventMap docs.
lib/test/other/userutils_v9_datastore_migration_test/gm_polyfill.js Improves module JSDoc and clarifies storage key prefix usage for tests.
.changeset/wild-cycles-thank.md Announces the new DataStore event API as a minor version change.

@Sv443 Sv443 merged commit f7dbacf into main Mar 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants