import { Logger, ModuleProviderExports, ModuleServiceInitializeOptions, ModulesSdkTypes, SearchTypes } from "@medusajs/framework/types"; export declare const SearchProviderIdentifiersRegistrationName = "search_providers_identifier"; export declare const SearchProviderRegistrationPrefix = "srh_"; export type SearchModuleOptions = Partial & { /** * More than one may be registered, unlike most provider-backed modules. A * definition picks one by identifier through its `provider`, so products can * live on a dedicated engine while quieter entities stay on Postgres. */ providers?: { resolve: string | ModuleProviderExports; id: string; options?: Record; }[]; /** * Medusa Cloud search. When set, the module registers the built-in * `search-medusa` provider automatically — same pattern as payment `cloud` * and notification `cloud` email. */ cloud?: { api_key: string; endpoint: string; environment_handle: string; }; default_provider?: string; index_prefix?: string; /** * The definitions this module manages. It does not discover them itself — the * application loads them off the file system and passes them in, so there is one * input rather than two that can disagree. Already normalized: DSL field * schemas are compiled to plain definitions by `defineSearchIndex`, so the * module never sees them. */ indexes?: SearchTypes.SearchIndexDefinition[]; reindex?: { batch_size?: number; }; }; declare module "@medusajs/types" { interface ModuleOptions { "@medusajs/search": SearchModuleOptions; "@medusajs/medusa/search": SearchModuleOptions; } } /** * Handed to the migration and seeding helpers per call; they keep no state of * their own. `indexes` is a live reference to the service's registry, not a copy, * and `providers` is structural so `utils` need not depend on the service layer. */ /** Resolved definitions, keyed by index name. */ export type SearchIndexes = Map; export type SearchIndexContext = { container: SearchTypes.SearchContainer; logger: Logger; options: SearchModuleOptions; indexes: SearchIndexes; providers: { retrieve(identifier: string): SearchTypes.ISearchProvider; }; indexService: ModulesSdkTypes.IMedusaInternalService; versionService: ModulesSdkTypes.IMedusaInternalService; syncService: ModulesSdkTypes.IMedusaInternalService; locking?: { execute(keys: string | string[], job: (signal?: AbortSignal) => Promise, args?: { timeout?: number; expire?: number; }): Promise; }; activeVersionCache?: { get(name: string): Promise<{ physical_name: string; provider: string; version: number; }>; set(name: string, value: { physical_name: string; provider: string; version: number; }): void; }; }; export type SearchIndexRegistry = Pick; export type SearchSeedRuntime = SearchIndexRegistry & Pick; export type SearchIngestionRuntime = SearchIndexRegistry & Pick; /** Event name to the indexes that declared it. */ export type SearchEventRoutes = Map; /** The logical index and which of its versions currently serves reads. */ export type SearchIndexRecord = { id: string; name: string; active_version: number | null; }; /** One physical index ever built for a logical index. */ export type SearchIndexVersionRecord = { id: string; search_index_id: string; version: number; provider: string; physical_name: string; definition_hash: string; status: string; }; /** One seed run against one index version. Append-only, so these are the history. */ export type SearchIndexSyncRecord = { id: string; search_index_version_id: string; job_id: string | null; status: string; filters: Record | null; last_key: string | null; documents_synced: number; started_at: Date | null; completed_at: Date | null; error: string | null; created_at: Date; updated_at: Date; deleted_at: Date | null; }; export type SearchIndexSeedReason = /** Created but never filled. */ "index_created" /** Exists and holds no documents — an engine wiped or restarted underneath us. */ | "index_empty" /** A migration built a new index that has to be filled, then swapped in. */ | "schema_changed" | "last_run_failed"; export type SearchIndexSeedAction = { index: string; /** The version being filled. */ target_version: SearchIndexVersionRecord; /** * Whether `target_version` has to become the index's active version once * filled, rather than being seeded in place as the already-active version. */ swap: boolean; reason: SearchIndexSeedReason; }; //# sourceMappingURL=index.d.ts.map