Skip to content

Commit

Permalink
move session provider to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Nov 25, 2023
1 parent afb6b70 commit e5e4a25
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/constants/fort_global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { ErrorHandler, Logger } from "../models";
import { ViewEngine, XmlParser, ComponentOption } from "../abstracts";
import { EtagOption, FolderMap, TSessionStore } from "../types";
import { GenericGuard, GenericShield, GenericWall, GenericXmlParser } from "../generics";
import { MustacheViewEngine, MemorySessionProvider, DtoValidator } from "../extra";
import { MustacheViewEngine, DtoValidator } from "../extra";
import { APP_NAME, CURRENT_PATH } from "./index";
import * as path from "path";
import { ETAG_TYPE } from "../enums";
import { SessionProvider } from "../utils";
import { IDtoValidator } from "../interfaces";
import { CookieEvaluatorWall, MemorySessionStore, PostDataEvaluatorGuard } from "../providers";

Expand All @@ -18,7 +19,7 @@ export class FortGlobal {
shouldParseCookie = true;
shouldParseBody = true;
sessionStore: TSessionStore;
sessionProvider = MemorySessionProvider;
sessionProvider = SessionProvider;
sessionTimeOut = 60;
viewEngine: ViewEngine;
walls: Array<typeof GenericWall> = [];
Expand Down
5 changes: 1 addition & 4 deletions src/extra/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
export * from './mustache_view_engine';
export * from "./memory_session_provider";
export * from "./dto_validator";
// export * from "./expect_body_guard";
// export * from "./expect_query_shield";
export * from "./dto_validator";
4 changes: 2 additions & 2 deletions src/interfaces/component_prop.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as http from "http";
import { CookieManager, FileManager } from "../models";
import { FortGlobal } from "../constants";
import { MemorySessionProvider } from "../extra";
import { SessionProvider } from "../utils";

export interface IComponentProp {
request: http.IncomingMessage;
response: http.ServerResponse;
query: { [key: string]: any };
body?: { [key: string]: any };
session: MemorySessionProvider;
session: SessionProvider;
cookie: CookieManager;
param?: { [key: string]: string };
data: { [key: string]: any };
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { HttpRequest, HttpResponse } from "../types";
import { CookieManager, FileManager } from "../models";
import { MemorySessionProvider } from "../extra";
import { SessionProvider } from "../utils";

export interface IController {
request: HttpRequest;
response: HttpResponse;
query: { [key: string]: string };
body?: { [key: string]: any };
session: MemorySessionProvider;
session: SessionProvider;
cookie: CookieManager;
param?: { [key: string]: string };
data: { [key: string]: any };
Expand Down
3 changes: 2 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './is_null_or_empty';
export * from './is_null';
export * from './is_array';
export * from './promise_resolve';
export * from './compare_string';
export * from './compare_string';
export * from './session_provider';
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { CookieManager } from "../models";
import * as getUniqId from "uniqid";
import { TSessionStore } from "../types";


export class MemorySessionProvider {
export class SessionProvider {

sessionId: string;
protected cookie: CookieManager;
Expand Down

0 comments on commit e5e4a25

Please sign in to comment.