Skip to content

Conversation

@bryanlundberg
Copy link
Member

@bryanlundberg bryanlundberg commented May 13, 2025

Protocol methods adapted

  • add
  • set
  • update
  • get
  • getAll
  • populate
  • populateCollection
  • count
  • exist

Add redaxios as a new dependency in package.json for handling HTTP requests. This lightweight alternative to Axios is expected to enhance functionality while maintaining a small bundle size.
Introduce support for server-based operations by parsing a provided URI in the constructor. Add `serverRequest` method utilizing `redaxios` for handling requests to a remote server when `host`, `applicationId`, and `projectId` are provided.
@netlify
Copy link

netlify bot commented May 13, 2025

Deploy Preview for narodb ready!

Name Link
🔨 Latest commit 97bd5bb
🔍 Latest deploy log https://app.netlify.com/sites/narodb/deploys/68235c22fc70690008f648be
😎 Deploy Preview https://deploy-preview-9--narodb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bryanlundberg bryanlundberg marked this pull request as draft May 13, 2025 12:51
Updated references of applicationId to orgId for clarity and consistency with the URI parameters in the Naro class. Adjusted constructor, serverRequest, and related logic to reflect this change without altering functionality.
Introduce a condition to handle `getAll` requests via `serverRequest` when a host is defined. This enables fetching data directly from the server, enhancing the method's versatility.
Converted getStructuredCollections to an async function to support server-side requests when a host is present. Fallbacks to core implementation if no host is provided.
Previously, the populate method did not account for cases where a host property was set, potentially causing incorrect behavior. This fix ensures the method uses a server request in such cases, improving functionality and consistency.
Removed redundant blank lines for consistency and added a missing server request in the get method to handle remote fetching correctly. This resolves potential issues when the host is defined.
Add a check to enforce the presence of a collection ID in the update method. Also, handle server-side updates when a host is specified, improving robustness and error handling.
Add a check to throw an error if the collection ID is missing. Also, handle delete requests through `serverRequest` when a host is defined. This prevents unexpected behavior and ensures robust error handling.
Ensure the `exists` method validates the presence of collection ID before proceeding. Added an additional condition to handle requests when
If a host is present, the count method now sends a server request before defaulting to local collection handling. This enhances functionality for remote-hosted scenarios.
Enhances the clear method to handle server requests when a host is present. Falls back to existing behavior when no host is detected.
@bryanlundberg bryanlundberg marked this pull request as ready for review May 13, 2025 14:48
Updated `getStructuredCollections` to be awaited in the test to ensure proper handling of asynchronous behavior. This change improves test reliability and accuracy.
@bryanlundberg bryanlundberg merged commit 5adde5a into main May 14, 2025
6 checks passed
@bryanlundberg bryanlundberg deleted the protocol-service branch May 14, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants