@mastra/core
Version:
34 lines • 1.57 kB
TypeScript
import type { IMastraLogger } from '../logger/logger.js';
/** A single entry in the `inlineLinks` config. */
export type InlineLinkEntry = string | {
match: string;
mimeType: string;
};
/** Resolved inline-link rule after normalisation. */
export interface InlineLinkRule {
match: string;
/** If set, skip HEAD and use this mime type directly. */
forcedMimeType?: string;
}
/**
* Build a predicate from the `inlineMedia` config option.
* Supports glob patterns (e.g. `'image/*'`) and custom functions.
* Default: see `DEFAULT_INLINE_MEDIA_TYPES`.
*/
export declare function buildInlineMediaCheck(config?: string[] | ((mimeType: string) => boolean)): (mimeType: string) => boolean;
/**
* Normalise the `inlineLinks` config into a list of rules.
* Returns `undefined` if the feature is disabled.
*/
export declare function normalizeInlineLinks(config?: InlineLinkEntry[]): InlineLinkRule[] | undefined;
/** Check if a URL's hostname matches a domain pattern. @internal */
export declare function matchesDomain(url: string, pattern: string): boolean;
/** Find the first matching inline-link rule for a URL. */
export declare function findInlineLinkRule(url: string, rules: InlineLinkRule[]): InlineLinkRule | undefined;
export declare function extractUrls(text: string): string[];
/**
* HEAD a URL to determine its Content-Type.
* Returns undefined if the request fails or has no Content-Type.
*/
export declare function headContentType(url: string, logger?: IMastraLogger): Promise<string | undefined>;
//# sourceMappingURL=inline-media.d.ts.map