Skip to content

@lastshotlabs/slingshot-search

npm install @lastshotlabs/slingshot-search

Algolia search provider.

HTTP-based provider that communicates with the Algolia REST API. Uses native fetch (available in Bun) with retry logic and exponential backoff.

Implements the full SearchProvider interface including lifecycle, index management, document operations, search, suggest, and task monitoring.

Algolia operations return task IDs for indexing mutations; search is synchronous.

function createAlgoliaProvider(config: AlgoliaProviderConfig): SearchProvider

Source: packages/slingshot-search/src/providers/algolia.ts

Elasticsearch search provider.

HTTP-based provider that communicates with an Elasticsearch cluster via its REST API. Uses native fetch (available in Bun) with retry logic and exponential backoff.

Implements the full SearchProvider interface including lifecycle, index management, document operations, search, suggest, and task monitoring.

Elasticsearch operations are synchronous for most document/search APIs, so waitForTask is a no-op.

function createElasticsearchProvider(config: ElasticsearchProviderConfig): SearchProvider

Source: packages/slingshot-search/src/providers/elasticsearch.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

function createEventSyncManager(config: EventSyncManagerConfig): EventSyncManager

Source: packages/slingshot-search/src/eventSync.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

function createFileDlqStore(config: FileDlqStoreConfig): FileDlqStore

Source: packages/slingshot-search/src/eventSync.ts

In-memory token-bucket rate limiter for search and suggest routes.

The store is injectable so deployments can swap the in-memory implementation for a Redis or Memcached backend without touching the route handlers.

Default policy: 60 requests / 60 s per (tenant, ip) tuple.

function createInMemoryRateLimitStore(): RateLimitStore

Source: packages/slingshot-search/src/routes/rateLimiter.ts

In-memory token-bucket rate limiter for search and suggest routes.

The store is injectable so deployments can swap the in-memory implementation for a Redis or Memcached backend without touching the route handlers.

Default policy: 60 requests / 60 s per (tenant, ip) tuple.

function createRateLimitMiddleware(options: RateLimitOptions = {}): void

Source: packages/slingshot-search/src/routes/rateLimiter.ts

Circuit breaker for search provider calls at the search-manager level.

Provides manager-level fail-fast behavior when a search provider is unreachable, independent of any provider-level breakers. Mirrors the pattern from slingshot-mail and slingshot-assets so operational behaviour stays uniform across production-track packages.

State machine: closed — normal operation; failures increment a counter. open — fail fast; reject every request until cooldown elapses. half-open — let exactly one probe through; success resets, failure re-opens.

function createSearchCircuitBreaker(opts: SearchCircuitBreakerOptions,): SearchCircuitBreaker

Source: packages/slingshot-search/src/searchCircuitBreaker.ts

Search package factory.

Produces a SlingshotPackageDefinition consumed via createApp({ packages: [...] }).

Lifecycle:

  1. setupMiddleware — registers internal search events on the framework bus.
  2. setupRoutes — mounts per-entity search, suggest, federated, and admin routers.
  3. setupPost — discovers searchable entities, initializes indexes, subscribes to entity CRUD events for eventual sync, publishes the runtime through pluginState (legacy) and the SearchRuntimeCap capability.
  4. teardown — flushes pending syncs and disconnects providers.
function createSearchPackage(rawConfig: SearchPluginConfig, options?: { logger?: Logger },): SlingshotPackageDefinition

Source: packages/slingshot-search/src/plugin.ts

Typesense search provider.

HTTP-based provider that communicates with a Typesense instance via its REST API. Uses native fetch (available in Bun) with retry logic and exponential backoff.

Implements the full SearchProvider interface including lifecycle, index management, document operations, search, suggest, and task monitoring.

Typesense operations are synchronous (no task queue), so waitForTask is a no-op.

function createTypesenseProvider(config: TypesenseProviderConfig): SearchProvider

Source: packages/slingshot-search/src/providers/typesense.ts

Retry with exponential backoff for search provider operations.

Transient failures (timeouts, connection resets, 5xx, 429) are retried automatically. Circuit-open errors and non-transient errors propagate immediately so the circuit breaker can maintain accurate state.

function isTransientError(err: unknown): boolean

Source: packages/slingshot-search/src/retry.ts

Retry with exponential backoff for search provider operations.

Transient failures (timeouts, connection resets, 5xx, 429) are retried automatically. Circuit-open errors and non-transient errors propagate immediately so the circuit breaker can maintain accurate state.

async function withRetry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>,): Promise<T>

Source: packages/slingshot-search/src/retry.ts

Public contract for slingshot-search.

Cross-package consumers resolve SearchRuntimeCap through ctx.capabilities.require(...) to ensure config entities are indexed and to retrieve typed search clients.

Source: packages/slingshot-search/src/public.ts

Named route group identifiers for the search plugin.

Pass values to SearchPluginConfig.disableRoutes to suppress specific route groups at startup.

Source: packages/slingshot-search/src/routes/index.ts

Public contract for slingshot-search.

Cross-package consumers resolve SearchRuntimeCap through ctx.capabilities.require(...) to ensure config entities are indexed and to retrieve typed search clients.

Source: packages/slingshot-search/src/public.ts

Typesense search provider.

HTTP-based provider that communicates with a Typesense instance via its REST API. Uses native fetch (available in Bun) with retry logic and exponential backoff.

Implements the full SearchProvider interface including lifecycle, index management, document operations, search, suggest, and task monitoring.

Typesense operations are synchronous (no task queue), so waitForTask is a no-op.

Source: packages/slingshot-search/src/providers/typesense.ts

Circuit breaker for search provider calls at the search-manager level.

Provides manager-level fail-fast behavior when a search provider is unreachable, independent of any provider-level breakers. Mirrors the pattern from slingshot-mail and slingshot-assets so operational behaviour stays uniform across production-track packages.

State machine: closed — normal operation; failures increment a counter. open — fail fast; reject every request until cooldown elapses. half-open — let exactly one probe through; success resets, failure re-opens.

Source: packages/slingshot-search/src/searchCircuitBreaker.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Thrown when search plugin configuration is invalid.

Source: packages/slingshot-search/src/errors/searchErrors.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Typesense search provider.

HTTP-based provider that communicates with a Typesense instance via its REST API. Uses native fetch (available in Bun) with retry logic and exponential backoff.

Implements the full SearchProvider interface including lifecycle, index management, document operations, search, suggest, and task monitoring.

Typesense operations are synchronous (no task queue), so waitForTask is a no-op.

Source: packages/slingshot-search/src/providers/typesense.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Event-bus sync manager.

Manages event-bus subscriptions for entities with syncMode: 'event-bus'. Supports config-driven entities discovered via the entity registry.

Batches indexing operations with a configurable flush interval and queue size threshold. Deletions are flushed immediately to avoid stale data.

All state is closure-owned — no module-level mutable state.

Source: packages/slingshot-search/src/eventSync.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

In-memory token-bucket rate limiter for search and suggest routes.

The store is injectable so deployments can swap the in-memory implementation for a Redis or Memcached backend without touching the route handlers.

Default policy: 60 requests / 60 s per (tenant, ip) tuple.

Source: packages/slingshot-search/src/routes/rateLimiter.ts

In-memory token-bucket rate limiter for search and suggest routes.

The store is injectable so deployments can swap the in-memory implementation for a Redis or Memcached backend without touching the route handlers.

Default policy: 60 requests / 60 s per (tenant, ip) tuple.

Source: packages/slingshot-search/src/routes/rateLimiter.ts

Retry with exponential backoff for search provider operations.

Transient failures (timeouts, connection resets, 5xx, 429) are retried automatically. Circuit-open errors and non-transient errors propagate immediately so the circuit breaker can maintain accurate state.

Source: packages/slingshot-search/src/retry.ts

Search plugin configuration types.

SearchPluginConfig is passed to createSearchPackage() and controls provider setup, default sync mode, and plugin-level settings.

Source: packages/slingshot-search/src/types/config.ts

Circuit breaker for search provider calls at the search-manager level.

Provides manager-level fail-fast behavior when a search provider is unreachable, independent of any provider-level breakers. Mirrors the pattern from slingshot-mail and slingshot-assets so operational behaviour stays uniform across production-track packages.

State machine: closed — normal operation; failures increment a counter. open — fail fast; reject every request until cooldown elapses. half-open — let exactly one probe through; success resets, failure re-opens.

Source: packages/slingshot-search/src/searchCircuitBreaker.ts

Circuit breaker for search provider calls at the search-manager level.

Provides manager-level fail-fast behavior when a search provider is unreachable, independent of any provider-level breakers. Mirrors the pattern from slingshot-mail and slingshot-assets so operational behaviour stays uniform across production-track packages.

State machine: closed — normal operation; failures increment a counter. open — fail fast; reject every request until cooldown elapses. half-open — let exactly one probe through; success resets, failure re-opens.

Source: packages/slingshot-search/src/searchCircuitBreaker.ts

Circuit breaker for search provider calls at the search-manager level.

Provides manager-level fail-fast behavior when a search provider is unreachable, independent of any provider-level breakers. Mirrors the pattern from slingshot-mail and slingshot-assets so operational behaviour stays uniform across production-track packages.

State machine: closed — normal operation; failures increment a counter. open — fail fast; reject every request until cooldown elapses. half-open — let exactly one probe through; success resets, failure re-opens.

Source: packages/slingshot-search/src/searchCircuitBreaker.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Search plugin configuration types.

SearchPluginConfig is passed to createSearchPackage() and controls provider setup, default sync mode, and plugin-level settings.

Source: packages/slingshot-search/src/types/config.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search response types — structured results from search, suggest, and federated search operations.

Source: packages/slingshot-search/src/types/response.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts

Full search provider interface and provider-specific configurations.

SearchProvider extends the minimal SearchProviderContract from core with lifecycle, index management, search, suggest, and task monitoring.

Source: packages/slingshot-search/src/types/provider.ts

Named route group identifiers for the search plugin.

Pass values to SearchPluginConfig.disableRoutes to suppress specific route groups at startup.

Source: packages/slingshot-search/src/routes/index.ts

Search query types — the full query API for enterprise search.

Supports full-text search, faceted filtering, geo queries, highlighting, snippets, federated (multi-index) search, and autocomplete suggestions.

Source: packages/slingshot-search/src/types/query.ts