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

@foal/core

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foal/core - npm Package Compare versions

Comparing version 0.4.0-beta.1 to 0.4.0-beta.3

dist/src/classes/service-controller-factory.interface.d.ts

2

dist/src/classes/controller.d.ts

@@ -9,3 +9,5 @@ /**

export declare class Controller<RouteName extends string> {
private prePath;
private routes;
constructor(prePath?: string | undefined);
addRoute(name: RouteName, httpMethod: HttpMethod, path: string, handler: Handler): void;

@@ -12,0 +14,0 @@ getRoute(name: RouteName): Route;

7

dist/src/classes/controller.js

@@ -10,3 +10,4 @@ /**

class Controller {
constructor() {
constructor(prePath) {
this.prePath = prePath;
this.routes = new Map();

@@ -18,3 +19,3 @@ }

httpMethod,
path,
path: (this.prePath ? `${this.prePath}${path}` : path).replace(/(\/)+/g, '/'),
postHooks: [],

@@ -86,3 +87,3 @@ preHooks: [],

addPathAtTheBeginning(path) {
this.routes.forEach(route => route.path = `${path}/${route.path}`.replace(/(\/)+/g, '/'));
this.routes.forEach(route => route.path = `${path}${route.path}`.replace(/(\/)+/g, '/'));
}

@@ -89,0 +90,0 @@ getRoutes() {

@@ -7,3 +7,2 @@ /**

import { ObjectType } from '../interfaces';
export declare abstract class HttpResponse {

@@ -16,3 +15,3 @@ content: any;

}
export declare function isHttpResponse(obj: ObjectType): boolean;
export declare function isHttpResponse(obj: object): boolean;
export declare abstract class HttpResponseSuccess extends HttpResponse {

@@ -22,3 +21,3 @@ readonly isHttpResponseSuccess: boolean;

}
export declare function isHttpResponseSuccess(obj: ObjectType): boolean;
export declare function isHttpResponseSuccess(obj: object): boolean;
export declare class HttpResponseOK extends HttpResponseSuccess {

@@ -30,3 +29,3 @@ readonly isHttpResponseOK: boolean;

}
export declare function isHttpResponseOK(obj: ObjectType): boolean;
export declare function isHttpResponseOK(obj: object): boolean;
export declare class HttpResponseCreated extends HttpResponseSuccess {

@@ -38,3 +37,10 @@ readonly isHttpResponseCreated: boolean;

}
export declare function isHttpResponseCreated(obj: ObjectType): boolean;
export declare function isHttpResponseCreated(obj: object): boolean;
export declare class HttpResponseNoContent extends HttpResponseSuccess {
readonly isHttpResponseNoContent: boolean;
statusCode: number;
statusMessage: string;
constructor();
}
export declare function isHttpResponseNoContent(obj: object): boolean;
export declare abstract class HttpResponseRedirection extends HttpResponse {

@@ -44,3 +50,3 @@ readonly isHttpResponseRedirection: boolean;

}
export declare function isHttpResponseRedirection(obj: ObjectType): boolean;
export declare function isHttpResponseRedirection(obj: object): boolean;
export declare class HttpResponseRedirect extends HttpResponseRedirection {

@@ -53,3 +59,3 @@ path: string;

}
export declare function isHttpResponseRedirect(obj: ObjectType): boolean;
export declare function isHttpResponseRedirect(obj: object): boolean;
export declare abstract class HttpResponseClientError extends HttpResponse {

@@ -59,3 +65,3 @@ readonly isHttpResponseClientError: boolean;

}
export declare function isHttpResponseClientError(obj: ObjectType): boolean;
export declare function isHttpResponseClientError(obj: object): boolean;
export declare class HttpResponseBadRequest extends HttpResponseClientError {

@@ -67,3 +73,3 @@ readonly isHttpResponseBadRequest: boolean;

}
export declare function isHttpResponseBadRequest(obj: ObjectType): boolean;
export declare function isHttpResponseBadRequest(obj: object): boolean;
export declare class HttpResponseUnauthorized extends HttpResponseClientError {

@@ -78,3 +84,3 @@ readonly isHttpResponseUnauthorized: boolean;

}
export declare function isHttpResponseUnauthorized(obj: ObjectType): boolean;
export declare function isHttpResponseUnauthorized(obj: object): boolean;
export declare class HttpResponseForbidden extends HttpResponseClientError {

@@ -86,3 +92,3 @@ readonly isHttpResponseForbidden: boolean;

}
export declare function isHttpResponseForbidden(obj: ObjectType): boolean;
export declare function isHttpResponseForbidden(obj: object): boolean;
export declare class HttpResponseNotFound extends HttpResponseClientError {

@@ -94,3 +100,3 @@ readonly isHttpResponseNotFound: boolean;

}
export declare function isHttpResponseNotFound(obj: ObjectType): boolean;
export declare function isHttpResponseNotFound(obj: object): boolean;
export declare class HttpResponseMethodNotAllowed extends HttpResponseClientError {

@@ -102,3 +108,3 @@ readonly isHttpResponseMethodNotAllowed: boolean;

}
export declare function isHttpResponseMethodNotAllowed(obj: ObjectType): boolean;
export declare function isHttpResponseMethodNotAllowed(obj: object): boolean;
export declare class HttpResponseConflict extends HttpResponseClientError {

@@ -110,3 +116,3 @@ readonly isHttpResponseConflict: boolean;

}
export declare function isHttpResponseConflict(obj: ObjectType): boolean;
export declare function isHttpResponseConflict(obj: object): boolean;
export declare abstract class HttpResponseServerError extends HttpResponse {

@@ -116,3 +122,3 @@ readonly isHttpResponseServerError: boolean;

}
export declare function isHttpResponseServerError(obj: ObjectType): boolean;
export declare function isHttpResponseServerError(obj: object): boolean;
export declare class HttpResponseInternalServerError extends HttpResponseServerError {

@@ -124,3 +130,3 @@ readonly isHttpResponseInternalServerError: boolean;

}
export declare function isHttpResponseInternalServerError(obj: ObjectType): boolean;
export declare function isHttpResponseInternalServerError(obj: object): boolean;
export declare class HttpResponseNotImplemented extends HttpResponseServerError {

@@ -132,2 +138,2 @@ readonly isHttpResponseNotImplemented: boolean;

}
export declare function isHttpResponseNotImplemented(obj: ObjectType): boolean;
export declare function isHttpResponseNotImplemented(obj: object): boolean;

@@ -58,2 +58,15 @@ /**

exports.isHttpResponseCreated = isHttpResponseCreated;
class HttpResponseNoContent extends HttpResponseSuccess {
constructor() {
super();
this.isHttpResponseNoContent = true;
this.statusCode = 204;
this.statusMessage = 'NO CONTENT';
}
}
exports.HttpResponseNoContent = HttpResponseNoContent;
function isHttpResponseNoContent(obj) {
return obj instanceof HttpResponseNoContent || obj.isHttpResponseNoContent === true;
}
exports.isHttpResponseNoContent = isHttpResponseNoContent;
/* 3xx Redirection */

@@ -60,0 +73,0 @@ class HttpResponseRedirection extends HttpResponse {

@@ -11,3 +11,3 @@ /**

export * from './http-responses';
export { ServiceControllerFactory } from './service-controller-factory';
export { IServiceControllerFactory } from './service-controller-factory.interface';
export { Service, ServiceManager } from './service-manager';

@@ -20,6 +20,4 @@ /**

__export(require("./http-responses"));
var service_controller_factory_1 = require("./service-controller-factory");
exports.ServiceControllerFactory = service_controller_factory_1.ServiceControllerFactory;
var service_manager_1 = require("./service-manager");
exports.Service = service_manager_1.Service;
exports.ServiceManager = service_manager_1.ServiceManager;

@@ -8,10 +8,15 @@ /**

import { HttpResponse } from '../classes';
import { ObjectType } from './utils';
export interface Context<User = any> {
export interface Context<User = any, State = {
[key: string]: any;
}> {
session: any;
params: ObjectType;
params: {
[key: string]: any;
};
body: any;
query: ObjectType;
state: ObjectType;
user: User | null;
query: {
[key: string]: any;
};
state: State;
user: User;
getHeader(field: string): string;

@@ -18,0 +23,0 @@ }

@@ -7,7 +7,4 @@ /**

export interface Class<T> {
export interface Class<T = any> {
new (...args: any[]): T;
}
export interface ObjectType {
[name: string]: any;
}
{
"name": "@foal/core",
"version": "0.4.0-beta.1",
"version": "0.4.0-beta.3",
"description": "A high-level Node.JS framework to quickly build web apps in TypeScript.",

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

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