Classes
Client
Client for interacting with the TopK API. For available regions see https://docs.topk.io/regions Constructors Constructor
Returns
Client
Methods
collection()
Returns
CollectionClient
collections()
CollectionsClient
CollectionClient
Internal
Client for interacting with a specific collection.
This client provides methods to perform operations on a specific collection,
including querying, upserting, and deleting documents.
Methods
count()
Returns
Promise<number>
delete()
Returns
Promise<string>
deletePartition()
Returns
Promise<void>
get()
Returns
Promise<Record<string, Record<string, any>>>
listPartitions()
Returns
PartitionListStream
query()
Returns
Promise<Record<string, any>[]>
update()
Returns
Promise<string>
The LSN at which the update was applied.
If no updates were applied, this will be empty.
upsert()
Returns
Promise<string>
CollectionsClient
Internal
Client for managing collections.
This client provides methods to create, list, get, and delete collections.
Methods
create()
Returns
Promise<Collection>
delete()
Returns
Promise<void>
get()
Returns
Promise<Collection>
list()
Promise<Collection[]>
PartitionListStream
Iterator for partition list responses. This type implements JavaScript’s async iterable protocol. It can be used withfor await...of loops.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Constructors
Constructor
PartitionListStream
Methods
[asyncIterator]()
AsyncGenerator<Partition, void, undefined>
next()
Promise<Partition>
Interfaces
BackoffConfig
Configuration for exponential backoff between retry attempts. This struct controls how the delay between retry attempts increases over time. All fields are optional and will use sensible defaults if not provided. PropertiesClientConfig
Configuration for the TopK client. This struct contains all the necessary configuration options to connect to the TopK API. Theapi_key and region are required, while other options have sensible defaults.
Properties
Collection
Represents a collection in the TopK service. A collection is a container for documents with a defined schema. This struct contains metadata about the collection including its name, organization, project, schema, and region. PropertiesCollectionFieldSpec
Represents a field specification within a collection schema. This struct defines the properties of a field in a collection, including its data type, whether it’s required, and any index configuration. PropertiesPartition
A partition within a collection. PropertiesQueryOptions
Options for query operations. These options control the behavior of query operations, including consistency guarantees and sequence number constraints. PropertiesRetryConfig
Configuration for retry behavior when requests fail. This struct allows you to customize how the client handles retries for failed requests. All fields are optional and will use sensible defaults if not provided. PropertiesNamespaces
Type Aliases
ConsistencyLevel
Indexed: Query returns results as soon as they are indexed (faster, eventual consistency)Strong: Query waits for all replicas to be consistent (slower, strong consistency)