Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
BREAKING: remove deprecated features (#217)
Browse files Browse the repository at this point in the history
* BREAKING: remove deprecated features

* fmt
  • Loading branch information
boywithkeyboard authored Sep 4, 2023
1 parent c1aa32d commit c833ae3
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 1,412 deletions.
148 changes: 0 additions & 148 deletions build.ts

This file was deleted.

3 changes: 1 addition & 2 deletions cheetah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { base, Method } from './base.ts'
import { Collection } from './collection.ts'
import { Context, Exception } from './context.ts'
import { Exception as OriginalException } from './exception.ts'
import { Extension, validExtension } from './extensions.ts'
import {
Handler,
Expand Down Expand Up @@ -514,7 +513,7 @@ export class cheetah extends base<cheetah>() {
} catch (err) {
let res: Response

if (err instanceof Exception || err instanceof OriginalException) {
if (err instanceof Exception) {
res = err.response(req)
} else {
if (this.#debug) {
Expand Down
118 changes: 0 additions & 118 deletions exception.ts

This file was deleted.

4 changes: 0 additions & 4 deletions extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export type Extension<
cookies?: ValidatedCookies
headers?: ValidatedHeaders
query?: ValidatedQuery
/** @deprecated please pass this option to the `c.req.body()` method! */
transform?: boolean // TODO remove at v2.0
cors?: string
}
| Handler<
Expand Down Expand Up @@ -76,8 +74,6 @@ export type Extension<
cookies?: ValidatedCookies
headers?: ValidatedHeaders
query?: ValidatedQuery
/** @deprecated please pass this option to the `c.req.body()` method! */
transform?: boolean // TODO remove at v2.0
cors?: string
}
| Handler<
Expand Down
4 changes: 0 additions & 4 deletions handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export function handler<T>() {
cookies?: ValidatedCookies
headers?: ValidatedHeaders
query?: ValidatedQuery
/** @deprecated please pass this option to the `c.req.body()` method! */
transform?: boolean // TODO remove at v2.0
cors?: string
params?: Partial<Record<keyof ExtractParams<Pathname>, ZodType>>
gateway?: VersionRange
Expand Down Expand Up @@ -162,8 +160,6 @@ export type HandlerOrSchema =
cookies?: ObjectType
headers?: ObjectType
query?: ObjectType
/** @deprecated please pass this option to the `c.req.body()` method! */
transform?: boolean // TODO remove at v2.0
cors?: string
params?: Record<string, ZodType>
gateway?: VersionRange
Expand Down
1 change: 0 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export type { AppConfig, AppContext } from './cheetah.ts'
export { Collection } from './collection.ts'
export { Context } from './context.ts'
export { decrypt, encrypt } from './crypto.ts'
export { Exception } from './exception.ts'
export { createExtension } from './extensions.ts'
export type { Extension } from './extensions.ts'
export { default as jwt } from './jwt.ts'
Expand Down
6 changes: 2 additions & 4 deletions oauth/get_session_data.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2023 Samuel Kopp. All rights reserved. Apache-2.0 license.
import { getCookies } from 'https://deno.land/std@0.200.0/http/cookie.ts'
import { Context } from '../context.ts'
import { getVariable } from '../x/env.ts'
import { verify } from '../x/jwt.ts'
import { verify } from '../jwt.ts'
import { OAuthSessionData, OAuthSessionToken } from './types.ts'

/**
Expand All @@ -25,9 +24,8 @@ export async function getSessionData(
}

const payload = await verify<OAuthSessionToken>(
c,
cookies.token,
getVariable(c, 'JWT_SECRET') ?? getVariable(c, 'jwt_secret') ??
getVariable(c, 'jwtSecret'),
{ audience: 'oauth:session' },
)

Expand Down
6 changes: 2 additions & 4 deletions oauth/get_session_id.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2023 Samuel Kopp. All rights reserved. Apache-2.0 license.
import { getCookies } from 'https://deno.land/std@0.200.0/http/cookie.ts'
import { Context } from '../context.ts'
import { getVariable } from '../x/env.ts'
import { verify } from '../x/jwt.ts'
import { verify } from '../jwt.ts'
import { OAuthSessionToken } from './types.ts'

/**
Expand All @@ -23,9 +22,8 @@ export async function getSessionId(c: Context): Promise<string | undefined> {
}

const payload = await verify<OAuthSessionToken>(
c,
cookies.token,
getVariable(c, 'JWT_SECRET') ?? getVariable(c, 'jwt_secret') ??
getVariable(c, 'jwtSecret'),
{ audience: 'oauth:session' },
)

Expand Down
7 changes: 3 additions & 4 deletions oauth/get_session_token.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2023 Samuel Kopp. All rights reserved. Apache-2.0 license.
import { getCookies } from 'https://deno.land/std@0.200.0/http/cookie.ts'
import { Context } from '../context.ts'
import { getVariable } from '../x/env.ts'
import { verify } from '../x/jwt.ts'
import { verify } from '../jwt.ts'

/**
* Get the session token without verifying the session.
Expand All @@ -19,8 +18,8 @@ export async function getSessionToken(c: Context) {

const payload = await verify(
cookies.token,
getVariable(c, 'JWT_SECRET') ?? getVariable(c, 'jwt_secret') ??
getVariable(c, 'jwtSecret'),
(c.env('JWT_SECRET') ?? c.env('jwt_secret') ??
c.env('jwtSecret')) as string,
{ audience: 'oauth:session' },
)

Expand Down
Loading

0 comments on commit c833ae3

Please sign in to comment.