UNPKG

@sensinum/astro-strapi-loader

Version:
23 lines (22 loc) 1.22 kB
import { z, CollectionConfig } from "astro:content"; import type { StrapiContentType } from "../types/strapi"; export interface StrapiRequestOptions { url: string; token?: string; path: string; queryParams?: string; } export interface StrapiCollectionsGeneratorOptions extends Omit<StrapiRequestOptions, "path"> { strict?: boolean; } export interface StrapiCollection { name: string; query: Record<string, any>; } export declare function fetchContentTypes(options: Omit<StrapiRequestOptions, "path">): Promise<Array<StrapiContentType>>; export declare function fetchContent(options: Omit<StrapiRequestOptions, "path"> & { contentType: string; }): Promise<any>; export declare function generateStrapiSchema(options: Omit<StrapiCollectionsGeneratorOptions, "path">): Promise<Record<string, z.ZodObject<any>>>; export declare function generateCollection(contentType: string, schema: z.ZodObject<any>, options: StrapiCollectionsGeneratorOptions, query?: Record<string, any>): CollectionConfig<any>; export declare function generateCollections(options: StrapiCollectionsGeneratorOptions, reqCollections?: Array<StrapiCollection | string>): Promise<Record<string, CollectionConfig<any>>>;