@furystack/http-api
Advanced tools
Comparing version 0.1.2 to 0.1.3
/// <reference types="node" /> | ||
import { IApi, IUser, LoggerCollection } from "@furystack/core"; | ||
import { Injector } from "@furystack/inject"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
@@ -21,2 +22,3 @@ import { Server } from "net"; | ||
export declare class HttpApi implements IApi<RequestContext> { | ||
injector: Injector; | ||
loggers: LoggerCollection; | ||
@@ -23,0 +25,0 @@ contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>): RequestContext; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const core_1 = require("@furystack/core"); | ||
const inject_1 = require("@furystack/inject"); | ||
const http_1 = require("http"); | ||
@@ -32,2 +33,3 @@ const url_1 = require("url"); | ||
constructor(options) { | ||
this.injector = new inject_1.Injector(); | ||
this.loggers = new core_1.LoggerCollection(); | ||
@@ -34,0 +36,0 @@ this.options = Object.assign({}, exports.defaultHttpApiConfiguration, options); |
/// <reference types="node" /> | ||
import { IContext, IEntityStore, IUser } from "@furystack/core"; | ||
import { Injector } from "@furystack/inject"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
@@ -9,2 +10,4 @@ import { IdentityService, ILoginUser } from "./IdentityService"; | ||
readonly identityService: IdentityService<ILoginUser<IUser>>; | ||
private readonly injector; | ||
getInjector: () => Injector; | ||
getEntityStore: <T>(type: new (...args: any[]) => T) => IEntityStore<T> | undefined; | ||
@@ -16,3 +19,3 @@ Entities: any; | ||
getCurrentUser(): Promise<IUser>; | ||
constructor(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>); | ||
constructor(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>, injector?: Injector); | ||
} |
@@ -12,7 +12,10 @@ "use strict"; | ||
const core_1 = require("@furystack/core"); | ||
const inject_1 = require("@furystack/inject"); | ||
class RequestContext { | ||
constructor(incomingMessage, serverResponse, identityService) { | ||
constructor(incomingMessage, serverResponse, identityService, injector = new inject_1.Injector()) { | ||
this.incomingMessage = incomingMessage; | ||
this.serverResponse = serverResponse; | ||
this.identityService = identityService; | ||
this.injector = injector; | ||
this.getInjector = () => this.injector; | ||
this.getEntityStore = () => undefined; | ||
@@ -19,0 +22,0 @@ } |
{ | ||
"name": "@furystack/http-api", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "HTTP Api FuryStack package", | ||
@@ -58,3 +58,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@furystack/core": "^0.1.6", | ||
"@furystack/core": "^0.1.8", | ||
"@sensenet/client-utils": "^1.0.1", | ||
@@ -61,0 +61,0 @@ "@types/node": "^10.5.4", |
# http-api | ||
REST | ||
[![Build Status](https://travis-ci.org/furystack/http-api.svg?branch=master)](https://travis-ci.org/furystack/http-api) | ||
[![codecov](https://codecov.io/gh/furystack/http-api/branch/master/graph/badge.svg)](https://codecov.io/gh/furystack/http-api) |
import { IApi, InMemoryStore, IUser, LoggerCollection } from "@furystack/core"; | ||
import { Injector } from "@furystack/inject"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
@@ -36,2 +37,3 @@ import { Server as HttpServer } from "http"; | ||
export class HttpApi implements IApi<RequestContext> { | ||
public injector = new Injector(); | ||
public loggers: LoggerCollection = new LoggerCollection(); | ||
@@ -38,0 +40,0 @@ public contextFactory(incomingMessage: IncomingMessage, serverResponse: ServerResponse, identityService: IdentityService<ILoginUser<IUser>>) { |
import { IContext, IEntityStore, IUser, visitorUser } from "@furystack/core"; | ||
import { Injector } from "@furystack/inject"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
@@ -6,2 +7,3 @@ import { IdentityService, ILoginUser } from "./IdentityService"; | ||
export class RequestContext implements IContext { | ||
public getInjector = () => this.injector; | ||
@@ -38,3 +40,4 @@ public getEntityStore: <T>(type: new (...args: any[]) => T) => IEntityStore<T> | undefined = () => undefined; | ||
public readonly identityService: IdentityService<ILoginUser<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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97383
1310
6
Updated@furystack/core@^0.1.8