Migration from version 3.x

This chapter provides a set of guidelines to help you migrate from Marble.js version 3.x to the latest 4.x version.

The newest iteration comes with some API breaking change, but don’t worry, these are not game-changers, but rather convenient improvements that open the doors to new future possibilities. During the development process, the goal was to notify and discuss incoming changes within the community as early as possible. You can check here what has changed since the latest version.

For more detailed info about more low-level improvements, please visit release candidate changelog.

@marblejs/core

Legacy EffectFactory builder is no longer available. Please user r builder instead.

Legacy switchToProtocol operator is no longer available.

@marblejs/http

Moved HTTP-related API's from @marblejs/core to new package @marblejs/http, eg.

❌ Old (example):

import { HttpRequest, HttpEffect, useContext } from '@marblejs/core';

✅ New (example):

import { useContext } from '@marblejs/core';
import { HttpRequest, HttpEffect } from '@marblejs/http';

HttpOutputEffect - Improved interface

❌ Old:

Observable<{ req, res: { status, body, headers } }>
  -> Observable<{ status, body, headers }>

✅ New:

Observable<{ status, body, headers, request }>
  -> Observable<{ status, body, headers, request }>

HttpErrorEffect - Improved interface

❌ Old:

Observable<{ req, error }>
  -> Observable<{ status, body, headers }>

✅ New:

Observable<{ error, request }>
  -> Observable<{ status, body, headers, request }>

@marblejs/messaging

❌ Old:

import { messagingClient, eventBus, eventBusClient } from '@marblejs/messaging';

✅ New:

import { MessagingClient, EventBus, EventBusClient } from '@marblejs/messaging';

@marblejs/websockets

Version 4.x removes deprecated legacy connection$ attribute. Please use HTTP upgrade event for checking connections.

@marblejs-contrib/middleware-joi

❌ Old:

npm i @marblejs/middleware-joi

✅ New:

npm i @marblejs-contrib/middleware-joi

@marblejs-contrib/middleware-jwt

❌ Old:

npm i @marblejs/middleware-jwt

✅ New:

npm i @marblejs-contrib/middleware-jwt

Last updated