build: rxjs upgrade - replaced deprecated  `flatMap` with `mergeMap`
MODIFY
packages/middleware-joi/src/validator.middleware.ts
packages/middleware-joi/src/validator.middleware.ts
@@ -4,14 +4,14 @@ import * as Joi from 'joi';
import './validator.interface';
import { HttpRequest, HttpError, HttpStatus } from '@marblejs/core';
import { from, of, throwError, Observable } from 'rxjs';
-import { mergeMap, flatMap, catchError, mapTo, switchMap, toArray, map } from 'rxjs/operators';
+import { mergeMap, catchError, mapTo, switchMap, toArray, map } from 'rxjs/operators';
import { Schema, SchemaValidator } from './validator.schema';
import { ExtractedBody, ExtractedParams, ExtractedQuery } from './validator.interface';
const validateSource = (rules: Map<string, any>, options: Joi.ValidationOptions) => (req: HttpRequest) =>
from(rules.keys()).pipe(
mergeMap(rule => of(req[rule]).pipe(
- flatMap(item =>
+ mergeMap(item =>
from(Joi.validate(item || {}, rules.get(rule), options)).pipe(
catchError((err: Joi.ValidationError) => {
const message = err.details[0].message;

MODIFY
packages/middleware-jwt/src/spec/jwt.middleware.spec.ts
packages/middleware-jwt/src/spec/jwt.middleware.spec.ts
@@ -2,11 +2,11 @@ import { HttpRequest, HttpError, HttpStatus } from '@marblejs/core';
import { createMockEffectContext } from '@marblejs/core/dist/+internal/testing';
import { authorize$ } from '@marblejs/middleware-jwt/src/jwt.middleware';
import { of, throwError, iif } from 'rxjs';
-import { flatMap } from 'rxjs/operators';
+import { mergeMap } from 'rxjs/operators';
const verifyPayload$ = (payload: { id: string }) =>
of(payload).pipe(
- flatMap(payload => iif(
+ mergeMap(payload => iif(
() => payload.id !== 'test_id',
throwError(() => new Error()),
of(payload)

MODIFY
packages/middleware-jwt/test/jwt.integration.ts
packages/middleware-jwt/test/jwt.integration.ts
-import { httpListener, EffectFactory, combineRoutes } from '@marblejs/core';
+import { httpListener, r, combineRoutes } from '@marblejs/core';
import { bodyParser$ } from '@marblejs/middleware-body';
-import { map, flatMap } from 'rxjs/operators';
+import { map, mergeMap } from 'rxjs/operators';
import { of, iif, throwError } from 'rxjs';
import { authorize$ as authorizeMiddleware$, generateToken } from '../src';
@@ -11,7 +11,7 @@ export const SECRET_KEY = 'SOME_SSH_KEY';
const verifyPayload$ = (payload: Payload) =>
of(payload).pipe(
- flatMap(payload => iif(
+ mergeMap(payload => iif(
() => payload.id !== 'test_id' || payload.email !== 'admin@admin.com',
throwError(() => new Error()),
of(payload)
@@ -22,22 +22,22 @@ const authOptions = { secret: SECRET_KEY };
const authorize$ = authorizeMiddleware$(authOptions, verifyPayload$);
const generateFakeJWTPayload = ({ email }: LoginCredentials): Payload => ({ id: 'test_id', email });
-const login$ = EffectFactory
- .matchPath('/login')
- .matchType('POST')
- .use(req$ => req$.pipe(
+const login$ = r.pipe(
+ r.matchPath('/login'),
+ r.matchType('POST'),
+ r.useEffect(req$ => req$.pipe(
map(req => req.body as LoginCredentials),
map(generateFakeJWTPayload),
map(generateToken({ secret: SECRET_KEY })),
map(token => ({ body: { token } })),
- ));
+ )));
-const securedRoot$ = EffectFactory
- .matchPath('/')
- .matchType('GET')
- .use(req$ => req$.pipe(
+const securedRoot$ = r.pipe(
+ r.matchPath('/'),
+ r.matchType('GET'),
+ r.useEffect(req$ => req$.pipe(
map(req => ({ body: req.user })),
- ));
+ )));
const secured$ = combineRoutes('/secured', {
effects: [securedRoot$],

build: rxjs upgrade - replaced deprecated  `flatMap` with `mergeMap`