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

@bunt/app

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bunt/app - npm Package Compare versions

Comparing version 0.19.1 to 0.19.2

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## [0.19.2](https://github.com/izatop/bunt/compare/v0.19.1...v0.19.2) (2021-05-27)
### Bug Fixes
* lint ([32f1ce5](https://github.com/izatop/bunt/commit/32f1ce542e6db7a23c5ad8ef7a315a047963c327))
* update deps and type fixes ([c9c88b1](https://github.com/izatop/bunt/commit/c9c88b13887e214593a0d03ad12e1f2edb9b9eef))
## [0.19.1](https://github.com/izatop/bunt/compare/v0.19.0...v0.19.1) (2021-05-26)

@@ -8,0 +20,0 @@

54

dist/Application.js

@@ -8,16 +8,14 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _unit, _routes;
var _Application_unit, _Application_routes;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -30,5 +28,5 @@ exports.Application = void 0;

constructor(u, routes = []) {
_unit.set(this, void 0);
_routes.set(this, []);
__classPrivateFieldSet(this, _unit, u);
_Application_unit.set(this, void 0);
_Application_routes.set(this, []);
__classPrivateFieldSet(this, _Application_unit, u, "f");
if (routes.length > 0) {

@@ -39,6 +37,6 @@ routes.forEach((route) => this.add(route));

get context() {
return __classPrivateFieldGet(this, _unit).context;
return __classPrivateFieldGet(this, _Application_unit, "f").context;
}
get size() {
return __classPrivateFieldGet(this, _routes).length;
return __classPrivateFieldGet(this, _Application_routes, "f").length;
}

@@ -50,13 +48,13 @@ static async factory(context, routes = []) {

this.logger.debug("add", route);
util_1.assert(!__classPrivateFieldGet(this, _unit).has(route.action), `This route was already added`);
__classPrivateFieldGet(this, _unit).add(route.action);
__classPrivateFieldGet(this, _routes).push(route);
util_1.assert(!__classPrivateFieldGet(this, _Application_unit, "f").has(route.action), `This route was already added`);
__classPrivateFieldGet(this, _Application_unit, "f").add(route.action);
__classPrivateFieldGet(this, _Application_routes, "f").push(route);
return this;
}
remove(route) {
if (__classPrivateFieldGet(this, _unit).has(route.action)) {
if (__classPrivateFieldGet(this, _Application_unit, "f").has(route.action)) {
this.logger.debug("remove", route);
__classPrivateFieldGet(this, _unit).remove(route.action);
const index = __classPrivateFieldGet(this, _routes).findIndex((item) => item === route);
__classPrivateFieldGet(this, _routes).splice(index, index + 1);
__classPrivateFieldGet(this, _Application_unit, "f").remove(route.action);
const index = __classPrivateFieldGet(this, _Application_routes, "f").findIndex((item) => item === route);
__classPrivateFieldGet(this, _Application_routes, "f").splice(index, index + 1);
}

@@ -66,6 +64,6 @@ return this;

async run(request) {
const route = __classPrivateFieldGet(this, _routes).find((route) => route.test(request.route));
const route = __classPrivateFieldGet(this, _Application_routes, "f").find((route) => route.test(request.route));
util_1.assert(route, () => new Route_1.RouteNotFound(request.route));
this.logger.debug("match", route);
const unit = __classPrivateFieldGet(this, _unit);
const unit = __classPrivateFieldGet(this, _Application_unit, "f");
const state = {};

@@ -85,6 +83,6 @@ const matches = route.match(request.route);

getRoutes() {
return __classPrivateFieldGet(this, _routes);
return __classPrivateFieldGet(this, _Application_routes, "f");
}
}
_unit = new WeakMap(), _routes = new WeakMap();
_Application_unit = new WeakMap(), _Application_routes = new WeakMap();
__decorate([

@@ -91,0 +89,0 @@ util_1.logger

@@ -5,5 +5,5 @@ import { IKeyValueMap } from "../interfaces";

constructor(values: [string, string][]);
static fromObject(input: Record<string, string>): IKeyValueMap;
delete(name: string): void;
entries(): [string, string][];
static fromObject(input: Record<string, string>): IKeyValueMap;
has(name: string): boolean;

@@ -10,0 +10,0 @@ get(name: string, defaultValue?: string): string;

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _map;
var _KeyValueMap_map;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,23 +18,23 @@ exports.KeyValueMap = void 0;

constructor(values) {
_map.set(this, void 0);
__classPrivateFieldSet(this, _map, new Map(values));
_KeyValueMap_map.set(this, void 0);
__classPrivateFieldSet(this, _KeyValueMap_map, new Map(values), "f");
}
static fromObject(input) {
return new this(Object.entries(input));
}
delete(name) {
__classPrivateFieldGet(this, _map).delete(name);
__classPrivateFieldGet(this, _KeyValueMap_map, "f").delete(name);
}
entries() {
return [...__classPrivateFieldGet(this, _map).entries()];
return [...__classPrivateFieldGet(this, _KeyValueMap_map, "f").entries()];
}
static fromObject(input) {
return new this(Object.entries(input));
}
has(name) {
return __classPrivateFieldGet(this, _map).has(name);
return __classPrivateFieldGet(this, _KeyValueMap_map, "f").has(name);
}
get(name, defaultValue) {
return __classPrivateFieldGet(this, _map).get(name) || defaultValue || "";
return __classPrivateFieldGet(this, _KeyValueMap_map, "f").get(name) || defaultValue || "";
}
toJSON() {
const object = {};
for (const [key, value] of __classPrivateFieldGet(this, _map).entries()) {
for (const [key, value] of __classPrivateFieldGet(this, _KeyValueMap_map, "f").entries()) {
object[key] = value;

@@ -47,7 +45,7 @@ }

set(name, value) {
__classPrivateFieldGet(this, _map).set(name, value);
__classPrivateFieldGet(this, _KeyValueMap_map, "f").set(name, value);
}
}
exports.KeyValueMap = KeyValueMap;
_map = new WeakMap();
_KeyValueMap_map = new WeakMap();
//# sourceMappingURL=KeyValueMap.js.map

@@ -1,2 +0,2 @@

import { ActionAny, ActionContext, ActionCtor, ApplyContext } from "@bunt/unit";
import { ActionAny, ActionContext, ActionCtor, ActionState, ApplyContext } from "@bunt/unit";
import { Ctor } from "@bunt/util";

@@ -15,3 +15,10 @@ import { IRequest } from "../interfaces";

export declare type RouteMatcherFactory = IRouteMatcher | ((route: string) => IRouteMatcher);
export declare type RouteRuleArg<A extends ActionAny> = A extends ActionAny<any, infer S> ? S extends null ? string : RouteRule<A> : string;
export declare type RouteRuleVariants<A extends ActionAny> = {
route: string;
payload: undefined;
} | {
route: string;
payload: RouteRule<A>;
};
export declare type RouteRuleArg<A extends ActionAny> = ActionState<A> extends null ? string : RouteRule<A>;
export declare type RouteFactory = <A extends ActionAny>(action: Ctor<A>, rule: RouteRuleArg<A>) => Route<A>;

@@ -18,0 +25,0 @@ export interface IRouteContext<A extends ActionAny> {

import { ActionAny } from "@bunt/unit";
import { Ctor, ILogable } from "@bunt/util";
import { Payload } from "../Payload";
import { IRoute, RouteFactory, RouteMatcherFactory, RouteRuleArg } from "./interfaces";
import { RouteRule } from "./RouteRule";
export declare class Route<A extends ActionAny> implements IRoute<A>, ILogable<{

@@ -11,3 +11,3 @@ route: string;

readonly action: Ctor<A>;
readonly payload?: Payload<A>;
readonly payload?: RouteRule<A>;
constructor(matcher: RouteMatcherFactory, action: Ctor<A>, rule: RouteRuleArg<A>);

@@ -14,0 +14,0 @@ static create(matcher: RouteMatcherFactory): RouteFactory;

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _matcher;
var _Route_matcher;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -21,3 +19,3 @@ exports.Route = void 0;

constructor(matcher, action, rule) {
_matcher.set(this, void 0);
_Route_matcher.set(this, void 0);
const { route, payload } = this.getRuleArgs(rule);

@@ -27,3 +25,3 @@ this.route = route;

this.payload = payload;
__classPrivateFieldSet(this, _matcher, util_1.isFunction(matcher) ? matcher(this.route) : matcher);
__classPrivateFieldSet(this, _Route_matcher, util_1.isFunction(matcher) ? matcher(this.route) : matcher, "f");
}

@@ -37,6 +35,6 @@ static create(matcher) {

test(route) {
return __classPrivateFieldGet(this, _matcher).test(route);
return __classPrivateFieldGet(this, _Route_matcher, "f").test(route);
}
match(route) {
return __classPrivateFieldGet(this, _matcher).match(route);
return __classPrivateFieldGet(this, _Route_matcher, "f").match(route);
}

@@ -51,3 +49,3 @@ getRuleArgs(rule) {

exports.Route = Route;
_matcher = new WeakMap();
_Route_matcher = new WeakMap();
//# sourceMappingURL=Route.js.map
{
"name": "@bunt/app",
"version": "0.19.1",
"version": "0.19.2",
"keywords": [

@@ -29,9 +29,9 @@ "typescript"

"dependencies": {
"@bunt/input": "^0.19.0",
"@bunt/unit": "^0.19.1",
"@bunt/util": "^0.19.0",
"@bunt/input": "^0.19.2",
"@bunt/unit": "^0.19.2",
"@bunt/util": "^0.19.2",
"path-to-regexp": "^6.2.0"
},
"license": "MIT",
"gitHead": "a692c96ce4a9e62d97635d280de51a611b8d5bb6"
"gitHead": "6d173b2cfe84a19694499492467ddd19931f9b97"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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