@outfitter/index 0.2.1 → 0.2.3
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/dist/fts5.d.ts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/migrations.d.ts +1 -1
- package/dist/shared/@outfitter/{index-m0h11hv5.d.ts → index-011azjav.d.ts} +33 -33
- package/dist/shared/@outfitter/{index-ewvzd5f9.d.ts → index-ykxa3yhb.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +5 -4
- package/dist/shared/@outfitter/{index-mmgx1j0h.d.ts → index-dxk50kvh.d.ts} +1 -1
package/dist/fts5.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIndex } from "./shared/@outfitter/index-
|
|
2
|
-
import "./shared/@outfitter/index-
|
|
3
|
-
import "./shared/@outfitter/index-
|
|
1
|
+
import { createIndex } from "./shared/@outfitter/index-ykxa3yhb.js";
|
|
2
|
+
import "./shared/@outfitter/index-011azjav.js";
|
|
3
|
+
import "./shared/@outfitter/index-dxk50kvh.js";
|
|
4
4
|
export { createIndex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createIndex } from "./shared/@outfitter/index-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IndexMigrationRegistry, createMigrationRegistry } from "./shared/@outfitter/index-
|
|
1
|
+
import { createIndex } from "./shared/@outfitter/index-ykxa3yhb.js";
|
|
2
|
+
import { INDEX_VERSION } from "./shared/@outfitter/index-3xe3cd6r.js";
|
|
3
|
+
import { Index, IndexDocument, IndexMetadata, IndexOptions, SearchQuery, SearchResult, TokenizerType } from "./shared/@outfitter/index-011azjav.js";
|
|
4
|
+
import { IndexMigrationRegistry, createMigrationRegistry } from "./shared/@outfitter/index-dxk50kvh.js";
|
|
5
5
|
export { createMigrationRegistry, createIndex, TokenizerType, SearchResult, SearchQuery, IndexOptions, IndexMigrationRegistry, IndexMetadata, IndexDocument, Index, INDEX_VERSION };
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createIndex
|
|
4
4
|
} from "./shared/@outfitter/index-gf30ny51.js";
|
|
5
|
-
import"./shared/@outfitter/index-8fwmfq7d.js";
|
|
6
|
-
import {
|
|
7
|
-
INDEX_VERSION
|
|
8
|
-
} from "./shared/@outfitter/index-bbzmc40h.js";
|
|
9
5
|
import {
|
|
10
6
|
createMigrationRegistry
|
|
11
7
|
} from "./shared/@outfitter/index-1me624ny.js";
|
|
8
|
+
import {
|
|
9
|
+
INDEX_VERSION
|
|
10
|
+
} from "./shared/@outfitter/index-bbzmc40h.js";
|
|
11
|
+
import"./shared/@outfitter/index-8fwmfq7d.js";
|
|
12
12
|
export {
|
|
13
13
|
createMigrationRegistry,
|
|
14
14
|
createIndex,
|
package/dist/migrations.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IndexMigrationContext, IndexMigrationRegistry, MigrationRegistry, createMigrationRegistry } from "./shared/@outfitter/index-
|
|
1
|
+
import { IndexMigrationContext, IndexMigrationRegistry, MigrationRegistry, createMigrationRegistry } from "./shared/@outfitter/index-dxk50kvh.js";
|
|
2
2
|
export { createMigrationRegistry, MigrationRegistry, IndexMigrationRegistry, IndexMigrationContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IndexMigrationRegistry } from "./index-
|
|
1
|
+
import { IndexMigrationRegistry } from "./index-dxk50kvh.js";
|
|
2
2
|
import { Result, StorageError } from "@outfitter/contracts";
|
|
3
3
|
/**
|
|
4
4
|
* FTS5 tokenizer options for text analysis.
|
|
@@ -23,6 +23,10 @@ type TokenizerType = "unicode61" | "porter" | "trigram";
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
interface IndexOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Optional migration registry for upgrading older index versions.
|
|
28
|
+
*/
|
|
29
|
+
migrations?: IndexMigrationRegistry;
|
|
26
30
|
/**
|
|
27
31
|
* Absolute path to the SQLite database file.
|
|
28
32
|
* The file will be created if it does not exist.
|
|
@@ -46,23 +50,19 @@ interface IndexOptions {
|
|
|
46
50
|
* Optional tool version recorded in index metadata.
|
|
47
51
|
*/
|
|
48
52
|
toolVersion?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Optional migration registry for upgrading older index versions.
|
|
51
|
-
*/
|
|
52
|
-
migrations?: IndexMigrationRegistry;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Metadata stored alongside the index to track version and provenance.
|
|
56
56
|
*/
|
|
57
57
|
interface IndexMetadata {
|
|
58
|
-
/** File format version */
|
|
59
|
-
version: number;
|
|
60
58
|
/** When this index was created */
|
|
61
59
|
created: string;
|
|
62
60
|
/** Tool that created the index */
|
|
63
61
|
tool: string;
|
|
64
62
|
/** Tool version that created the index */
|
|
65
63
|
toolVersion: string;
|
|
64
|
+
/** File format version */
|
|
65
|
+
version: number;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* A document to be indexed in the FTS5 index.
|
|
@@ -81,10 +81,10 @@ interface IndexMetadata {
|
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
interface IndexDocument {
|
|
84
|
-
/** Unique identifier for this document */
|
|
85
|
-
id: string;
|
|
86
84
|
/** Searchable text content */
|
|
87
85
|
content: string;
|
|
86
|
+
/** Unique identifier for this document */
|
|
87
|
+
id: string;
|
|
88
88
|
/**
|
|
89
89
|
* Optional metadata associated with the document.
|
|
90
90
|
* Stored as JSON and returned with search results.
|
|
@@ -115,8 +115,6 @@ interface IndexDocument {
|
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
117
|
interface SearchQuery {
|
|
118
|
-
/** FTS5 query string */
|
|
119
|
-
query: string;
|
|
120
118
|
/**
|
|
121
119
|
* Maximum number of results to return.
|
|
122
120
|
* @defaultValue 25
|
|
@@ -127,6 +125,8 @@ interface SearchQuery {
|
|
|
127
125
|
* @defaultValue 0
|
|
128
126
|
*/
|
|
129
127
|
offset?: number;
|
|
128
|
+
/** FTS5 query string */
|
|
129
|
+
query: string;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* A single search result from an FTS5 query.
|
|
@@ -154,23 +154,23 @@ interface SearchQuery {
|
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
156
|
interface SearchResult<T = unknown> {
|
|
157
|
+
/** Full document content */
|
|
158
|
+
content: string;
|
|
159
|
+
/**
|
|
160
|
+
* Matching snippets from the content.
|
|
161
|
+
* Uses FTS5 snippet() function for context-aware highlights.
|
|
162
|
+
*/
|
|
163
|
+
highlights?: string[];
|
|
157
164
|
/** Document ID */
|
|
158
165
|
id: string;
|
|
166
|
+
/** Document metadata (if present) */
|
|
167
|
+
metadata?: T;
|
|
159
168
|
/**
|
|
160
169
|
* BM25 relevance ranking score.
|
|
161
170
|
* Higher scores indicate better matches.
|
|
162
171
|
* Note: FTS5 BM25 returns negative values (closer to 0 = better match).
|
|
163
172
|
*/
|
|
164
173
|
score: number;
|
|
165
|
-
/** Full document content */
|
|
166
|
-
content: string;
|
|
167
|
-
/** Document metadata (if present) */
|
|
168
|
-
metadata?: T;
|
|
169
|
-
/**
|
|
170
|
-
* Matching snippets from the content.
|
|
171
|
-
* Uses FTS5 snippet() function for context-aware highlights.
|
|
172
|
-
*/
|
|
173
|
-
highlights?: string[];
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* The FTS5 index interface for full-text search operations.
|
|
@@ -219,13 +219,16 @@ interface Index<T = unknown> {
|
|
|
219
219
|
*/
|
|
220
220
|
addMany(docs: IndexDocument[]): Promise<Result<void, StorageError>>;
|
|
221
221
|
/**
|
|
222
|
-
*
|
|
223
|
-
* Returns results ranked by BM25 relevance score.
|
|
222
|
+
* Remove all documents from the index.
|
|
224
223
|
*
|
|
225
|
-
* @
|
|
226
|
-
* @returns Result containing array of search results or StorageError
|
|
224
|
+
* @returns Result indicating success or StorageError
|
|
227
225
|
*/
|
|
228
|
-
|
|
226
|
+
clear(): Promise<Result<void, StorageError>>;
|
|
227
|
+
/**
|
|
228
|
+
* Close the index and release resources.
|
|
229
|
+
* The index should not be used after calling close().
|
|
230
|
+
*/
|
|
231
|
+
close(): void;
|
|
229
232
|
/**
|
|
230
233
|
* Remove a document from the index by ID.
|
|
231
234
|
* No error is returned if the document does not exist.
|
|
@@ -235,15 +238,12 @@ interface Index<T = unknown> {
|
|
|
235
238
|
*/
|
|
236
239
|
remove(id: string): Promise<Result<void, StorageError>>;
|
|
237
240
|
/**
|
|
238
|
-
*
|
|
241
|
+
* Search the index using FTS5 query syntax.
|
|
242
|
+
* Returns results ranked by BM25 relevance score.
|
|
239
243
|
*
|
|
240
|
-
* @
|
|
241
|
-
|
|
242
|
-
clear(): Promise<Result<void, StorageError>>;
|
|
243
|
-
/**
|
|
244
|
-
* Close the index and release resources.
|
|
245
|
-
* The index should not be used after calling close().
|
|
244
|
+
* @param query - Search query parameters
|
|
245
|
+
* @returns Result containing array of search results or StorageError
|
|
246
246
|
*/
|
|
247
|
-
|
|
247
|
+
search(query: SearchQuery): Promise<Result<SearchResult<T>[], StorageError>>;
|
|
248
248
|
}
|
|
249
249
|
export { TokenizerType, IndexOptions, IndexMetadata, IndexDocument, SearchQuery, SearchResult, Index };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Index, IndexDocument, IndexMetadata, IndexOptions, SearchQuery, SearchResult, TokenizerType } from "./shared/@outfitter/index-
|
|
2
|
-
import "./shared/@outfitter/index-
|
|
1
|
+
import { Index, IndexDocument, IndexMetadata, IndexOptions, SearchQuery, SearchResult, TokenizerType } from "./shared/@outfitter/index-011azjav.js";
|
|
2
|
+
import "./shared/@outfitter/index-dxk50kvh.js";
|
|
3
3
|
export { TokenizerType, SearchResult, SearchQuery, IndexOptions, IndexMetadata, IndexDocument, Index };
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { INDEX_META_KEY, INDEX_META_TABLE, INDEX_VERSION } from "./shared/@outfitter/index-3xe3cd6r";
|
|
1
|
+
import { INDEX_META_KEY, INDEX_META_TABLE, INDEX_VERSION } from "./shared/@outfitter/index-3xe3cd6r.js";
|
|
2
2
|
export { INDEX_VERSION, INDEX_META_TABLE, INDEX_META_KEY };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outfitter/index",
|
|
3
3
|
"description": "SQLite FTS5 full-text search indexing for Outfitter",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
"lint:fix": "biome lint --write ./src",
|
|
49
49
|
"test": "bun test",
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
|
51
|
-
"clean": "rm -rf dist"
|
|
51
|
+
"clean": "rm -rf dist",
|
|
52
|
+
"prepublishOnly": "bun ../../scripts/check-publish-manifest.ts"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@outfitter/contracts": "0.
|
|
55
|
-
"@outfitter/file-ops": "0.2.
|
|
55
|
+
"@outfitter/contracts": "0.4.1",
|
|
56
|
+
"@outfitter/file-ops": "0.2.3"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/bun": "latest",
|
|
@@ -2,8 +2,8 @@ import { Database } from "bun:sqlite";
|
|
|
2
2
|
import { StorageError } from "@outfitter/contracts";
|
|
3
3
|
import { Result } from "@outfitter/contracts";
|
|
4
4
|
interface MigrationRegistry<TContext> {
|
|
5
|
-
register(fromVersion: number, toVersion: number, migrate: (context: TContext) => Result<void, StorageError>): void;
|
|
6
5
|
migrate(context: TContext, fromVersion: number, toVersion: number): Result<void, StorageError>;
|
|
6
|
+
register(fromVersion: number, toVersion: number, migrate: (context: TContext) => Result<void, StorageError>): void;
|
|
7
7
|
}
|
|
8
8
|
interface IndexMigrationContext {
|
|
9
9
|
readonly db: Database;
|