@basaltkit/search 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Machize Contributors
3
+ Copyright (c) 2026 Basalt Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.d.ts CHANGED
@@ -156,6 +156,13 @@ interface SearchPluginOptions {
156
156
  indexes?: IndexDefinition[];
157
157
  /** Rules keeping indexes in sync with domain hooks. */
158
158
  sync?: SyncRule[];
159
+ /**
160
+ * Throw if an index fails to register at boot. Default `false`: a search
161
+ * backend that's down or misconfigured logs a warning and the app boots
162
+ * anyway (search stays degraded until the backend is reachable), so an outage
163
+ * never blocks unrelated work — including CLI commands that don't use search.
164
+ */
165
+ failOnRegisterError?: boolean;
159
166
  }
160
167
  declare function searchPlugin(options?: SearchPluginOptions): _basaltkit_core.BasaltPlugin<unknown>;
161
168
 
package/dist/index.js CHANGED
@@ -221,7 +221,18 @@ function searchPlugin(options = {}) {
221
221
  async boot({ container, hooks }) {
222
222
  const search = container.get(SEARCH);
223
223
  if (driver.register) {
224
- for (const index of options.indexes ?? []) await driver.register(index);
224
+ for (const index of options.indexes ?? []) {
225
+ try {
226
+ await driver.register(index);
227
+ } catch (error) {
228
+ if (options.failOnRegisterError) throw error;
229
+ console.warn(
230
+ `[basalt:search] could not register index "${index.name}": ${String(
231
+ error?.message ?? error
232
+ )} \u2014 search is degraded until the backend is reachable.`
233
+ );
234
+ }
235
+ }
225
236
  }
226
237
  for (const rule of options.sync ?? []) {
227
238
  hooks.on(rule.hook, async (payload) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basaltkit/search",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Full-text search for Basalt: tenant-scoped indexing and querying with a pluggable driver (in-memory for dev/test, Meilisearch for production) and automatic sync from domain events.",
5
5
  "license": "MIT",
6
6
  "type": "module",