Skip to content

Commit

Permalink
fix(sentry): fixed sentry options types (#130)
Browse files Browse the repository at this point in the history
* fix(sentry): fixed sentry options types

* changeset
  • Loading branch information
yusukebe authored Aug 23, 2023
1 parent 9f901b9 commit de2e95a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-hotels-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/sentry': patch
---

fixed sentry options types
15 changes: 3 additions & 12 deletions packages/sentry/deno_dist/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Context, MiddlewareHandler } from 'https://deno.land/x/hono/mod.ts'
import Toucan from 'https://cdn.skypack.dev/toucan-js@2.7.0'
import type { Options as ToucanOptions } from 'https://cdn.skypack.dev/toucan-js@2.7.0'

declare module 'https://deno.land/x/hono/mod.ts' {
interface ContextVariableMap {
Expand All @@ -11,23 +12,13 @@ class MockContext implements ExecutionContext {
passThroughOnException(): void {
throw new Error('Method not implemented.')
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async waitUntil(promise: Promise<any>): Promise<void> {
await promise
}
}

export type Options = {
dsn?: string
allowedCookies?: string[] | RegExp
allowedHeaders?: string[] | RegExp
allowedSearchParams?: string[] | RegExp
attachStacktrace?: boolean
debug?: boolean
environment?: string
maxBreadcrumbs?: number
pkg?: Record<string, any>
release?: string
}
export type Options = Omit<ToucanOptions, 'request' | 'context'>

export const sentry = (
options?: Options,
Expand Down
15 changes: 3 additions & 12 deletions packages/sentry/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Context, MiddlewareHandler } from 'hono'
import Toucan from 'toucan-js'
import type { Options as ToucanOptions } from 'toucan-js'

declare module 'hono' {
interface ContextVariableMap {
Expand All @@ -11,23 +12,13 @@ class MockContext implements ExecutionContext {
passThroughOnException(): void {
throw new Error('Method not implemented.')
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async waitUntil(promise: Promise<any>): Promise<void> {
await promise
}
}

export type Options = {
dsn?: string
allowedCookies?: string[] | RegExp
allowedHeaders?: string[] | RegExp
allowedSearchParams?: string[] | RegExp
attachStacktrace?: boolean
debug?: boolean
environment?: string
maxBreadcrumbs?: number
pkg?: Record<string, any>
release?: string
}
export type Options = Omit<ToucanOptions, 'request' | 'context'>

export const sentry = (
options?: Options,
Expand Down
2 changes: 1 addition & 1 deletion packages/sentry/src/replacer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ makeThisModuleAnExecutableReplacer(async ({ parsedImportExportStatement, version
...parsedImportExportStatement,
parsedArgument: {
type: 'URL',
url: `https://deno.land/x/hono/mod.ts`,
url: 'https://deno.land/x/hono/mod.ts',
},
})
}
Expand Down
1 change: 1 addition & 0 deletions packages/sentry/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Context implements ExecutionContext {
passThroughOnException(): void {
throw new Error('Method not implemented.')
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async waitUntil(promise: Promise<any>): Promise<void> {
await promise
}
Expand Down

0 comments on commit de2e95a

Please sign in to comment.