Skip to content

Add missing exports to amqp-websocket-client.ts for consistent browser/Node.js API#147

Merged
baelter merged 2 commits intomainfrom
copilot/add-websocket-client-exports
Sep 9, 2025
Merged

Add missing exports to amqp-websocket-client.ts for consistent browser/Node.js API#147
baelter merged 2 commits intomainfrom
copilot/add-websocket-client-exports

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 9, 2025

The websocket client was missing key exports that are available in the main index, making it difficult to build or enhance queue behavior in browser environments. This change adds the missing exports to provide feature parity between browser and Node.js usage.

Problem

Currently, users working with the WebSocket client in browsers couldn't access core classes needed for extending functionality:

// This works in Node.js
import { AMQPQueue, AMQPConsumer, AMQPError } from '@cloudamqp/amqp-client';

// But this was not possible for WebSocket users
import { AMQPQueue, AMQPConsumer, AMQPError } from '@cloudamqp/amqp-client/amqp-websocket-client';
// ❌ These exports didn't exist

Solution

Added the following exports to amqp-websocket-client.ts:

  • AMQPBaseClient
  • AMQPChannel
  • AMQPConsumer
  • AMQPError
  • AMQPMessage
  • AMQPQueue
  • AMQPView
  • VERSION

Usage

Users can now build enhanced queue behavior consistently across environments:

import { 
  AMQPWebSocketClient, 
  AMQPQueue, 
  AMQPConsumer,
  VERSION 
} from '@cloudamqp/amqp-client/amqp-websocket-client';

class EnhancedQueue extends AMQPQueue {
  // Custom queue behavior implementation
  async publish(body, properties = {}) {
    // Add custom logic (logging, validation, etc.)
    return super.publish(body, properties);
  }
}

The changes are minimal and purely additive - only 17 lines added across 2 files with no breaking changes to existing functionality.

Fixes #145.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 9, 2025

@baelter 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Co-authored-by: baelter <1399369+baelter@users.noreply.github.com>
Copilot AI changed the title [WIP] Exported elements are different for browser and nodes Add missing exports to amqp-websocket-client.ts for consistent browser/Node.js API Sep 9, 2025
Copilot AI requested a review from baelter September 9, 2025 11:29
@baelter baelter marked this pull request as ready for review September 9, 2025 11:42
@baelter baelter merged commit 490094c into main Sep 9, 2025
12 checks passed
@baelter baelter deleted the copilot/add-websocket-client-exports branch September 9, 2025 11:46
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.

Exported elements are different for browser and nodes

2 participants