@nuxthub/core
Version:
Build full-stack Nuxt applications on Cloudflare, with zero configuration.
44 lines (43 loc) • 1.62 kB
TypeScript
import type { RuntimeConfig } from 'nuxt/schema';
import type { Vectorize } from '@nuxthub/core';
type VectorizeIndexes = keyof RuntimeConfig['hub']['vectorize'] & string;
/**
* Access the Vectorize database.
*
* @param index The Vectorize index to access
*
* @example ```ts
* const vectorize = hubVectorize('products')
* let vectorsToInsert = [
* {id: "123", values: [32.4, 6.5, 11.2, 10.3, 87.9]},
* {id: "456", values: [2.5, 7.8, 9.1, 76.9, 8.5]},
* ]
* let inserted = await vectorize.insert(vectorsToInsert)
* ```
*
* Vectorize is currently only supported with `--remote`.
*
* @see https://hub.nuxt.com/docs/features/vectorize
*/
export declare function hubVectorize(index: VectorizeIndexes): Vectorize | undefined;
/**
* Access the remote Vectorize database.
*
* @param index The Vectorize index to access
* @param projectUrl The project URL (e.g. https://my-deployed-project.nuxt.dev)
* @param secretKey The secret key to authenticate to the remote endpoint
* @param headers The headers to send with the request to the remote endpoint
*
* @example ```ts
* const db = proxyHubVectorize('https://my-deployed-project.nuxt.dev', 'my-secret-key')
* let vectorsToInsert = [
* {id: "123", values: [32.4, 6.5, 11.2, 10.3, 87.9]},
* {id: "456", values: [2.5, 7.8, 9.1, 76.9, 8.5]},
* ]
* let inserted = await vectorize.insert(vectorsToInsert)
* ```
*
* @see https://developers.cloudflare.com/vectorize/reference/client-api/
*/
export declare function proxyHubVectorize(index: VectorizeIndexes, projectUrl: string, secretKey?: string, headers?: HeadersInit): Vectorize;
export {};