Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prague-fluent

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prague-fluent - npm Package Compare versions

Comparing version 0.17.8 to 0.17.9

14

dist/fluent.d.ts

@@ -25,8 +25,8 @@ import { Observable } from 'rxjs';

export declare type TemplateActions<TEMPLATES> = keyof TEMPLATES;
export declare type MapTemplateActionToRouter<TEMPLATES> = {
[P in TemplateActions<TEMPLATES>]: AnyRouter<TEMPLATES[P]>;
export declare type MapTemplateToAction<TEMPLATES> = {
[P in TemplateActions<TEMPLATES>]: Action<TEMPLATES[P]>;
};
export declare class Templates<TEMPLATES, CONTEXT = any, SOURCE = string> {
mapActionToRouter: (context: CONTEXT) => Partial<MapTemplateActionToRouter<TEMPLATES>>;
constructor(mapActionToRouter: (context: CONTEXT) => Partial<MapTemplateActionToRouter<TEMPLATES>>);
mapTemplateToAction: (context: CONTEXT) => Partial<MapTemplateToAction<TEMPLATES>>;
constructor(mapTemplateToAction: (context: CONTEXT) => Partial<MapTemplateToAction<TEMPLATES>>);
route<ACTION extends keyof TEMPLATES, ARGS extends TEMPLATES[ACTION]>(action: ACTION, args: ARGS, source?: SOURCE, score?: number): TemplateRoute<ACTION, ARGS>;

@@ -36,3 +36,3 @@ route<ACTION extends keyof TEMPLATES, ARGS extends TEMPLATES[ACTION]>(action: ACTION, args?: ARGS, score?: number): TemplateRoute<ACTION, ARGS>;

router<ACTION extends keyof TEMPLATES, ARGS extends TEMPLATES[ACTION]>(action: ACTION, args?: ARGS, score?: number): Router;
map(route: TemplateRoute<keyof TEMPLATES, TEMPLATES[keyof TEMPLATES]>, context?: CONTEXT): TemplateRoute<keyof TEMPLATES, TEMPLATES[keyof TEMPLATES]> | Observable<Route<any>>;
mapToDo(route: TemplateRoute<keyof TEMPLATES, TEMPLATES[keyof TEMPLATES]>, context?: CONTEXT): TemplateRoute<keyof TEMPLATES, TEMPLATES[keyof TEMPLATES]> | DoRoute;
}

@@ -50,3 +50,3 @@ export declare class MultipleRoute extends Route {

}
export declare type Action = () => Observableable<any>;
export declare type Action<ARG = undefined> = (arg?: ARG) => Observableable<any>;
export declare class DoRoute extends ScoredRoute<undefined> {

@@ -57,3 +57,3 @@ private action;

}
export declare function _do<ARG = any>(action: (arg?: ARG) => Observableable<any>, score?: number): Router<ARG, DoRoute>;
export declare function _do<ARG = undefined>(action: Action<ARG>, score?: number): Router<ARG, DoRoute>;
export { _do as do };

@@ -60,0 +60,0 @@ export declare class MatchRoute<VALUE = any> extends ScoredRoute<VALUE> {

@@ -143,4 +143,4 @@ "use strict";

var Templates = /** @class */ (function () {
function Templates(mapActionToRouter) {
this.mapActionToRouter = mapActionToRouter;
function Templates(mapTemplateToAction) {
this.mapTemplateToAction = mapTemplateToAction;
}

@@ -162,8 +162,6 @@ Templates.prototype.route = function (action, args) {

};
Templates.prototype.map = function (route, context) {
var router = this.mapActionToRouter(context)[route.action];
return router
? Router
.from(router)
.route$(route.args)
Templates.prototype.mapToDo = function (route, context) {
var action = this.mapTemplateToAction(context)[route.action];
return action
? new DoRoute(function () { return action(route.args); })
: route;

@@ -305,3 +303,3 @@ };

return this.mapByType({
template: function (route) { return templates.map(route, context); }
template: function (route) { return templates.mapToDo(route, context); }
});

@@ -308,0 +306,0 @@ };

{
"name": "prague-fluent",
"version": "0.17.8",
"version": "0.17.9",
"description": "fluent API for Prague",

@@ -5,0 +5,0 @@ "main": "dist/fluent.js",

@@ -97,3 +97,3 @@ import { Observable } from 'rxjs';

export type MapTemplateActionToRouter <TEMPLATES> = { [P in TemplateActions<TEMPLATES>]: AnyRouter<TEMPLATES[P]> }
export type MapTemplateToAction <TEMPLATES> = { [P in TemplateActions<TEMPLATES>]: Action<TEMPLATES[P]> }

@@ -104,3 +104,3 @@ const templateError = new Error('action not present in mapActionToRouter')

constructor(
public mapActionToRouter: (context: CONTEXT) => Partial<MapTemplateActionToRouter<TEMPLATES>>
public mapTemplateToAction: (context: CONTEXT) => Partial<MapTemplateToAction<TEMPLATES>>
) {

@@ -121,3 +121,3 @@ }

): TemplateRoute<ACTION, ARGS>;
route <ACTION extends keyof TEMPLATES, ARGS extends TEMPLATES[ACTION]> (

@@ -152,12 +152,10 @@ action: ACTION,

map (
mapToDo (
route: TemplateRoute<keyof TEMPLATES, TEMPLATES[keyof TEMPLATES]>,
context?: CONTEXT
) {
const router: AnyRouter<TEMPLATES[keyof TEMPLATES], any> = this.mapActionToRouter(context)[route.action];
const action: Action<TEMPLATES[keyof TEMPLATES]> = this.mapTemplateToAction(context)[route.action];
return router
? Router
.from(router)
.route$(route.args)
return action
? new DoRoute(() => action(route.args))
: route;

@@ -185,3 +183,3 @@ }

export type Action = () => Observableable<any>;
export type Action <ARG = undefined> = (arg?: ARG) => Observableable<any>;

@@ -201,4 +199,4 @@ export class DoRoute extends ScoredRoute<undefined> {

export function _do <ARG = any> (
action: (arg?: ARG) => Observableable<any>,
export function _do <ARG = undefined> (
action: Action<ARG>,
score?: number

@@ -338,3 +336,3 @@ ) {

return this.mapByType({
template: route => templates.map(route, context)
template: route => templates.mapToDo(route, context)
});

@@ -341,0 +339,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc