Skip to main content

Migrating between v0

These are all the breaking changes in v0 and how to migrate between them

Breaking Changes 0.39.0

Functions Parameters

All TypeScript functions now use object parameters instead of regular parameters. This change affects channels and client generators across all protocols.

Before:

// Publishing
await jetStreamPublishToSendUserSignedup(message, parameters, js);
await publishToSendUserSignedup(message, parameters, connection);

// Subscribing
const subscriber = await jetStreamPullSubscribeToReceiveUserSignedup(
onDataCallback,
parameters,
js,
config
);

After:

// Publishing
await jetStreamPublishToSendUserSignedup({
message,
parameters,
js
});
await publishToSendUserSignedup({
message,
parameters,
connection
});

// Subscribing
const subscriber = await jetStreamPullSubscribeToReceiveUserSignedup({
onDataCallback,
parameters,
js,
config
});

Breaking Changes 0.55.1

We upgraded the AsyncAPI Modelina dependency to the next version so for the next few versions it will contain breaking changes as we continue to improve the tool.

Breaking Changes 0.61.0

Channels Multi-File Output

The channels generator now outputs one file per protocol instead of a single file with a Protocols object. This change improves tree-shaking, reduces bundle size, and provides better code organization.

Before (v0.60.x and earlier):

// Single file with Protocols object containing all protocols
import { Protocols } from './channels/index';
const { nats } = Protocols;
const { publishToSendUserSignedup, subscribeToReceiveUserSignedup } = nats;

// Or destructure directly
const { nats: { publishToSendUserSignedup } } = Protocols;

After (v0.61.0+):

// Option 1: Import specific functions directly from protocol file
import {
publishToSendUserSignedup,
subscribeToReceiveUserSignedup
} from './channels/nats';

// Option 2: Import the entire protocol as a namespace
import * as nats from './channels/nats';
nats.publishToSendUserSignedup({ ... });

// Option 3: Import from index (protocols are re-exported as namespaces)
import { nats, kafka, mqtt } from './channels/index';
nats.publishToSendUserSignedup({ ... });

New file structure:

outputPath/
├── index.ts # Re-exports all protocol namespaces
├── nats.ts # NATS-specific functions
├── kafka.ts # Kafka-specific functions
├── mqtt.ts # MQTT-specific functions
├── amqp.ts # AMQP-specific functions
├── event_source.ts # EventSource-specific functions
├── http_client.ts # HTTP client-specific functions
└── websocket.ts # WebSocket-specific functions

Migration steps:

  1. Replace import { Protocols } from './channels' with direct imports from protocol files
  2. Remove destructuring of the Protocols object
  3. Update function calls - functions are now standalone exports, not object properties
  4. Optionally use namespace imports (import * as nats from './channels/nats') to keep similar syntax