@soulcraft/brainy 0.31.0 → 0.33.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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Utility functions for tracking and managing field names in JSON documents
3
+ */
4
+ /**
5
+ * Extracts field names from a JSON document
6
+ * @param jsonObject The JSON object to extract field names from
7
+ * @param options Configuration options
8
+ * @returns An array of field paths (e.g., "user.name", "addresses[0].city")
9
+ */
10
+ export declare function extractFieldNamesFromJson(jsonObject: any, options?: {
11
+ maxDepth?: number;
12
+ currentDepth?: number;
13
+ currentPath?: string;
14
+ fieldNames?: Set<string>;
15
+ }): string[];
16
+ /**
17
+ * Maps field names to standard field names based on common patterns
18
+ * @param fieldName The field name to map
19
+ * @returns The standard field name if a match is found, or null if no match
20
+ */
21
+ export declare function mapToStandardField(fieldName: string): string | null;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldNameTracking.d.ts","sourceRoot":"","sources":["../../src/utils/fieldNameTracking.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,GAAG,EACf,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACpB,GACL,MAAM,EAAE,CAkDV;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsCnE"}
@@ -2,3 +2,5 @@ export * from './distance.js';
2
2
  export * from './embedding.js';
3
3
  export * from './workerUtils.js';
4
4
  export * from './statistics.js';
5
+ export * from './jsonProcessing.js';
6
+ export * from './fieldNameTracking.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Utility functions for processing JSON documents for vectorization and search
3
+ */
4
+ /**
5
+ * Extracts text from a JSON object for vectorization
6
+ * This function recursively processes the JSON object and extracts text from all fields
7
+ * It can also prioritize specific fields if provided
8
+ *
9
+ * @param jsonObject The JSON object to extract text from
10
+ * @param options Configuration options for text extraction
11
+ * @returns A string containing the extracted text
12
+ */
13
+ export declare function extractTextFromJson(jsonObject: any, options?: {
14
+ priorityFields?: string[];
15
+ excludeFields?: string[];
16
+ includeFieldNames?: boolean;
17
+ maxDepth?: number;
18
+ currentDepth?: number;
19
+ fieldPath?: string[];
20
+ }): string;
21
+ /**
22
+ * Prepares a JSON document for vectorization
23
+ * This function extracts text from the JSON document and formats it for optimal vectorization
24
+ *
25
+ * @param jsonDocument The JSON document to prepare
26
+ * @param options Configuration options for preparation
27
+ * @returns A string ready for vectorization
28
+ */
29
+ export declare function prepareJsonForVectorization(jsonDocument: any, options?: {
30
+ priorityFields?: string[];
31
+ excludeFields?: string[];
32
+ includeFieldNames?: boolean;
33
+ maxDepth?: number;
34
+ }): string;
35
+ /**
36
+ * Extracts text from a specific field in a JSON document
37
+ * This is useful for searching within specific fields
38
+ *
39
+ * @param jsonDocument The JSON document to extract from
40
+ * @param fieldPath The path to the field (e.g., "user.name" or "addresses[0].city")
41
+ * @returns The extracted text or empty string if field not found
42
+ */
43
+ export declare function extractFieldFromJson(jsonDocument: any, fieldPath: string): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonProcessing.d.ts","sourceRoot":"","sources":["../../src/utils/jsonProcessing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,GAAG,EACf,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,GACL,MAAM,CAsGR;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,GAAG,EACjB,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;CACb,GACL,MAAM,CAmBR;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,GAAG,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAkDR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "A vector graph database using HNSW indexing with Origin Private File System storage",
5
5
  "main": "dist/unified.js",
6
6
  "module": "dist/unified.js",