@marblejs/core
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -5,3 +5,3 @@ "use strict"; | ||
const operators_1 = require("rxjs/operators"); | ||
const matchPath_operator_1 = require("../operators/matchPath.operator"); | ||
const operators_2 = require("../operators"); | ||
const effects_helpers_1 = require("./effects.helpers"); | ||
@@ -11,3 +11,3 @@ exports.combineEffects = effects => res => req => { | ||
const mappedEffects = effects.map(effect => effects_helpers_1.isGroup(effect) | ||
? req$.pipe(matchPath_operator_1.matchPath(effect.path, { suffix: '/:foo*', combiner: true }), operators_1.mergeMap(exports.combineEffects(effect.effects)(res))) | ||
? req$.pipe(operators_2.matchPath(effect.path, { suffix: '/:foo*', combiner: true }), operators_1.mergeMap(exports.combineEffects(effect.effects)(res))) | ||
: effect(req$, res, undefined)); | ||
@@ -14,0 +14,0 @@ return rxjs_1.merge(...mappedEffects); |
@@ -6,4 +6,8 @@ /// <reference types="node" /> | ||
matchers?: string[]; | ||
params?: RouteParameters; | ||
query?: QueryParameters; | ||
[key: string]: any; | ||
} | ||
export declare type RouteParameters = Record<string, string | number>; | ||
export declare type QueryParameters = Record<string, string | number | object>; | ||
export interface HttpResponse extends http.ServerResponse { | ||
@@ -22,2 +26,3 @@ } | ||
NO_CONTENT = 204, | ||
NOT_MODIFIED = 304, | ||
BAD_REQUEST = 400, | ||
@@ -24,0 +29,0 @@ UNAUTHORIZED = 401, |
@@ -9,2 +9,3 @@ "use strict"; | ||
HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT"; | ||
HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED"; | ||
HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST"; | ||
@@ -11,0 +12,0 @@ HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED"; |
@@ -12,3 +12,3 @@ "use strict"; | ||
const effect$ = request$ | ||
.pipe(operators_1.switchMap(({ req, res }) => effects_combiner_1.combineMiddlewareEffects(middlewares)(res)(req) | ||
.pipe(operators_1.mergeMap(({ req, res }) => effects_combiner_1.combineMiddlewareEffects(middlewares)(res)(req) | ||
.pipe(operators_1.switchMap(effects_combiner_1.combineEffects(effects)(res)), operators_1.defaultIfEmpty({ status: http_interface_1.HttpStatus.NOT_FOUND }), operators_1.tap(response_handler_1.handleResponse(res)), operators_1.catchError(error => error_middleware_1.getErrorMiddleware(errorMiddleware)(rxjs_1.of(req), res, error) | ||
@@ -15,0 +15,0 @@ .pipe(operators_1.tap(response_handler_1.handleResponse(res))))))); |
export * from './effects/effects.interface'; | ||
export { combineRoutes } from './effects/effects.combiner'; | ||
export * from './middlewares/bodyParser.middleware'; | ||
export * from './middlewares/error.middleware'; | ||
export * from './middlewares/logger.middleware'; | ||
export * from './operators/matchType.operator'; | ||
export * from './operators/matchPath.operator'; | ||
export * from './operators'; | ||
export * from './http.interface'; | ||
export * from './http.listener'; | ||
export { HttpError } from './util/error.util'; | ||
export { ContentType } from './util/contentType.util'; |
@@ -8,7 +8,4 @@ "use strict"; | ||
exports.combineRoutes = effects_combiner_1.combineRoutes; | ||
__export(require("./middlewares/bodyParser.middleware")); | ||
__export(require("./middlewares/error.middleware")); | ||
__export(require("./middlewares/logger.middleware")); | ||
__export(require("./operators/matchType.operator")); | ||
__export(require("./operators/matchPath.operator")); | ||
__export(require("./operators")); | ||
__export(require("./http.interface")); | ||
@@ -18,1 +15,3 @@ __export(require("./http.listener")); | ||
exports.HttpError = error_util_1.HttpError; | ||
var contentType_util_1 = require("./util/contentType.util"); | ||
exports.ContentType = contentType_util_1.ContentType; |
import { Effect, EffectResponse } from '../effects/effects.interface'; | ||
import { HttpError } from '../util/error.util'; | ||
export declare type ThrowedError = HttpError | Error; | ||
export declare const getErrorMiddleware: (customError$?: Effect<EffectResponse, ThrowedError> | undefined) => Effect<EffectResponse, ThrowedError>; | ||
export declare const error$: Effect<EffectResponse, ThrowedError>; | ||
export declare type ThrownError = HttpError | Error; | ||
export declare const getErrorMiddleware: (customError$?: Effect<EffectResponse, ThrownError> | undefined) => Effect<EffectResponse, ThrownError>; | ||
export declare const error$: Effect<EffectResponse, ThrownError>; |
{ | ||
"name": "@marblejs/core", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Reactive Node APIs made easy", | ||
@@ -35,7 +35,5 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"chalk": "^2.4.1", | ||
"path-to-regexp": "^2.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/chalk": "^2.2.0", | ||
"@types/path-to-regexp": "^1.7.0" | ||
@@ -42,0 +40,0 @@ }, |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
32589
2
1
40
415
1
324
- Removedchalk@^2.4.1
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)