11import { prefixStorage } from 'unstorage'
22import { joinURL , withLeadingSlash , withoutTrailingSlash } from 'ufo'
33import { hash as ohash } from 'ohash'
4- import type { CompatibilityEvent } from 'h3'
4+ import type { H3Event } from 'h3'
55// eslint-disable-next-line import/no-named-as-default
66import defu from 'defu'
77import type { QueryBuilderParams , ParsedContent , QueryBuilder , ContentTransformer } from '../types'
@@ -67,7 +67,7 @@ const contentIgnorePredicate = (key: string) => {
6767 return true
6868}
6969
70- export const getContentsIds = async ( event : CompatibilityEvent , prefix ?: string ) => {
70+ export const getContentsIds = async ( event : H3Event , prefix ?: string ) => {
7171 let keys = [ ]
7272
7373 if ( isProduction ) {
@@ -103,14 +103,14 @@ export const getContentsIds = async (event: CompatibilityEvent, prefix?: string)
103103 return keys . filter ( contentIgnorePredicate )
104104}
105105
106- export const getContentsList = async ( event : CompatibilityEvent , prefix ?: string ) => {
106+ export const getContentsList = async ( event : H3Event , prefix ?: string ) => {
107107 const keys = await getContentsIds ( event , prefix )
108108 const contents = await Promise . all ( keys . map ( key => getContent ( event , key ) ) )
109109
110110 return contents
111111}
112112
113- export const getContent = async ( event : CompatibilityEvent , id : string ) : Promise < ParsedContent > => {
113+ export const getContent = async ( event : H3Event , id : string ) : Promise < ParsedContent > => {
114114 const contentId = id
115115 // Handle ignored id
116116 if ( ! contentIgnorePredicate ( id ) ) {
@@ -187,7 +187,7 @@ export async function parseContent (id: string, content: string, opts: ParseCont
187187 return result
188188}
189189
190- export const createServerQueryFetch = < T = ParsedContent > ( event : CompatibilityEvent , path ?: string ) => ( query : QueryBuilder < T > ) => {
190+ export const createServerQueryFetch = < T = ParsedContent > ( event : H3Event , path ?: string ) => ( query : QueryBuilder < T > ) => {
191191 if ( path ) {
192192 if ( query . params ( ) . first ) {
193193 query . where ( { _path : withoutTrailingSlash ( path ) } )
@@ -207,10 +207,10 @@ export const createServerQueryFetch = <T = ParsedContent>(event: CompatibilityEv
207207/**
208208 * Query contents
209209 */
210- export function serverQueryContent < T = ParsedContent > ( event : CompatibilityEvent ) : QueryBuilder < T > ;
211- export function serverQueryContent < T = ParsedContent > ( event : CompatibilityEvent , params ?: QueryBuilderParams ) : QueryBuilder < T > ;
212- export function serverQueryContent < T = ParsedContent > ( event : CompatibilityEvent , path ?: string , ...pathParts : string [ ] ) : QueryBuilder < T > ;
213- export function serverQueryContent < T = ParsedContent > ( event : CompatibilityEvent , path ?: string | QueryBuilderParams , ...pathParts : string [ ] ) {
210+ export function serverQueryContent < T = ParsedContent > ( event : H3Event ) : QueryBuilder < T > ;
211+ export function serverQueryContent < T = ParsedContent > ( event : H3Event , params ?: QueryBuilderParams ) : QueryBuilder < T > ;
212+ export function serverQueryContent < T = ParsedContent > ( event : H3Event , path ?: string , ...pathParts : string [ ] ) : QueryBuilder < T > ;
213+ export function serverQueryContent < T = ParsedContent > ( event : H3Event , path ?: string | QueryBuilderParams , ...pathParts : string [ ] ) {
214214 if ( typeof path === 'string' ) {
215215 path = withLeadingSlash ( joinURL ( path , ...pathParts ) )
216216 return createQuery < T > ( createServerQueryFetch ( event , path ) )
0 commit comments