Skip to content

Commit 8ec1796

Browse files
committed
refactor: drop unncessary dependencies and self implement cookie parser and serializer
1 parent e0cb747 commit 8ec1796

29 files changed

+1672
-792
lines changed

adonis-typings/http-server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ declare module '@ioc:Adonis/Core/Server' {
2020
import { RouteHandlerNode, RouterContract } from '@ioc:Adonis/Core/Route'
2121
import { IncomingMessage, ServerResponse, Server as HttpServer } from 'http'
2222

23+
export type CookieOptions = {
24+
domain: string,
25+
expires: Date | (() => Date),
26+
httpOnly: boolean,
27+
maxAge: number | string,
28+
path: string,
29+
sameSite: boolean | 'lax' | 'none' | 'strict',
30+
secure: boolean,
31+
}
32+
2333
/**
2434
* Before hooks are executed before finding the route or finding
2535
* middleware

adonis-typings/request.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ declare module '@ioc:Adonis/Core/Request' {
6565
hasBody (): boolean
6666
fresh (): boolean
6767
stale (): boolean
68-
cookies (): { [key: string]: any }
69-
plainCookies (): { [key: string]: any }
68+
cookiesList (): { [key: string]: any }
7069
cookie (key: string, defaultValue?: any): any
70+
encryptedCookie (key: string, defaultValue?: any): any
7171
plainCookie (key: string, defaultValue?: any): any
72-
hasValidSignature (): boolean
72+
hasValidSignature (purpose?: string): boolean
7373
toJSON (): any
7474
}
7575

adonis-typings/response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
*/
1313

1414
declare module '@ioc:Adonis/Core/Response' {
15-
import { CookieOptions } from '@poppinss/cookie'
1615
import { ServerResponse, IncomingMessage } from 'http'
1716
import { MacroableConstructorContract } from 'macroable'
17+
import { CookieOptions } from '@ioc:Adonis/Core/Server'
1818
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
1919

2020
/**

adonis-typings/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ declare module '@ioc:Adonis/Core/Route' {
245245

246246
makeSignedUrl (
247247
routeIdentifier: string,
248-
options?: MakeUrlOptions & { expiresIn?: string | number },
248+
options?: MakeUrlOptions & { expiresIn?: string | number, purpose?: string },
249249
domain?: string,
250250
): string | null
251251
}

0 commit comments

Comments
 (0)