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

@alpinesoft/railjet

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alpinesoft/railjet - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

src/actions/Action.ts

8

example/index.ts
import App from "../src/App";
import Action from "../src/Action";
import Action from "../src/actions/Action";
import Method from "../src/Methods";

@@ -7,4 +7,8 @@ import HttpError from "../src/HttpError";

import * as Types from "../src/Types";
import PasswordAuthStrategy from "../src/auth/PasswordAuthStrategy";
const app = new App();
const app = new App({
database: "postgres",
authStrategy: new PasswordAuthStrategy()
});

@@ -11,0 +15,0 @@ class TestAction extends Action {

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

import Action from "./src/Action";
import Action from "./src/actions/Action";
import App from "./src/App";

@@ -6,3 +6,3 @@ import BodyField from "./src/BodyField";

import HttpError from "./src/HttpError";
import Methods from "./src/Methods";
import Method from "./src/Methods";
import * as Types from "./src/Types";

@@ -16,4 +16,4 @@

HttpError,
Methods,
Method,
Types
}
{
"name": "railjet",
"version": "1.0.0",
"name": "@alpinesoft/railjet",
"version": "0.0.10",
"lockfileVersion": 1,

@@ -13,2 +13,7 @@ "requires": true,

},
"@types/statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha512-4zJN5gJH+Km6hA36z8MnOKas6EU0qwxItTXNijYDPuZUsSk4EpIAB56fwnxZIhi3tHx42J7wqNdQTqt49Ar9FQ=="
},
"@types/twig": {

@@ -97,2 +102,7 @@ "version": "1.12.2",

},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"ts-node": {

@@ -111,2 +121,7 @@ "version": "8.0.2",

},
"ts-transformer-keys": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/ts-transformer-keys/-/ts-transformer-keys-0.3.4.tgz",
"integrity": "sha512-Or2lLODKfg5n03MzC9RfSAeg+l0LrT8r6p8z5JuH0AcCoPVht6+SFCZcKgoN5O/4d9bL6RTqC2lGNTBujUMUaA=="
},
"twig": {

@@ -113,0 +128,0 @@ "version": "1.13.2",

{
"name": "@alpinesoft/railjet",
"version": "0.0.10",
"version": "0.0.11",
"description": "Lightweight Node.js library to build advanced JSON APIs.",

@@ -30,2 +30,5 @@ "main": "./lib/index.js",

"dependencies": {
"@types/statuses": "^1.5.0",
"statuses": "^1.5.0",
"ts-transformer-keys": "^0.3.4",
"twig": "^1.13.2"

@@ -32,0 +35,0 @@ },

import http from "http";
import Action from "./Action";
import Action from "./actions/Action";
import Context from "./Context";

@@ -8,6 +8,8 @@ import HttpError from "./HttpError";

import docsAction from "./internal_actions/DocsAction"
import AuthStrategy from "./auth/AuthStrategy";
interface AppOpts {
database: "postgres"
cors?: boolean;
authStrategy?: AuthStrategy;
}

@@ -20,3 +22,3 @@

constructor(opts?: AppOpts) {
constructor(opts: AppOpts) {

@@ -30,2 +32,8 @@ this.cors = opts.cors || false;

this.registerAction(docsAction);
if (opts.authStrategy) {
this.registerAction(opts.authStrategy.loginAction);
this.registerAction(opts.authStrategy.logoutAction);
this.registerAction(opts.authStrategy.registerAction);
}
}

@@ -96,3 +104,3 @@

if (!action) {
context.error(new HttpError(404, "Not found"));
context.error(new HttpError(404));
return;

@@ -99,0 +107,0 @@ }

@@ -5,3 +5,4 @@ import * as http from "http";

import HttpError from "./HttpError";
import Action from "./Action";
import Action from "./actions/Action";
import {Session} from "./auth/AuthStrategy";

@@ -14,2 +15,3 @@ class Context {

actions: Action[];
session: Session;

@@ -16,0 +18,0 @@ constructor(req: http.IncomingMessage, res: http.ServerResponse, body: BodyField[], actions: Action[]) {

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

import statuses from "statuses";
class HttpError extends Error {

@@ -5,4 +7,4 @@

constructor(statusCode: number, message: string) {
super(message);
constructor(statusCode: number, message?: string) {
super(message || statuses[statusCode]);
this.statusCode = statusCode;

@@ -9,0 +11,0 @@ }

@@ -6,3 +6,3 @@ import Twig from 'twig';

import HttpError from "../HttpError";
import Action from "../Action";
import Action from "../actions/Action";
import Method from "../Methods";

@@ -9,0 +9,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