Skip to content

Overview / Database

Database

Accessors

data

get data(): objectOutputType<object, ZodTypeAny, "passthrough">

Gets the database object.

Returns

objectOutputType<object, ZodTypeAny, "passthrough">

A deep clone of the database data.

NameType
activeFormsZodDefault<ZodSet<ZodString>>
activePluginsZodDefault<ZodSet<ZodString>>
activeToolsZodDefault<ZodSet<ZodString>>
cacheZodObject<object, "strip", ZodTypeAny, object, object>
chunkOverlapZodDefault<ZodNumber>
chunkSizeZodDefault<ZodNumber>
embeddersZodDefault<ZodArray<ZodObject<object, "strip", ZodTypeAny, object, object>, "many">>
instantToolZodDefault<ZodBoolean>
llmsZodDefault<ZodArray<ZodObject<object, "strip", ZodTypeAny, object, object>, "many">>
rateLimiterZodObject<object, "strip", ZodTypeAny, object, object>
selectedEmbedderZodDefault<ZodString>
selectedLLMZodDefault<ZodString>

keys

get keys(): ZodObject<object, "passthrough", ZodTypeAny, objectOutputType<object, ZodTypeAny, "passthrough">, objectInputType<object, ZodTypeAny, "passthrough">>

Gets the schema of the default keys of the database.

Returns

ZodObject<object, "passthrough", ZodTypeAny, objectOutputType<object, ZodTypeAny, "passthrough">, objectInputType<object, ZodTypeAny, "passthrough">>

NameType
activeFormsZodDefault<ZodSet<ZodString>>
activePluginsZodDefault<ZodSet<ZodString>>
activeToolsZodDefault<ZodSet<ZodString>>
cacheZodObject<object, "strip", ZodTypeAny, object, object>
chunkOverlapZodDefault<ZodNumber>
chunkSizeZodDefault<ZodNumber>
embeddersZodDefault<ZodArray<ZodObject<object, "strip", ZodTypeAny, object, object>, "many">>
instantToolZodDefault<ZodBoolean>
llmsZodDefault<ZodArray<ZodObject<object, "strip", ZodTypeAny, object, object>, "many">>
rateLimiterZodObject<object, "strip", ZodTypeAny, object, object>
selectedEmbedderZodDefault<ZodString>
selectedLLMZodDefault<ZodString>

Methods

delete()

delete(key): void

Deletes a key-value pair from the database.

Parameters

ParameterTypeDescription
keystringThe key of the pair to delete.

Returns

void


parse()

parse(data): SafeParseReturnType<objectInputType<object, ZodTypeAny, "passthrough">, objectOutputType<object, ZodTypeAny, "passthrough">>

Parses the given data.

Parameters

ParameterTypeDescription
dataobjectOutputType<object, ZodTypeAny, "passthrough">The data to be parsed.

Returns

SafeParseReturnType<objectInputType<object, ZodTypeAny, "passthrough">, objectOutputType<object, ZodTypeAny, "passthrough">>

The safely parsed data.


update()

update(fn): void

Updates the database configuration and reads the updated configuration.

Parameters

ParameterTypeDescription
fn(db) => voidA function that takes the current database configuration as a parameter and updates it.

Returns

void


init()

static init(path): Database

Initializes the database with the specified path.

Parameters

ParameterTypeDescription
pathstringThe path to the database.

Returns

Database

The initialized database instance.

Released under the GPL-3.0 License.