<commit_before>// Type definitions for express-session
// Project: https://www.npmjs.org/package/express-session
// Definitions by: <NAME> <https://github.com/horiuchi/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference path="../express/express.d.ts" />
/// <reference path="../node/node.d.ts" />

declare namespace Express {

  export interface Request {
    session?: Session;
  }

  export interface Session {
    [key: string]: any;

    regenerate: (callback: (err: any) => void) => void;
    destroy: (callback: (err: any) => void) => void;
    reload: (callback: (err: any) => void) => void;
    save: (callback: (err: any) => void) => void;
    touch: (callback: (err: any) => void) => void;

    cookie: SessionCookie;
  }
  export interface SessionCookie {
    originalMaxAge: number;
    path: string;
    maxAge: number;
    secure?: boolean;
    httpOnly: boolean;
    domain?: string;
    expires: Date;
    serialize: (name: string, value: string) => string;
  }
}

declare module "express-session" {
  import express = require('express');
  import node = require('events');

  function session(options?: session.SessionOptions): express.RequestHandler;

  namespace session {
    export interface SessionOptions {
      secret: string;
      name?: string;
      store?: Store | MemoryStore;
      cookie?: express.CookieOptions;
      genid?: (req: express.Request) => string;
      rolling?: boolean;
      resave?: boolean;
      proxy?: boolean;
      saveUninitialized?: boolean;
      unset?: string;
    }

	export interface BaseMemoryStore {
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      length?: (callback: (err: any, length: number) => void) => void;
      clear?: (callback: (err: any) => void) => void;
    }

    export abstract class Store extends node.EventEmitter {
	  constructor(config?: any);

	  regenerate (req: express.Request, fn: (err: any) => any): void;
      load (sid: string, fn: (err: any, session: Express.Session) => any): void;
      createSession (req: express.Request, sess: Express.Session): void;
      
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void;
      length: (callback: (err: any, length: number) => void) => void;
      clear: (callback: (err: any) => void) => void;
    }

    export class MemoryStore implements BaseMemoryStore {
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void;
      length: (callback: (err: any, length: number) => void) => void;
      clear: (callback: (err: any) => void) => void;
    }
  }

  export = session;
}

<commit_msg>support for req.session.cookie.expires to be false added (false means: cookie to remain for only the duration of the user-agent)<commit_after>// Type definitions for express-session
// Project: https://www.npmjs.org/package/express-session
// Definitions by: <NAME> <https://github.com/horiuchi/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference path="../express/express.d.ts" />
/// <reference path="../node/node.d.ts" />

declare namespace Express {

  export interface Request {
    session?: Session;
  }

  export interface Session {
    [key: string]: any;

    regenerate: (callback: (err: any) => void) => void;
    destroy: (callback: (err: any) => void) => void;
    reload: (callback: (err: any) => void) => void;
    save: (callback: (err: any) => void) => void;
    touch: (callback: (err: any) => void) => void;

    cookie: SessionCookie;
  }
  export interface SessionCookie {
    originalMaxAge: number;
    path: string;
    maxAge: number;
    secure?: boolean;
    httpOnly: boolean;
    domain?: string;
    expires: Date | boolean;
    serialize: (name: string, value: string) => string;
  }
}

declare module "express-session" {
  import express = require('express');
  import node = require('events');

  function session(options?: session.SessionOptions): express.RequestHandler;

  namespace session {
    export interface SessionOptions {
      secret: string;
      name?: string;
      store?: Store | MemoryStore;
      cookie?: express.CookieOptions;
      genid?: (req: express.Request) => string;
      rolling?: boolean;
      resave?: boolean;
      proxy?: boolean;
      saveUninitialized?: boolean;
      unset?: string;
    }

	export interface BaseMemoryStore {
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      length?: (callback: (err: any, length: number) => void) => void;
      clear?: (callback: (err: any) => void) => void;
    }

    export abstract class Store extends node.EventEmitter {
	  constructor(config?: any);

	  regenerate (req: express.Request, fn: (err: any) => any): void;
      load (sid: string, fn: (err: any, session: Express.Session) => any): void;
      createSession (req: express.Request, sess: Express.Session): void;
      
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void;
      length: (callback: (err: any, length: number) => void) => void;
      clear: (callback: (err: any) => void) => void;
    }

    export class MemoryStore implements BaseMemoryStore {
      get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
      set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
      destroy: (sid: string, callback: (err: any) => void) => void;
      all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void;
      length: (callback: (err: any, length: number) => void) => void;
      clear: (callback: (err: any) => void) => void;
    }
  }

  export = session;
}


{'fraction_non_alphanumeric': 0.16502426827474628, 'fraction_numerical': 0.0, 'mean_word_length': 3.2848141146817897, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 107, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4024039', 'n_tokens_mistral': 2075, 'n_tokens_neox': 2036, 'n_words': 649}