New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@barelyhuman/conrou

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barelyhuman/conrou - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2-alpha.0

4

dist/index.d.ts

@@ -14,3 +14,5 @@ // Any interface that satisfies this should be fine

getRouter(): RouterInterface;
register(controller: new (...args: any[]) => any): void;
register(controller: new (...args: any[]) => any, { name }?: {
name?: string;
}): void;
addRoute(method: string, url: string, action: string): void;

@@ -17,0 +19,0 @@ resource(base: string, controller: any): void;

@@ -1,1 +0,3 @@

var u=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(i,e,o)=>e in i?u(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o;var $=(i,e)=>{for(var o in e)u(i,o,{get:e[o],enumerable:!0})},R=(i,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!p.call(i,t)&&t!==o&&u(i,t,{get:()=>e[t],enumerable:!(s=O(e,t))||s.enumerable});return i};var C=i=>R(u({},"__esModule",{value:!0}),i);var a=(i,e,o)=>(w(i,typeof e!="symbol"?e+"":e,o),o);var L={};$(L,{createControllerBinder:()=>D});module.exports=C(L);var n=class extends Error{_errorCode;constructor(e,o){super(e),this._message=e,this._errorCode=o}toString(){return`${this._errorCode} - ${this._message}`}};a(n,"INVALID_METHOD",1),a(n,"CONTROLLER_NOT_FOUND",2),a(n,"CONTROLLER_ACTION_NOT_FOUND",3);var d=class extends Error{_errorCode;constructor(e,o){super(e),this._message=e,this._errorCode=o}toString(){return`${this._errorCode} - ${this._message}`}};a(d,"NAME_ALREADY_BOUND",1);function D(i){let e=new Map,o=new Map;return{getRouter(){return i},register(s){let t=s.name;if(e.has(t))throw new d("${name} is already bound to a controller",d.NAME_ALREADY_BOUND);e.set(t,new s)},addRoute(s,t,r){if(!i[s])throw new n(`${s} method doesn't exist on router`,n.INVALID_METHOD);let[h,_]=r.split("."),N=e.get(h);if(!N)throw new n(`Controller with the name ${h} was not found.`,n.CONTROLLER_NOT_FOUND);if(!N[_])throw new n(`Action with the name ${_} was not found on the controller ${h}`,n.CONTROLLER_ACTION_NOT_FOUND);i[s](t,N[_]),o.set(t,{method:s,url:t,controllerName:h,action:_})},resource(s,t){let r=s;r.startsWith("/")||(r="/"+s),r.endsWith("/")&&(r=s.slice(0,-1)),this.get(r,t.index),this.get(`${r}/new`,t.new),this.post(r,t.store),this.get(`${r}/:id`,t.show),this.get(`${r}/:id/edit`,t.edit),this.put(`${r}/:id`,t.update),this.patch(`${r}/:id`,t.update),this.delete(`${r}/:id`,t.destroy)},get(s,t){return this.addRoute("get",s,t)},post(s,t){return this.addRoute("post",s,t)},put(s,t){return this.addRoute("put",s,t)},delete(s,t){return this.addRoute("delete",s,t)},listRoutes(){}}}0&&(module.exports={createControllerBinder});
var N=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var $=(i,e,o)=>e in i?N(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o;var m=(i,e)=>{for(var o in e)N(i,o,{get:e[o],enumerable:!0})},A=(i,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of O(e))!w.call(i,t)&&t!==o&&N(i,t,{get:()=>e[t],enumerable:!(s=u(e,t))||s.enumerable});return i};var R=i=>A(N({},"__esModule",{value:!0}),i);var d=(i,e,o)=>($(i,typeof e!="symbol"?e+"":e,o),o);var l={};m(l,{createControllerBinder:()=>f});module.exports=R(l);var n=class extends Error{_errorCode;constructor(e,o){super(e),this._message=e,this._errorCode=o}toString(){return`${this._errorCode} - ${this._message}`}};d(n,"INVALID_METHOD",1),d(n,"CONTROLLER_NOT_FOUND",2),d(n,"CONTROLLER_ACTION_NOT_FOUND",3);var a=class extends Error{_errorCode;constructor(e,o){super(e),this._message=e,this._errorCode=o}toString(){return`${this._errorCode} - ${this._message}`}};d(a,"NO_NAME",0),d(a,"NAME_ALREADY_BOUND",1);function f(i){let e=new Map,o=new Map;return{getRouter(){return i},register(s,{name:t=""}={}){if(!(s.name||t))throw new a("A name for the controller wasn't provided, please provide a named class instance or provide a name in the `options.name` for the `register` call",a.NO_NAME);if(e.has(t))throw new a("${name} is already bound to a controller",a.NAME_ALREADY_BOUND);e.set(t,new s)},addRoute(s,t,r){if(!i[s])throw new n(`${s} method doesn't exist on router`,n.INVALID_METHOD);let[h,_]=r.split("."),c=e.get(h);if(!c)throw new n(`Controller with the name ${h} was not found.
Available Names: ${[...e.entries()].map(p=>p[0]).join(",")}
`,n.CONTROLLER_NOT_FOUND);if(!c[_])throw new n(`Action with the name ${_} was not found on the controller ${h}`,n.CONTROLLER_ACTION_NOT_FOUND);i[s](t,c[_]),o.set(t,{method:s,url:t,controllerName:h,action:_})},resource(s,t){let r=s;r.startsWith("/")||(r="/"+s),r.endsWith("/")&&(r=s.slice(0,-1)),this.get(r,t.index),this.get(`${r}/new`,t.new),this.post(r,t.store),this.get(`${r}/:id`,t.show),this.get(`${r}/:id/edit`,t.edit),this.put(`${r}/:id`,t.update),this.patch(`${r}/:id`,t.update),this.delete(`${r}/:id`,t.destroy)},get(s,t){return this.addRoute("get",s,t)},post(s,t){return this.addRoute("post",s,t)},put(s,t){return this.addRoute("put",s,t)},delete(s,t){return this.addRoute("delete",s,t)},listRoutes(){}}}0&&(module.exports={createControllerBinder});
{
"name": "@barelyhuman/conrou",
"version": "0.1.1",
"version": "0.1.2-alpha.0",
"repository": "git@github.com:barelyhuman/conrou.git",

@@ -11,6 +11,6 @@ "license": "MIT",

"exports": {
"./*": {
"import": "./dist/*.mjs",
"require": "./dist/*.js",
"types": "./dist/*.d.ts"
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},

@@ -17,0 +17,0 @@ "./package.json": "./package.json"

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