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

@furystack/http-api

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@furystack/http-api - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

4

dist/HttpApi.d.ts

@@ -6,3 +6,3 @@ /// <reference types="node" />

import { Server } from "net";
import { IdentityService, ILoginUser, RequestAction, RequestContext } from "./";
import { IdentityService, RequestAction, RequestContext } from "./";
export interface IHttpApiConfiguration {

@@ -26,3 +26,3 @@ serverFactory: (requestListener: (incomingMessage: IncomingMessage, serverResponse: ServerResponse) => void) => Server;

loggers: LoggerCollection;
contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>): RequestContext;
contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<IUser>): RequestContext;
private readonly rootAction;

@@ -29,0 +29,0 @@ mainRequestListener(incomingMessage: IncomingMessage, serverResponse: ServerResponse): Promise<void>;

@@ -9,4 +9,4 @@ /// <reference types="node" />

};
export interface IIdentityServiceOptions<TUser> {
users: IPhysicalStore<TUser>;
export interface IIdentityServiceOptions<TUser extends IUser> {
users: IPhysicalStore<ILoginUser<TUser>>;
cookieName: string;

@@ -16,3 +16,3 @@ hashMethod: (plain: string) => string;

}
export declare class IdentityService<TUser extends ILoginUser<IUser> = ILoginUser<IUser>> {
export declare class IdentityService<TUser extends IUser = IUser> {
readonly sessions: Map<string, number>;

@@ -19,0 +19,0 @@ authenticateUser(userName: string, password: string): Promise<TUser>;

import { IUser } from "@furystack/core";
import { IdentityService, ILoginUser } from "..";
import { IdentityService } from "..";
/**
* Interface for implementing an external login provider
*/
export interface IExternalLoginService<TUser extends ILoginUser<IUser>, TArgs extends any[]> {
export interface IExternalLoginService<TUser extends IUser, TArgs extends any[]> {
login(identityService: IdentityService<TUser>, ...args: TArgs): Promise<TUser>;
}

@@ -5,7 +5,7 @@ /// <reference types="node" />

import { IncomingMessage, ServerResponse } from "http";
import { IdentityService, ILoginUser } from "./IdentityService";
import { IdentityService } from "./IdentityService";
export declare class RequestContext implements IContext {
readonly incomingMessage: IncomingMessage;
readonly serverResponse: ServerResponse;
readonly identityService: IdentityService<ILoginUser<IUser>>;
readonly identityService: IdentityService<IUser>;
private readonly injector;

@@ -19,3 +19,3 @@ getInjector: () => Injector;

getCurrentUser(): Promise<IUser>;
constructor(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>, injector?: Injector);
constructor(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<IUser>, injector?: Injector);
}
{
"name": "@furystack/http-api",
"version": "0.2.8",
"version": "0.2.9",
"description": "HTTP Api FuryStack package",

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

@@ -41,3 +41,3 @@ import { IApi, InMemoryStore, IUser, LoggerCollection } from "@furystack/core";

public loggers: LoggerCollection = new LoggerCollection();
public contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>) {
public contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<IUser>) {
return new RequestContext(incomingMessage, serverResponse, identityService);

@@ -44,0 +44,0 @@ }

@@ -9,4 +9,4 @@ import { Constructable, InMemoryStore, IPhysicalStore, IUser, visitorUser } from "@furystack/core";

export interface IIdentityServiceOptions<TUser> {
users: IPhysicalStore<TUser>;
export interface IIdentityServiceOptions<TUser extends IUser> {
users: IPhysicalStore<ILoginUser<TUser>>;
cookieName: string;

@@ -17,3 +17,3 @@ hashMethod: (plain: string) => string;

export class IdentityService<TUser extends ILoginUser<IUser> = ILoginUser<IUser>> {
export class IdentityService<TUser extends IUser = IUser> {
public readonly sessions: Map<string, number> = new Map();

@@ -24,3 +24,3 @@ public async authenticateUser(userName: string, password: string): Promise<TUser> {

Password: this.options.hashMethod(password),
} as Partial<TUser>);
} as Partial<ILoginUser<TUser>>);
if (match.length === 1) {

@@ -27,0 +27,0 @@ return match[0];

@@ -7,4 +7,4 @@ import { IUser } from "@furystack/core";

*/
export interface IExternalLoginService<TUser extends ILoginUser<IUser>, TArgs extends any[]> {
export interface IExternalLoginService<TUser extends IUser, TArgs extends any[]> {
login(identityService: IdentityService<TUser>, ...args: TArgs): Promise<TUser>;
}
import { IContext, IEntityStore, IUser, visitorUser } from "@furystack/core";
import { Injector } from "@furystack/inject";
import { IncomingMessage, ServerResponse } from "http";
import { IdentityService, ILoginUser } from "./IdentityService";
import { IdentityService } from "./IdentityService";

@@ -38,5 +38,5 @@ export class RequestContext implements IContext {

public readonly serverResponse: ServerResponse,
public readonly identityService: IdentityService<ILoginUser<IUser>>,
public readonly identityService: IdentityService<IUser>,
private readonly injector = new Injector(),
) { }
}

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