@prodisco/search-libs 0.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 +21 -0
- package/README.md +379 -0
- package/dist/__tests__/extractor.test.d.ts +5 -0
- package/dist/__tests__/extractor.test.d.ts.map +1 -0
- package/dist/__tests__/extractor.test.js +452 -0
- package/dist/__tests__/extractor.test.js.map +1 -0
- package/dist/__tests__/library-indexer.test.d.ts +5 -0
- package/dist/__tests__/library-indexer.test.d.ts.map +1 -0
- package/dist/__tests__/library-indexer.test.js +611 -0
- package/dist/__tests__/library-indexer.test.js.map +1 -0
- package/dist/__tests__/schema.test.d.ts +5 -0
- package/dist/__tests__/schema.test.d.ts.map +1 -0
- package/dist/__tests__/schema.test.js +231 -0
- package/dist/__tests__/schema.test.js.map +1 -0
- package/dist/__tests__/script-parser.test.d.ts +5 -0
- package/dist/__tests__/script-parser.test.d.ts.map +1 -0
- package/dist/__tests__/script-parser.test.js +178 -0
- package/dist/__tests__/script-parser.test.js.map +1 -0
- package/dist/__tests__/search-engine.test.d.ts +5 -0
- package/dist/__tests__/search-engine.test.d.ts.map +1 -0
- package/dist/__tests__/search-engine.test.js +497 -0
- package/dist/__tests__/search-engine.test.js.map +1 -0
- package/dist/extractor/ast-parser.d.ts +48 -0
- package/dist/extractor/ast-parser.d.ts.map +1 -0
- package/dist/extractor/ast-parser.js +118 -0
- package/dist/extractor/ast-parser.js.map +1 -0
- package/dist/extractor/function-extractor.d.ts +20 -0
- package/dist/extractor/function-extractor.d.ts.map +1 -0
- package/dist/extractor/function-extractor.js +169 -0
- package/dist/extractor/function-extractor.js.map +1 -0
- package/dist/extractor/index.d.ts +22 -0
- package/dist/extractor/index.d.ts.map +1 -0
- package/dist/extractor/index.js +194 -0
- package/dist/extractor/index.js.map +1 -0
- package/dist/extractor/method-extractor.d.ts +30 -0
- package/dist/extractor/method-extractor.d.ts.map +1 -0
- package/dist/extractor/method-extractor.js +163 -0
- package/dist/extractor/method-extractor.js.map +1 -0
- package/dist/extractor/package-resolver.d.ts +77 -0
- package/dist/extractor/package-resolver.d.ts.map +1 -0
- package/dist/extractor/package-resolver.js +766 -0
- package/dist/extractor/package-resolver.js.map +1 -0
- package/dist/extractor/type-extractor.d.ts +15 -0
- package/dist/extractor/type-extractor.d.ts.map +1 -0
- package/dist/extractor/type-extractor.js +206 -0
- package/dist/extractor/type-extractor.js.map +1 -0
- package/dist/extractor/types.d.ts +116 -0
- package/dist/extractor/types.d.ts.map +1 -0
- package/dist/extractor/types.js +5 -0
- package/dist/extractor/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/library-indexer.d.ts +104 -0
- package/dist/library-indexer.d.ts.map +1 -0
- package/dist/library-indexer.js +295 -0
- package/dist/library-indexer.js.map +1 -0
- package/dist/schema/base-schema.d.ts +63 -0
- package/dist/schema/base-schema.d.ts.map +1 -0
- package/dist/schema/base-schema.js +63 -0
- package/dist/schema/base-schema.js.map +1 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/schema-builder.d.ts +47 -0
- package/dist/schema/schema-builder.d.ts.map +1 -0
- package/dist/schema/schema-builder.js +236 -0
- package/dist/schema/schema-builder.js.map +1 -0
- package/dist/script/index.d.ts +6 -0
- package/dist/script/index.d.ts.map +1 -0
- package/dist/script/index.js +5 -0
- package/dist/script/index.js.map +1 -0
- package/dist/script/script-parser.d.ts +18 -0
- package/dist/script/script-parser.d.ts.map +1 -0
- package/dist/script/script-parser.js +246 -0
- package/dist/script/script-parser.js.map +1 -0
- package/dist/script/types.d.ts +32 -0
- package/dist/script/types.d.ts.map +1 -0
- package/dist/script/types.js +5 -0
- package/dist/script/types.js.map +1 -0
- package/dist/search/index.d.ts +7 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +7 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/query-builder.d.ts +59 -0
- package/dist/search/query-builder.d.ts.map +1 -0
- package/dist/search/query-builder.js +103 -0
- package/dist/search/query-builder.js.map +1 -0
- package/dist/search/result-formatter.d.ts +61 -0
- package/dist/search/result-formatter.d.ts.map +1 -0
- package/dist/search/result-formatter.js +170 -0
- package/dist/search/result-formatter.js.map +1 -0
- package/dist/search/search-engine.d.ts +105 -0
- package/dist/search/search-engine.d.ts.map +1 -0
- package/dist/search/search-engine.js +245 -0
- package/dist/search/search-engine.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LibraryIndexer - High-level API for indexing and searching TypeScript libraries
|
|
3
|
+
*/
|
|
4
|
+
import { extractFromPackage } from './extractor/index.js';
|
|
5
|
+
import { parseScript, parseScriptsFromDirectory } from './script/index.js';
|
|
6
|
+
import { buildTypeDocument, buildMethodDocument, buildFunctionDocument, buildScriptDocument, } from './schema/schema-builder.js';
|
|
7
|
+
import { SearchEngine } from './search/search-engine.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build a compact type definition string for an extracted type.
|
|
10
|
+
* Recursively expands nested type references up to maxDepth levels.
|
|
11
|
+
*/
|
|
12
|
+
function buildCompactTypeDefinition(type, typeRegistry, depth = 0, maxDepth = 2) {
|
|
13
|
+
const props = type.properties
|
|
14
|
+
.slice(0, 10)
|
|
15
|
+
.map(p => {
|
|
16
|
+
let propType = p.type;
|
|
17
|
+
// Recursively expand nested types if we haven't hit max depth
|
|
18
|
+
if (depth < maxDepth && !isPrimitiveOrBuiltin(p.type)) {
|
|
19
|
+
const baseTypeName = extractBaseTypeName(p.type);
|
|
20
|
+
const nestedType = typeRegistry.get(baseTypeName);
|
|
21
|
+
if (nestedType) {
|
|
22
|
+
const nestedDef = buildCompactTypeDefinition(nestedType, typeRegistry, depth + 1, maxDepth);
|
|
23
|
+
// Preserve array notation
|
|
24
|
+
if (p.type.endsWith('[]')) {
|
|
25
|
+
propType = `${nestedDef}[]`;
|
|
26
|
+
}
|
|
27
|
+
else if (p.type.startsWith('Array<')) {
|
|
28
|
+
propType = `${nestedDef}[]`;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
propType = nestedDef;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return `${p.name}${p.optional ? '?' : ''}: ${propType}`;
|
|
36
|
+
})
|
|
37
|
+
.join(', ');
|
|
38
|
+
const more = type.properties.length > 10 ? `, ... +${type.properties.length - 10} more` : '';
|
|
39
|
+
return `{ ${props}${more} }`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Expand parameter types using a type registry
|
|
43
|
+
*/
|
|
44
|
+
function expandMethodTypes(method, typeRegistry) {
|
|
45
|
+
// Expand parameter types
|
|
46
|
+
const expandedParams = method.parameters.map(param => {
|
|
47
|
+
// Skip primitives and built-in types
|
|
48
|
+
if (isPrimitiveOrBuiltin(param.type)) {
|
|
49
|
+
return param;
|
|
50
|
+
}
|
|
51
|
+
// Extract the base type name (handle Promise<X>, Array<X>, etc.)
|
|
52
|
+
const baseTypeName = extractBaseTypeName(param.type);
|
|
53
|
+
const typeInfo = typeRegistry.get(baseTypeName);
|
|
54
|
+
if (typeInfo) {
|
|
55
|
+
return {
|
|
56
|
+
...param,
|
|
57
|
+
typeDefinition: buildCompactTypeDefinition(typeInfo, typeRegistry),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return param;
|
|
61
|
+
});
|
|
62
|
+
// Expand return type
|
|
63
|
+
let returnTypeDefinition;
|
|
64
|
+
const returnBaseType = extractBaseTypeName(method.returnType);
|
|
65
|
+
const returnTypeInfo = typeRegistry.get(returnBaseType);
|
|
66
|
+
if (returnTypeInfo && !isPrimitiveOrBuiltin(method.returnType)) {
|
|
67
|
+
returnTypeDefinition = buildCompactTypeDefinition(returnTypeInfo, typeRegistry);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...method,
|
|
71
|
+
parameters: expandedParams,
|
|
72
|
+
returnTypeDefinition,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if a type is a primitive or built-in type
|
|
77
|
+
*/
|
|
78
|
+
function isPrimitiveOrBuiltin(typeName) {
|
|
79
|
+
const primitives = new Set([
|
|
80
|
+
'string', 'number', 'boolean', 'void', 'null', 'undefined',
|
|
81
|
+
'any', 'unknown', 'never', 'object', 'Date', 'RegExp',
|
|
82
|
+
'Promise', 'Array', 'Map', 'Set', 'Record',
|
|
83
|
+
]);
|
|
84
|
+
const baseType = extractBaseTypeName(typeName);
|
|
85
|
+
return primitives.has(baseType);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Extract the base type name from a complex type
|
|
89
|
+
* e.g., "Promise<TimeRange>" -> "TimeRange"
|
|
90
|
+
* "Array<Sample>" -> "Sample"
|
|
91
|
+
* "TimeRange" -> "TimeRange"
|
|
92
|
+
*/
|
|
93
|
+
function extractBaseTypeName(typeName) {
|
|
94
|
+
// Handle Promise<X>, Array<X>, etc.
|
|
95
|
+
const genericMatch = typeName.match(/^(?:Promise|Array|Set|Map)<(.+)>$/);
|
|
96
|
+
if (genericMatch) {
|
|
97
|
+
return extractBaseTypeName(genericMatch[1]);
|
|
98
|
+
}
|
|
99
|
+
// Handle arrays like X[]
|
|
100
|
+
if (typeName.endsWith('[]')) {
|
|
101
|
+
return extractBaseTypeName(typeName.slice(0, -2));
|
|
102
|
+
}
|
|
103
|
+
// Handle union types - take the first non-null type
|
|
104
|
+
if (typeName.includes('|')) {
|
|
105
|
+
const parts = typeName.split('|').map(p => p.trim());
|
|
106
|
+
for (const part of parts) {
|
|
107
|
+
if (part !== 'null' && part !== 'undefined') {
|
|
108
|
+
return extractBaseTypeName(part);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return typeName.trim();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* High-level API for indexing and searching TypeScript libraries
|
|
116
|
+
*/
|
|
117
|
+
export class LibraryIndexer {
|
|
118
|
+
options;
|
|
119
|
+
engine;
|
|
120
|
+
initialized = false;
|
|
121
|
+
indexedScripts = new Set();
|
|
122
|
+
constructor(options) {
|
|
123
|
+
this.options = options;
|
|
124
|
+
this.engine = new SearchEngine();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Initialize the indexer - extracts and indexes all configured packages
|
|
128
|
+
*/
|
|
129
|
+
async initialize() {
|
|
130
|
+
if (this.initialized) {
|
|
131
|
+
return { indexed: 0, errors: [], packageCounts: {} };
|
|
132
|
+
}
|
|
133
|
+
await this.engine.initialize();
|
|
134
|
+
const errors = [];
|
|
135
|
+
const packageCounts = {};
|
|
136
|
+
let totalIndexed = 0;
|
|
137
|
+
for (const packageConfig of this.options.packages) {
|
|
138
|
+
const result = await this.indexPackage(packageConfig);
|
|
139
|
+
errors.push(...result.errors);
|
|
140
|
+
packageCounts[packageConfig.name] = result.indexed;
|
|
141
|
+
totalIndexed += result.indexed;
|
|
142
|
+
}
|
|
143
|
+
this.initialized = true;
|
|
144
|
+
return {
|
|
145
|
+
indexed: totalIndexed,
|
|
146
|
+
errors,
|
|
147
|
+
packageCounts,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Index a single package
|
|
152
|
+
*/
|
|
153
|
+
async indexPackage(config) {
|
|
154
|
+
const result = extractFromPackage({
|
|
155
|
+
packageName: config.name,
|
|
156
|
+
typeFilter: config.typeFilter,
|
|
157
|
+
methodFilter: config.methodFilter,
|
|
158
|
+
classFilter: config.classFilter,
|
|
159
|
+
basePath: this.options.basePath,
|
|
160
|
+
});
|
|
161
|
+
const documents = [];
|
|
162
|
+
// Build a type registry for expanding method parameter/return types
|
|
163
|
+
const typeRegistry = new Map();
|
|
164
|
+
for (const type of result.types) {
|
|
165
|
+
typeRegistry.set(type.name, type);
|
|
166
|
+
}
|
|
167
|
+
// Build documents from extracted types
|
|
168
|
+
for (const type of result.types) {
|
|
169
|
+
documents.push(buildTypeDocument(type));
|
|
170
|
+
}
|
|
171
|
+
// Build documents from extracted methods with expanded types
|
|
172
|
+
for (const method of result.methods) {
|
|
173
|
+
const expandedMethod = expandMethodTypes(method, typeRegistry);
|
|
174
|
+
documents.push(buildMethodDocument(expandedMethod));
|
|
175
|
+
}
|
|
176
|
+
// Build documents from extracted functions
|
|
177
|
+
for (const func of result.functions) {
|
|
178
|
+
documents.push(buildFunctionDocument(func));
|
|
179
|
+
}
|
|
180
|
+
// Insert all documents
|
|
181
|
+
if (documents.length > 0) {
|
|
182
|
+
await this.engine.insertBatch(documents);
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
indexed: documents.length,
|
|
186
|
+
errors: result.errors,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Add a script to the index
|
|
191
|
+
*/
|
|
192
|
+
async addScript(filePath) {
|
|
193
|
+
await this.ensureInitialized();
|
|
194
|
+
// Skip if already indexed
|
|
195
|
+
if (this.indexedScripts.has(filePath)) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
const script = parseScript(filePath);
|
|
199
|
+
if (!script) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const doc = buildScriptDocument(script);
|
|
203
|
+
await this.engine.insert(doc);
|
|
204
|
+
this.indexedScripts.add(filePath);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Add all scripts from a directory
|
|
209
|
+
*/
|
|
210
|
+
async addScriptsFromDirectory(dirPath, options) {
|
|
211
|
+
await this.ensureInitialized();
|
|
212
|
+
const scripts = parseScriptsFromDirectory(dirPath, {
|
|
213
|
+
recursive: options?.recursive,
|
|
214
|
+
});
|
|
215
|
+
let added = 0;
|
|
216
|
+
for (const script of scripts) {
|
|
217
|
+
if (!this.indexedScripts.has(script.filePath)) {
|
|
218
|
+
const doc = buildScriptDocument(script);
|
|
219
|
+
await this.engine.insert(doc);
|
|
220
|
+
this.indexedScripts.add(script.filePath);
|
|
221
|
+
added++;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return added;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Remove a script from the index
|
|
228
|
+
*/
|
|
229
|
+
async removeScript(filePath) {
|
|
230
|
+
if (!this.indexedScripts.has(filePath)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
// Find the script filename to build the ID
|
|
234
|
+
const filename = filePath.split('/').pop() || filePath.split('\\').pop() || filePath;
|
|
235
|
+
const id = `script:${filename}`;
|
|
236
|
+
try {
|
|
237
|
+
await this.engine.remove(id);
|
|
238
|
+
this.indexedScripts.delete(filePath);
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Add custom documents to the index
|
|
247
|
+
*/
|
|
248
|
+
async addDocuments(docs) {
|
|
249
|
+
await this.ensureInitialized();
|
|
250
|
+
await this.engine.insertBatch(docs);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Search the index
|
|
254
|
+
*/
|
|
255
|
+
async search(options) {
|
|
256
|
+
await this.ensureInitialized();
|
|
257
|
+
return this.engine.search(options);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the underlying search engine
|
|
261
|
+
*/
|
|
262
|
+
getEngine() {
|
|
263
|
+
return this.engine;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Check if initialized
|
|
267
|
+
*/
|
|
268
|
+
isInitialized() {
|
|
269
|
+
return this.initialized;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Shutdown the indexer
|
|
273
|
+
*/
|
|
274
|
+
async shutdown() {
|
|
275
|
+
await this.engine.shutdown();
|
|
276
|
+
this.initialized = false;
|
|
277
|
+
this.indexedScripts.clear();
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Add a new package to an already-initialized indexer
|
|
281
|
+
*/
|
|
282
|
+
async addPackage(config) {
|
|
283
|
+
await this.ensureInitialized();
|
|
284
|
+
return this.indexPackage(config);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Ensure the indexer is initialized
|
|
288
|
+
*/
|
|
289
|
+
async ensureInitialized() {
|
|
290
|
+
if (!this.initialized) {
|
|
291
|
+
await this.initialize();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=library-indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-indexer.js","sourceRoot":"","sources":["../src/library-indexer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;GAGG;AACH,SAAS,0BAA0B,CACjC,IAAmB,EACnB,YAAwC,EACxC,QAAgB,CAAC,EACjB,WAAmB,CAAC;IAEpB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU;SAC1B,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE;QACP,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC;QAEtB,8DAA8D;QAC9D,IAAI,KAAK,GAAG,QAAQ,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,MAAM,YAAY,GAAG,mBAAmB,CA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,UAAU,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Orama schema for indexing TypeScript libraries and scripts
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Orama schema type definition
|
|
6
|
+
*/
|
|
7
|
+
export type OramaSchemaType = Record<string, 'string' | 'number' | 'boolean' | 'enum' | 'string[]' | 'number[]' | 'boolean[]'>;
|
|
8
|
+
/**
|
|
9
|
+
* Base schema fields that all indexed documents share.
|
|
10
|
+
* Consumers can extend this with domain-specific fields.
|
|
11
|
+
*
|
|
12
|
+
* Design decisions based on Orama best practices:
|
|
13
|
+
* - `string` types for full-text searchable fields
|
|
14
|
+
* - `enum` types for exact-match filterable fields
|
|
15
|
+
*/
|
|
16
|
+
export declare const baseSchema: {
|
|
17
|
+
readonly id: "string";
|
|
18
|
+
readonly documentType: "enum";
|
|
19
|
+
readonly name: "string";
|
|
20
|
+
readonly description: "string";
|
|
21
|
+
readonly searchTokens: "string";
|
|
22
|
+
readonly library: "enum";
|
|
23
|
+
readonly category: "enum";
|
|
24
|
+
readonly properties: "string";
|
|
25
|
+
readonly typeDefinition: "string";
|
|
26
|
+
readonly nestedTypes: "string";
|
|
27
|
+
readonly typeKind: "enum";
|
|
28
|
+
readonly parameters: "string";
|
|
29
|
+
readonly returnType: "string";
|
|
30
|
+
readonly returnTypeDefinition: "string";
|
|
31
|
+
readonly signature: "string";
|
|
32
|
+
readonly className: "string";
|
|
33
|
+
readonly filePath: "string";
|
|
34
|
+
readonly keywords: "string";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Type for documents indexed with the base schema
|
|
38
|
+
*/
|
|
39
|
+
export type BaseDocument = {
|
|
40
|
+
id: string;
|
|
41
|
+
documentType: 'type' | 'method' | 'function' | 'script' | 'metric';
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
searchTokens: string;
|
|
45
|
+
library: string;
|
|
46
|
+
category: string;
|
|
47
|
+
properties: string;
|
|
48
|
+
typeDefinition: string;
|
|
49
|
+
nestedTypes: string;
|
|
50
|
+
typeKind: string;
|
|
51
|
+
parameters: string;
|
|
52
|
+
returnType: string;
|
|
53
|
+
returnTypeDefinition: string;
|
|
54
|
+
signature: string;
|
|
55
|
+
className: string;
|
|
56
|
+
filePath: string;
|
|
57
|
+
keywords: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Create an empty base document with default values
|
|
61
|
+
*/
|
|
62
|
+
export declare function createEmptyDocument(): BaseDocument;
|
|
63
|
+
//# sourceMappingURL=base-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-schema.d.ts","sourceRoot":"","sources":["../../src/schema/base-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC;AAE/H;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CA8Ba,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IAGjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAGlB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAqBlD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Orama schema for indexing TypeScript libraries and scripts
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base schema fields that all indexed documents share.
|
|
6
|
+
* Consumers can extend this with domain-specific fields.
|
|
7
|
+
*
|
|
8
|
+
* Design decisions based on Orama best practices:
|
|
9
|
+
* - `string` types for full-text searchable fields
|
|
10
|
+
* - `enum` types for exact-match filterable fields
|
|
11
|
+
*/
|
|
12
|
+
export const baseSchema = {
|
|
13
|
+
// === Identity ===
|
|
14
|
+
id: 'string',
|
|
15
|
+
documentType: 'enum', // 'type' | 'method' | 'function' | 'script'
|
|
16
|
+
name: 'string',
|
|
17
|
+
// === Search Content ===
|
|
18
|
+
description: 'string',
|
|
19
|
+
searchTokens: 'string', // CamelCase split tokens for better matching
|
|
20
|
+
// === Organization ===
|
|
21
|
+
library: 'enum', // Package name
|
|
22
|
+
category: 'enum', // Kind or action category
|
|
23
|
+
// === Type-specific fields ===
|
|
24
|
+
properties: 'string', // JSON array of PropertyInfo
|
|
25
|
+
typeDefinition: 'string', // Formatted type definition
|
|
26
|
+
nestedTypes: 'string', // Comma-separated referenced type names
|
|
27
|
+
typeKind: 'enum', // 'class' | 'interface' | 'enum' | 'type-alias'
|
|
28
|
+
// === Method/function-specific fields ===
|
|
29
|
+
parameters: 'string', // JSON array of ParameterInfo (includes typeDefinition for complex types)
|
|
30
|
+
returnType: 'string',
|
|
31
|
+
returnTypeDefinition: 'string', // Expanded return type definition for complex types
|
|
32
|
+
signature: 'string',
|
|
33
|
+
className: 'string', // For methods, the owning class
|
|
34
|
+
// === Script-specific fields ===
|
|
35
|
+
filePath: 'string',
|
|
36
|
+
keywords: 'string',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create an empty base document with default values
|
|
40
|
+
*/
|
|
41
|
+
export function createEmptyDocument() {
|
|
42
|
+
return {
|
|
43
|
+
id: '',
|
|
44
|
+
documentType: 'type',
|
|
45
|
+
name: '',
|
|
46
|
+
description: '',
|
|
47
|
+
searchTokens: '',
|
|
48
|
+
library: '',
|
|
49
|
+
category: '',
|
|
50
|
+
properties: '',
|
|
51
|
+
typeDefinition: '',
|
|
52
|
+
nestedTypes: '',
|
|
53
|
+
typeKind: '',
|
|
54
|
+
parameters: '',
|
|
55
|
+
returnType: '',
|
|
56
|
+
returnTypeDefinition: '',
|
|
57
|
+
signature: '',
|
|
58
|
+
className: '',
|
|
59
|
+
filePath: '',
|
|
60
|
+
keywords: '',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=base-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-schema.js","sourceRoot":"","sources":["../../src/schema/base-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,mBAAmB;IACnB,EAAE,EAAE,QAAQ;IACZ,YAAY,EAAE,MAAM,EAAE,4CAA4C;IAClE,IAAI,EAAE,QAAQ;IAEd,yBAAyB;IACzB,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,QAAQ,EAAE,6CAA6C;IAErE,uBAAuB;IACvB,OAAO,EAAE,MAAM,EAAE,eAAe;IAChC,QAAQ,EAAE,MAAM,EAAE,0BAA0B;IAE5C,+BAA+B;IAC/B,UAAU,EAAE,QAAQ,EAAE,6BAA6B;IACnD,cAAc,EAAE,QAAQ,EAAE,4BAA4B;IACtD,WAAW,EAAE,QAAQ,EAAE,wCAAwC;IAC/D,QAAQ,EAAE,MAAM,EAAE,gDAAgD;IAElE,0CAA0C;IAC1C,UAAU,EAAE,QAAQ,EAAE,0EAA0E;IAChG,UAAU,EAAE,QAAQ;IACpB,oBAAoB,EAAE,QAAQ,EAAE,oDAAoD;IACpF,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ,EAAE,gCAAgC;IAErD,iCAAiC;IACjC,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;CACgB,CAAC;AAgCrC;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,EAAE,EAAE,EAAE;QACN,YAAY,EAAE,MAAM;QACpB,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;QACd,oBAAoB,EAAE,EAAE;QACxB,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema module - Orama schema definitions and builders
|
|
3
|
+
*/
|
|
4
|
+
export { baseSchema, type BaseDocument, createEmptyDocument } from './base-schema.js';
|
|
5
|
+
export { buildSchema, buildDocument, buildTypeDocument, buildMethodDocument, buildFunctionDocument, buildScriptDocument, type SchemaBuilderOptions, type ExtensionSchema, } from './schema-builder.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema module - Orama schema definitions and builders
|
|
3
|
+
*/
|
|
4
|
+
export { baseSchema, createEmptyDocument } from './base-schema.js';
|
|
5
|
+
export { buildSchema, buildDocument, buildTypeDocument, buildMethodDocument, buildFunctionDocument, buildScriptDocument, } from './schema-builder.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAqB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GAGpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extensible schema builder for custom fields
|
|
3
|
+
*/
|
|
4
|
+
import { baseSchema, type BaseDocument } from './base-schema.js';
|
|
5
|
+
import type { ExtractedType, ExtractedMethod, ExtractedFunction } from '../extractor/types.js';
|
|
6
|
+
import type { CachedScript } from '../script/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Extension schema type - additional fields to add to base schema
|
|
9
|
+
*/
|
|
10
|
+
export type ExtensionSchema = Record<string, 'string' | 'enum' | 'number' | 'boolean'>;
|
|
11
|
+
/**
|
|
12
|
+
* Options for building an extended schema
|
|
13
|
+
*/
|
|
14
|
+
export interface SchemaBuilderOptions<T extends ExtensionSchema> {
|
|
15
|
+
/** Additional fields to add to the base schema */
|
|
16
|
+
extensions?: T;
|
|
17
|
+
/** Tokenizer options */
|
|
18
|
+
tokenizerOptions?: {
|
|
19
|
+
stemming?: boolean;
|
|
20
|
+
stemmerSkipProperties?: string[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build a schema with optional extensions
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildSchema<T extends ExtensionSchema = Record<string, never>>(options?: SchemaBuilderOptions<T>): typeof baseSchema & T;
|
|
27
|
+
/**
|
|
28
|
+
* Build a document from an extracted type
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildTypeDocument(type: ExtractedType): BaseDocument;
|
|
31
|
+
/**
|
|
32
|
+
* Build a document from an extracted method
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildMethodDocument(method: ExtractedMethod): BaseDocument;
|
|
35
|
+
/**
|
|
36
|
+
* Build a document from an extracted function
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildFunctionDocument(func: ExtractedFunction): BaseDocument;
|
|
39
|
+
/**
|
|
40
|
+
* Build a document from a cached script
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildScriptDocument(script: CachedScript): BaseDocument;
|
|
43
|
+
/**
|
|
44
|
+
* Build a document from any extracted item
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildDocument(item: ExtractedType | ExtractedMethod | ExtractedFunction | CachedScript): BaseDocument;
|
|
47
|
+
//# sourceMappingURL=schema-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-builder.d.ts","sourceRoot":"","sources":["../../src/schema/schema-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAuB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,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