Files
supabase/apps/docs/resources/reference/referenceCLIModel.ts
Charis 03dcd51700 feat(content api): search result for cli reference (#35488)
## Before

Search results ignored if they are CLI references.

## After

Search results returned for CLI references.
2025-05-06 19:23:40 -04:00

33 lines
764 B
TypeScript

import { Json } from 'common'
import { isPlainObject } from '~/features/helpers.misc'
import { type SearchResultInterface } from '../globalSearch/globalSearchInterface'
export const DB_METADATA_TAG_PLATFORM_CLI = 'cli'
export class ReferenceCLICommandModel implements SearchResultInterface {
public title?: string
public href?: string
public content?: string
constructor({
title,
href,
content,
subsections,
}: {
title?: string
href?: string
content?: string
subsections?: Array<Json>
}) {
this.title = title
this.href = href
this.content =
content +
'\n\n' +
subsections
?.map((subsection) => (isPlainObject(subsection) && subsection.content) || '')
.join('\n\n')
}
}