Skip to content

Commit

Permalink
chore: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Feb 20, 2024
1 parent b19d4a5 commit b3d0739
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"rc9": "^2.1.1",
"ufo": "^1.4.0",
"uncrypto": "^0.1.3",
"unstorage": "^1.10.1",
"wrangler": "^3.28.3",
"zod": "^3.22.4"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/runtime/server/utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { H3Error } from 'h3'

let _db: D1Database

export function useDatabase() {
export function useDatabase(): D1Database {
if (_db) {
return _db
}
Expand All @@ -23,7 +23,7 @@ export function useDatabase() {
throw createError('Missing Cloudflare DB binding (D1)')
}

export function useProxyDatabase(projectUrl: string, secretKey?: string) {
export function useProxyDatabase(projectUrl: string, secretKey?: string): D1Database {
const d1API = ofetch.create({
baseURL: joinURL(projectUrl, '/api/_hub/database'),
method: 'POST',
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/utils/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { joinURL } from 'ufo'

let _kv: Storage

export function useKV() {
export function useKV(): Storage {
if (_kv) {
return _kv
}
Expand All @@ -27,7 +27,7 @@ export function useKV() {
throw createError('Missing Cloudflare KV binding (KV)')
}

export function useProxyKV(projectUrl: string, secretKey?: string) {
export function useProxyKV(projectUrl: string, secretKey?: string): Storage {
return createStorage({
driver: httpDriver({
base: joinURL(projectUrl, '/api/_hub/kv/'),
Expand Down

0 comments on commit b3d0739

Please sign in to comment.