materialisation: Added new message fields.
To support the work related to materialization, this pull request introduces new message fields and actions handling.
Added MessageAction enum to represent different message actions.
Added serial to the message, this is the unique serial (including index) of the message.
Publish now correctly sets the message action to message_create
- Added the following fields related to message annotations
refSerialrefType
- Added the following fields related to message updates/deletes
operationupdatedAtdeletedAt
This PR will need to wait until the related realtime work is done to support the new action fields in published messages. (ongoing)
Related to CHA-575
Summary by CodeRabbit
-
New Features
- Enhanced message structure with new properties for better tracking of message states and actions.
- Introduced new
Operationinterface for detailed message operations. - Added functionality for action-based message creation in the publishing process.
- New functions for converting message action types and improved message creation methods.
-
Bug Fixes
- Improved error handling in the message publishing method to ensure type conformity.
-
Documentation
- Updated method signatures and added new functions for improved message handling.
-
Chores
- Refactored imports and method implementations for clarity and organization.
- Enhanced test suite for better validation of message encoding, decoding, and encryption processes.
- Adjusted thresholds for minimal useful Realtime bundle size in module reporting.
- editedAt
Not updatedAt ? https://docs.google.com/document/d/14yBHC7Nkh6YkDneTauqkPSNEw2YVCvZNr_RplMvm40I/edit#heading=h.5df1tga3tfjx
- editedAt
Not
updatedAt? https://docs.google.com/document/d/14yBHC7Nkh6YkDneTauqkPSNEw2YVCvZNr_RplMvm40I/edit#heading=h.5df1tga3tfjx
This was just a mistype in the PR body, the code uses updatedAt and I have now corrected the typo.
Walkthrough
The pull request introduces extensive updates to the Ably library's type definitions and message handling functionalities. Key enhancements include the addition of new properties and interfaces in ably.d.ts, particularly for the Message and InboundMessage interfaces, along with a new Operation interface. The RestChannel class's publish method is modified to restore functionality for message creation. Other files, such as message.ts and defaultmessage.ts, see improvements in message action handling and serialization. Additionally, test cases are updated to ensure robustness in message encoding and decoding.
Changes
| File Path | Change Summary |
|---|---|
| ably.d.ts | Enhanced Message and InboundMessage interfaces; added Operation interface and new properties. |
| src/common/lib/client/restchannel.ts | Restored fromValues and fromValuesArray imports; updated publish method for message creation. |
| src/common/lib/types/defaultmessage.ts | Reorganized imports; updated fromValues method to accept an optional options parameter. |
| src/common/lib/types/message.ts | Added MessageActionArray, conversion functions, and updated fromValues method with new properties. |
| src/common/lib/types/protocolmessage.ts | Updated fromDeserialized function to include stringifyAction parameter in message processing. |
| test/realtime/crypto.test.js | Updated message decoding logic and error handling; expanded tests for cipher key management. |
| scripts/moduleReport.ts | Adjusted thresholds for minimal useful Realtime bundle size. |
| package.json | Added new script entry "test:grep" for selective test execution. |
| test/realtime/message.test.js | Introduced new test suite for DefaultMessage.fromValues focusing on stringification of actions. |
| test/support/runPlaywrightTests.js | Modified runTests function to include grep parameter for filtering test results. |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Support Operations in Messages (CHA-575) | ✅ |
🐰 In the land of code so bright,
New messages take joyful flight.
With actions clear and types refined,
Our library's magic is now aligned!
So hop along, let tests run free,
For every change brings glee to me! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.