|
1 | | -import * as session from 'express-session'; |
| 1 | +import { Store, SessionData } from 'express-session'; |
2 | 2 | import { |
3 | 3 | DynamoDBClient, |
4 | 4 | CreateTableCommandInput, |
@@ -170,7 +170,7 @@ export interface DynamoDBStoreOptions { |
170 | 170 | * - $50 / month for writes |
171 | 171 | * - $134 / month total |
172 | 172 | */ |
173 | | -export class DynamoDBStore extends session.Store { |
| 173 | +export class DynamoDBStore extends Store { |
174 | 174 | private _dynamoDBClient: DynamoDBClient; |
175 | 175 | private _ddbDocClient: DynamoDBDocument; |
176 | 176 | private _createTableOptions?: Partial<CreateTableCommandInput>; |
@@ -387,7 +387,7 @@ export class DynamoDBStore extends session.Store { |
387 | 387 | * @param session Session data |
388 | 388 | * @returns void |
389 | 389 | */ |
390 | | - callback: (err: unknown, session?: session.SessionData | null) => void, |
| 390 | + callback: (err: unknown, session?: SessionData | null) => void, |
391 | 391 | ): void { |
392 | 392 | void (async () => { |
393 | 393 | try { |
@@ -445,7 +445,7 @@ export class DynamoDBStore extends session.Store { |
445 | 445 | * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html} |
446 | 446 | * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/time-to-live-ttl-how-to.html} |
447 | 447 | */ |
448 | | - session: session.SessionData, |
| 448 | + session: SessionData, |
449 | 449 | /** |
450 | 450 | * Callback to return an error if the session was not saved |
451 | 451 | * @param err Error |
@@ -499,7 +499,7 @@ export class DynamoDBStore extends session.Store { |
499 | 499 | /** |
500 | 500 | * Session data |
501 | 501 | */ |
502 | | - session: session.SessionData & { lastModified?: string }, |
| 502 | + session: SessionData & { lastModified?: string }, |
503 | 503 | /** |
504 | 504 | * Callback to return an error if the session TTL was not updated |
505 | 505 | */ |
@@ -595,15 +595,15 @@ export class DynamoDBStore extends session.Store { |
595 | 595 | })(); |
596 | 596 | } |
597 | 597 |
|
598 | | - private newExpireSecondsSinceEpochUTC(sess: session.SessionData): number { |
| 598 | + private newExpireSecondsSinceEpochUTC(sess: SessionData): number { |
599 | 599 | const expires = |
600 | 600 | typeof sess.cookie.maxAge === 'number' |
601 | 601 | ? +new Date() + sess.cookie.maxAge |
602 | 602 | : +new Date() + 60 * 60 * 24 * 1000; |
603 | 603 | return Math.floor(expires / 1000); |
604 | 604 | } |
605 | 605 |
|
606 | | - private getTTLSeconds(sess: session.SessionData) { |
| 606 | + private getTTLSeconds(sess: SessionData) { |
607 | 607 | return sess && sess.cookie && sess.cookie.expires |
608 | 608 | ? Math.ceil((Number(new Date(sess.cookie.expires)) - Date.now()) / 1000) |
609 | 609 | : this._touchAfter; |
|
0 commit comments