@soulcraft/brainy 3.0.0 → 3.0.1

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.
Files changed (260) hide show
  1. package/CHANGELOG.md +53 -3
  2. package/README.md +353 -110
  3. package/bin/brainy.js +340 -62
  4. package/dist/api/ConfigAPI.d.ts +67 -0
  5. package/dist/api/ConfigAPI.js +166 -0
  6. package/dist/api/DataAPI.d.ts +123 -0
  7. package/dist/api/DataAPI.js +391 -0
  8. package/dist/api/SecurityAPI.d.ts +50 -0
  9. package/dist/api/SecurityAPI.js +139 -0
  10. package/dist/api/UniversalImportAPI.d.ts +134 -0
  11. package/dist/api/UniversalImportAPI.js +615 -0
  12. package/dist/augmentationManager.js +12 -7
  13. package/dist/augmentationPipeline.d.ts +0 -61
  14. package/dist/augmentationPipeline.js +0 -87
  15. package/dist/augmentationRegistry.d.ts +1 -1
  16. package/dist/augmentationRegistry.js +1 -1
  17. package/dist/augmentations/apiServerAugmentation.d.ts +27 -1
  18. package/dist/augmentations/apiServerAugmentation.js +290 -9
  19. package/dist/augmentations/auditLogAugmentation.d.ts +109 -0
  20. package/dist/augmentations/auditLogAugmentation.js +358 -0
  21. package/dist/augmentations/batchProcessingAugmentation.d.ts +3 -2
  22. package/dist/augmentations/batchProcessingAugmentation.js +123 -22
  23. package/dist/augmentations/brainyAugmentation.d.ts +142 -8
  24. package/dist/augmentations/brainyAugmentation.js +179 -2
  25. package/dist/augmentations/cacheAugmentation.d.ts +8 -5
  26. package/dist/augmentations/cacheAugmentation.js +116 -17
  27. package/dist/augmentations/conduitAugmentations.d.ts +2 -2
  28. package/dist/augmentations/conduitAugmentations.js +2 -2
  29. package/dist/augmentations/configResolver.d.ts +122 -0
  30. package/dist/augmentations/configResolver.js +440 -0
  31. package/dist/augmentations/connectionPoolAugmentation.d.ts +3 -1
  32. package/dist/augmentations/connectionPoolAugmentation.js +37 -12
  33. package/dist/augmentations/defaultAugmentations.d.ts +14 -10
  34. package/dist/augmentations/defaultAugmentations.js +16 -11
  35. package/dist/augmentations/discovery/catalogDiscovery.d.ts +142 -0
  36. package/dist/augmentations/discovery/catalogDiscovery.js +249 -0
  37. package/dist/augmentations/discovery/localDiscovery.d.ts +84 -0
  38. package/dist/augmentations/discovery/localDiscovery.js +246 -0
  39. package/dist/augmentations/discovery/runtimeLoader.d.ts +97 -0
  40. package/dist/augmentations/discovery/runtimeLoader.js +337 -0
  41. package/dist/augmentations/discovery.d.ts +152 -0
  42. package/dist/augmentations/discovery.js +441 -0
  43. package/dist/augmentations/display/cache.d.ts +130 -0
  44. package/dist/augmentations/display/cache.js +319 -0
  45. package/dist/augmentations/display/fieldPatterns.d.ts +52 -0
  46. package/dist/augmentations/display/fieldPatterns.js +393 -0
  47. package/dist/augmentations/display/iconMappings.d.ts +57 -0
  48. package/dist/augmentations/display/iconMappings.js +68 -0
  49. package/dist/augmentations/display/intelligentComputation.d.ts +109 -0
  50. package/dist/augmentations/display/intelligentComputation.js +462 -0
  51. package/dist/augmentations/display/types.d.ts +203 -0
  52. package/dist/augmentations/display/types.js +7 -0
  53. package/dist/augmentations/entityRegistryAugmentation.d.ts +3 -1
  54. package/dist/augmentations/entityRegistryAugmentation.js +5 -1
  55. package/dist/augmentations/indexAugmentation.d.ts +5 -3
  56. package/dist/augmentations/indexAugmentation.js +5 -2
  57. package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +24 -7
  58. package/dist/augmentations/intelligentVerbScoringAugmentation.js +111 -27
  59. package/dist/augmentations/manifest.d.ts +176 -0
  60. package/dist/augmentations/manifest.js +8 -0
  61. package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +168 -0
  62. package/dist/augmentations/marketplace/AugmentationMarketplace.js +329 -0
  63. package/dist/augmentations/marketplace/cli.d.ts +47 -0
  64. package/dist/augmentations/marketplace/cli.js +265 -0
  65. package/dist/augmentations/metricsAugmentation.d.ts +3 -3
  66. package/dist/augmentations/metricsAugmentation.js +2 -2
  67. package/dist/augmentations/monitoringAugmentation.d.ts +3 -3
  68. package/dist/augmentations/monitoringAugmentation.js +2 -2
  69. package/dist/augmentations/neuralImport.d.ts +1 -1
  70. package/dist/augmentations/neuralImport.js +4 -4
  71. package/dist/augmentations/rateLimitAugmentation.d.ts +82 -0
  72. package/dist/augmentations/rateLimitAugmentation.js +321 -0
  73. package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +2 -2
  74. package/dist/augmentations/requestDeduplicatorAugmentation.js +1 -1
  75. package/dist/augmentations/storageAugmentation.d.ts +1 -1
  76. package/dist/augmentations/storageAugmentation.js +2 -2
  77. package/dist/augmentations/storageAugmentations.d.ts +37 -8
  78. package/dist/augmentations/storageAugmentations.js +204 -15
  79. package/dist/augmentations/synapseAugmentation.d.ts +1 -1
  80. package/dist/augmentations/synapseAugmentation.js +35 -16
  81. package/dist/augmentations/typeMatching/brainyTypes.d.ts +83 -0
  82. package/dist/augmentations/typeMatching/brainyTypes.js +425 -0
  83. package/dist/augmentations/typeMatching/intelligentTypeMatcher.d.ts +39 -59
  84. package/dist/augmentations/typeMatching/intelligentTypeMatcher.js +103 -389
  85. package/dist/augmentations/universalDisplayAugmentation.d.ts +191 -0
  86. package/dist/augmentations/universalDisplayAugmentation.js +371 -0
  87. package/dist/brainy-unified.d.ts +106 -0
  88. package/dist/brainy-unified.js +327 -0
  89. package/dist/brainy.d.ts +273 -0
  90. package/dist/brainy.js +1181 -0
  91. package/dist/brainyData.d.ts +56 -111
  92. package/dist/brainyData.js +912 -756
  93. package/dist/brainyDataV3.d.ts +186 -0
  94. package/dist/brainyDataV3.js +337 -0
  95. package/dist/browserFramework.d.ts +6 -6
  96. package/dist/browserFramework.js +11 -8
  97. package/dist/browserFramework.minimal.d.ts +5 -5
  98. package/dist/browserFramework.minimal.js +11 -8
  99. package/dist/config/distributedPresets-new.d.ts +118 -0
  100. package/dist/config/distributedPresets-new.js +318 -0
  101. package/dist/config/distributedPresets.d.ts +118 -0
  102. package/dist/config/distributedPresets.js +318 -0
  103. package/dist/config/extensibleConfig.d.ts +99 -0
  104. package/dist/config/extensibleConfig.js +268 -0
  105. package/dist/config/index.d.ts +17 -0
  106. package/dist/config/index.js +35 -0
  107. package/dist/config/modelAutoConfig.d.ts +32 -0
  108. package/dist/config/modelAutoConfig.js +139 -0
  109. package/dist/config/modelPrecisionManager.d.ts +42 -0
  110. package/dist/config/modelPrecisionManager.js +98 -0
  111. package/dist/config/sharedConfigManager.d.ts +67 -0
  112. package/dist/config/sharedConfigManager.js +215 -0
  113. package/dist/config/storageAutoConfig.d.ts +41 -0
  114. package/dist/config/storageAutoConfig.js +328 -0
  115. package/dist/config/zeroConfig.d.ts +68 -0
  116. package/dist/config/zeroConfig.js +301 -0
  117. package/dist/cortex/backupRestore.d.ts +2 -2
  118. package/dist/cortex/backupRestore.js +85 -27
  119. package/dist/cortex/healthCheck.d.ts +2 -2
  120. package/dist/cortex/neuralImport.d.ts +2 -2
  121. package/dist/cortex/neuralImport.js +18 -13
  122. package/dist/cortex/performanceMonitor.d.ts +2 -2
  123. package/dist/critical/model-guardian.d.ts +4 -0
  124. package/dist/critical/model-guardian.js +31 -11
  125. package/dist/demo.d.ts +4 -4
  126. package/dist/demo.js +7 -7
  127. package/dist/distributed/cacheSync.d.ts +112 -0
  128. package/dist/distributed/cacheSync.js +265 -0
  129. package/dist/distributed/coordinator.d.ts +193 -0
  130. package/dist/distributed/coordinator.js +548 -0
  131. package/dist/distributed/httpTransport.d.ts +120 -0
  132. package/dist/distributed/httpTransport.js +446 -0
  133. package/dist/distributed/index.d.ts +8 -0
  134. package/dist/distributed/index.js +5 -0
  135. package/dist/distributed/networkTransport.d.ts +132 -0
  136. package/dist/distributed/networkTransport.js +633 -0
  137. package/dist/distributed/queryPlanner.d.ts +104 -0
  138. package/dist/distributed/queryPlanner.js +327 -0
  139. package/dist/distributed/readWriteSeparation.d.ts +134 -0
  140. package/dist/distributed/readWriteSeparation.js +350 -0
  141. package/dist/distributed/shardManager.d.ts +114 -0
  142. package/dist/distributed/shardManager.js +357 -0
  143. package/dist/distributed/shardMigration.d.ts +110 -0
  144. package/dist/distributed/shardMigration.js +289 -0
  145. package/dist/distributed/storageDiscovery.d.ts +160 -0
  146. package/dist/distributed/storageDiscovery.js +551 -0
  147. package/dist/embeddings/CachedEmbeddings.d.ts +40 -0
  148. package/dist/embeddings/CachedEmbeddings.js +146 -0
  149. package/dist/embeddings/EmbeddingManager.d.ts +102 -0
  150. package/dist/embeddings/EmbeddingManager.js +291 -0
  151. package/dist/embeddings/SingletonModelManager.d.ts +95 -0
  152. package/dist/embeddings/SingletonModelManager.js +220 -0
  153. package/dist/embeddings/index.d.ts +12 -0
  154. package/dist/embeddings/index.js +16 -0
  155. package/dist/embeddings/lightweight-embedder.d.ts +0 -1
  156. package/dist/embeddings/lightweight-embedder.js +4 -12
  157. package/dist/embeddings/model-manager.d.ts +11 -0
  158. package/dist/embeddings/model-manager.js +43 -7
  159. package/dist/embeddings/universal-memory-manager.d.ts +1 -1
  160. package/dist/embeddings/universal-memory-manager.js +27 -67
  161. package/dist/embeddings/worker-embedding.js +4 -8
  162. package/dist/errors/brainyError.d.ts +5 -1
  163. package/dist/errors/brainyError.js +12 -0
  164. package/dist/examples/basicUsage.js +7 -4
  165. package/dist/graph/graphAdjacencyIndex.d.ts +96 -0
  166. package/dist/graph/graphAdjacencyIndex.js +288 -0
  167. package/dist/graph/pathfinding.js +4 -2
  168. package/dist/hnsw/scaledHNSWSystem.js +11 -2
  169. package/dist/importManager.js +8 -5
  170. package/dist/index.d.ts +17 -22
  171. package/dist/index.js +37 -23
  172. package/dist/mcp/brainyMCPAdapter.d.ts +4 -4
  173. package/dist/mcp/brainyMCPAdapter.js +5 -5
  174. package/dist/mcp/brainyMCPService.d.ts +3 -3
  175. package/dist/mcp/brainyMCPService.js +3 -11
  176. package/dist/mcp/mcpAugmentationToolset.js +20 -30
  177. package/dist/neural/embeddedPatterns.d.ts +1 -1
  178. package/dist/neural/embeddedPatterns.js +2 -2
  179. package/dist/neural/entityExtractor.d.ts +65 -0
  180. package/dist/neural/entityExtractor.js +316 -0
  181. package/dist/neural/improvedNeuralAPI.d.ts +357 -0
  182. package/dist/neural/improvedNeuralAPI.js +2628 -0
  183. package/dist/neural/naturalLanguageProcessor.d.ts +155 -10
  184. package/dist/neural/naturalLanguageProcessor.js +941 -66
  185. package/dist/neural/naturalLanguageProcessorStatic.d.ts +2 -2
  186. package/dist/neural/naturalLanguageProcessorStatic.js +3 -3
  187. package/dist/neural/neuralAPI.js +8 -2
  188. package/dist/neural/patternLibrary.d.ts +57 -3
  189. package/dist/neural/patternLibrary.js +348 -13
  190. package/dist/neural/staticPatternMatcher.d.ts +2 -2
  191. package/dist/neural/staticPatternMatcher.js +2 -2
  192. package/dist/neural/types.d.ts +287 -0
  193. package/dist/neural/types.js +24 -0
  194. package/dist/shared/default-augmentations.d.ts +3 -3
  195. package/dist/shared/default-augmentations.js +5 -5
  196. package/dist/storage/adapters/baseStorageAdapter.d.ts +42 -0
  197. package/dist/storage/adapters/fileSystemStorage.d.ts +26 -2
  198. package/dist/storage/adapters/fileSystemStorage.js +218 -15
  199. package/dist/storage/adapters/memoryStorage.d.ts +4 -4
  200. package/dist/storage/adapters/memoryStorage.js +17 -12
  201. package/dist/storage/adapters/opfsStorage.d.ts +2 -2
  202. package/dist/storage/adapters/opfsStorage.js +2 -2
  203. package/dist/storage/adapters/s3CompatibleStorage.d.ts +2 -2
  204. package/dist/storage/adapters/s3CompatibleStorage.js +2 -2
  205. package/dist/storage/backwardCompatibility.d.ts +10 -78
  206. package/dist/storage/backwardCompatibility.js +17 -132
  207. package/dist/storage/baseStorage.d.ts +18 -2
  208. package/dist/storage/baseStorage.js +74 -3
  209. package/dist/storage/cacheManager.js +2 -2
  210. package/dist/storage/readOnlyOptimizations.js +8 -3
  211. package/dist/streaming/pipeline.d.ts +154 -0
  212. package/dist/streaming/pipeline.js +551 -0
  213. package/dist/triple/TripleIntelligence.d.ts +25 -110
  214. package/dist/triple/TripleIntelligence.js +4 -574
  215. package/dist/triple/TripleIntelligenceSystem.d.ts +159 -0
  216. package/dist/triple/TripleIntelligenceSystem.js +519 -0
  217. package/dist/types/apiTypes.d.ts +278 -0
  218. package/dist/types/apiTypes.js +33 -0
  219. package/dist/types/brainy.types.d.ts +308 -0
  220. package/dist/types/brainy.types.js +8 -0
  221. package/dist/types/brainyDataInterface.d.ts +5 -8
  222. package/dist/types/brainyDataInterface.js +2 -2
  223. package/dist/types/graphTypes.js +2 -2
  224. package/dist/utils/brainyTypes.d.ts +217 -0
  225. package/dist/utils/brainyTypes.js +261 -0
  226. package/dist/utils/cacheAutoConfig.d.ts +3 -3
  227. package/dist/utils/embedding.d.ts +9 -4
  228. package/dist/utils/embedding.js +89 -26
  229. package/dist/utils/enhancedLogger.d.ts +104 -0
  230. package/dist/utils/enhancedLogger.js +232 -0
  231. package/dist/utils/hybridModelManager.d.ts +19 -28
  232. package/dist/utils/hybridModelManager.js +36 -200
  233. package/dist/utils/index.d.ts +1 -1
  234. package/dist/utils/index.js +1 -1
  235. package/dist/utils/intelligentTypeMapper.d.ts +60 -0
  236. package/dist/utils/intelligentTypeMapper.js +349 -0
  237. package/dist/utils/metadataIndex.d.ts +118 -1
  238. package/dist/utils/metadataIndex.js +539 -16
  239. package/dist/utils/nodeVersionCheck.d.ts +24 -0
  240. package/dist/utils/nodeVersionCheck.js +65 -0
  241. package/dist/utils/paramValidation.d.ts +39 -0
  242. package/dist/utils/paramValidation.js +192 -0
  243. package/dist/utils/rateLimiter.d.ts +160 -0
  244. package/dist/utils/rateLimiter.js +271 -0
  245. package/dist/utils/statistics.d.ts +4 -4
  246. package/dist/utils/statistics.js +3 -3
  247. package/dist/utils/structuredLogger.d.ts +146 -0
  248. package/dist/utils/structuredLogger.js +394 -0
  249. package/dist/utils/textEncoding.js +2 -1
  250. package/dist/utils/typeValidation.d.ts +59 -0
  251. package/dist/utils/typeValidation.js +374 -0
  252. package/dist/utils/version.js +19 -3
  253. package/package.json +15 -4
  254. package/scripts/download-models.cjs +94 -20
  255. package/dist/augmentations/walAugmentation.d.ts +0 -109
  256. package/dist/augmentations/walAugmentation.js +0 -516
  257. package/dist/chat/BrainyChat.d.ts +0 -121
  258. package/dist/chat/BrainyChat.js +0 -396
  259. package/dist/chat/ChatCLI.d.ts +0 -61
  260. package/dist/chat/ChatCLI.js +0 -351
@@ -0,0 +1,186 @@
1
+ /**
2
+ * BrainyData V3 - Consistent API Design
3
+ *
4
+ * This is a proposed update to BrainyData with consistent method signatures.
5
+ * All methods use object parameters for consistency and extensibility.
6
+ */
7
+ import type { AddNounParams, AddVerbParams, SearchParams, SimilarityParams, RelatedParams, BatchNounsParams, BatchVerbsParams, GetNounsParams, GetVerbsParams, UpdateNounParams, MetadataParams, StatisticsParams, SearchResult, PaginatedResult, BatchResult, StatisticsResult } from './types/apiTypes.js';
8
+ /**
9
+ * Proposed consistent API for BrainyData
10
+ * All methods use object parameters
11
+ */
12
+ export declare class BrainyDataV3 {
13
+ constructor(config?: any);
14
+ init(): Promise<void>;
15
+ close(): Promise<void>;
16
+ /**
17
+ * Add a single noun
18
+ * OLD: addNoun(data, type, metadata)
19
+ * NEW: addNoun({ data, type, metadata })
20
+ */
21
+ addNoun(params: AddNounParams): Promise<string>;
22
+ /**
23
+ * Add multiple nouns in batch
24
+ * NEW METHOD for better performance
25
+ */
26
+ addNouns(params: BatchNounsParams): Promise<BatchResult>;
27
+ /**
28
+ * Get a single noun by ID
29
+ * OLD: getNoun(id)
30
+ * NEW: getNoun(id) - unchanged, simple enough
31
+ */
32
+ getNoun(id: string): Promise<any | null>;
33
+ /**
34
+ * Get multiple nouns with filtering
35
+ * NEW METHOD for batch retrieval
36
+ */
37
+ getNouns(params: GetNounsParams): Promise<PaginatedResult<any>>;
38
+ /**
39
+ * Update a noun
40
+ * OLD: updateNoun(id, data, metadata) - scattered
41
+ * NEW: updateNoun({ id, data, metadata })
42
+ */
43
+ updateNoun(params: UpdateNounParams): Promise<void>;
44
+ /**
45
+ * Delete a noun
46
+ * OLD: deleteNoun(id)
47
+ * NEW: deleteNoun(id) - unchanged, simple enough
48
+ */
49
+ deleteNoun(id: string): Promise<void>;
50
+ /**
51
+ * Add a single verb (relationship)
52
+ * OLD: addVerb(source, target, type, metadata, weight)
53
+ * NEW: addVerb({ source, target, type, weight, metadata })
54
+ */
55
+ addVerb(params: AddVerbParams): Promise<string>;
56
+ /**
57
+ * Add multiple verbs in batch
58
+ * NEW METHOD for better performance
59
+ */
60
+ addVerbs(params: BatchVerbsParams): Promise<BatchResult>;
61
+ /**
62
+ * Get a single verb by ID
63
+ * OLD: getVerb(id)
64
+ * NEW: getVerb(id) - unchanged, simple enough
65
+ */
66
+ getVerb(id: string): Promise<any | null>;
67
+ /**
68
+ * Get multiple verbs with filtering
69
+ * OLD: getVerbsBySource(id), getVerbsByTarget(id), etc.
70
+ * NEW: getVerbs({ source?, target?, type? })
71
+ */
72
+ getVerbs(params: GetVerbsParams): Promise<PaginatedResult<any>>;
73
+ /**
74
+ * Delete a verb
75
+ * OLD: deleteVerb(id)
76
+ * NEW: deleteVerb(id) - unchanged, simple enough
77
+ */
78
+ deleteVerb(id: string): Promise<void>;
79
+ /**
80
+ * Unified search method
81
+ * OLD: search(options), searchText(query, limit)
82
+ * NEW: search({ query, limit, filter })
83
+ */
84
+ search(params: SearchParams): Promise<SearchResult[]>;
85
+ /**
86
+ * Find similar items
87
+ * OLD: findSimilar(id, limit)
88
+ * NEW: findSimilar({ id, limit, filter })
89
+ */
90
+ findSimilar(params: SimilarityParams): Promise<SearchResult[]>;
91
+ /**
92
+ * Find related items through graph traversal
93
+ * OLD: getRelated(id, options)
94
+ * NEW: findRelated({ id, depth, types })
95
+ */
96
+ findRelated(params: RelatedParams): Promise<PaginatedResult<any>>;
97
+ /**
98
+ * Get metadata for an entity
99
+ * OLD: getMetadata(id)
100
+ * NEW: getMetadata(id) - unchanged, simple enough
101
+ */
102
+ getMetadata(id: string): Promise<any | null>;
103
+ /**
104
+ * Update metadata for an entity
105
+ * OLD: updateMetadata(id, metadata)
106
+ * NEW: updateMetadata({ id, metadata, merge })
107
+ */
108
+ updateMetadata(params: MetadataParams): Promise<void>;
109
+ /**
110
+ * Get database statistics
111
+ * OLD: getStatistics()
112
+ * NEW: getStatistics({ detailed?, includeAugmentations? })
113
+ */
114
+ getStatistics(params?: StatisticsParams): Promise<StatisticsResult>;
115
+ get neural(): {
116
+ /**
117
+ * Calculate similarity between two items
118
+ * Already good: neural.similar(a, b)
119
+ */
120
+ similar: (a: any, b: any) => Promise<number>;
121
+ /**
122
+ * Cluster items semantically
123
+ * Already good: neural.clusters(items?)
124
+ */
125
+ clusters: (items?: string[]) => Promise<any[]>;
126
+ /**
127
+ * Find nearest neighbors
128
+ * Already good: neural.neighbors(id, { limit })
129
+ */
130
+ neighbors: (id: string, options?: any) => Promise<any[]>;
131
+ /**
132
+ * Build semantic hierarchy
133
+ * Already good: neural.hierarchy(id)
134
+ */
135
+ hierarchy: (id: string) => Promise<any>;
136
+ /**
137
+ * Detect outliers
138
+ * Already good: neural.outliers()
139
+ */
140
+ outliers: () => Promise<any[]>;
141
+ /**
142
+ * Get visualization data
143
+ * Already good: neural.visualize()
144
+ */
145
+ visualize: () => Promise<any>;
146
+ };
147
+ get augmentations(): {
148
+ add: (aug: any) => void;
149
+ remove: (name: string) => void;
150
+ get: (name: string) => null;
151
+ execute: (op: string, params: any) => Promise<void>;
152
+ getTypes: () => never[];
153
+ };
154
+ }
155
+ /**
156
+ * Migration wrapper for backward compatibility
157
+ * This allows existing code to work with the new API
158
+ */
159
+ export declare class BrainyDataMigrationWrapper extends BrainyDataV3 {
160
+ /**
161
+ * OLD SIGNATURE: addNoun(data, type, metadata)
162
+ * Wraps to NEW: addNoun({ data, type, metadata })
163
+ */
164
+ addNoun(dataOrParams: any | AddNounParams, type?: string, metadata?: any): Promise<string>;
165
+ /**
166
+ * OLD SIGNATURE: addVerb(source, target, type, metadata, weight)
167
+ * Wraps to NEW: addVerb({ source, target, type, weight, metadata })
168
+ */
169
+ addVerb(sourceOrParams: string | AddVerbParams, target?: string, type?: string, metadata?: any, weight?: number): Promise<string>;
170
+ /**
171
+ * OLD SIGNATURE: searchText(query, limit)
172
+ * Wraps to NEW: search({ query, limit })
173
+ */
174
+ searchText(query: string, limit?: number): Promise<SearchResult[]>;
175
+ /**
176
+ * OLD SIGNATURE: findSimilar(id, limit)
177
+ * Wraps to NEW: findSimilar({ id, limit })
178
+ */
179
+ findSimilar(idOrParams: string | SimilarityParams, limit?: number): Promise<SearchResult[]>;
180
+ /**
181
+ * OLD METHODS: getVerbsBySource, getVerbsByTarget
182
+ * Wraps to NEW: getVerbs({ source }) or getVerbs({ target })
183
+ */
184
+ getVerbsBySource(sourceId: string): Promise<any[]>;
185
+ getVerbsByTarget(targetId: string): Promise<any[]>;
186
+ }
@@ -0,0 +1,337 @@
1
+ /**
2
+ * BrainyData V3 - Consistent API Design
3
+ *
4
+ * This is a proposed update to BrainyData with consistent method signatures.
5
+ * All methods use object parameters for consistency and extensibility.
6
+ */
7
+ /**
8
+ * Proposed consistent API for BrainyData
9
+ * All methods use object parameters
10
+ */
11
+ export class BrainyDataV3 {
12
+ // ============= INITIALIZATION =============
13
+ constructor(config) {
14
+ // Same as before
15
+ }
16
+ async init() {
17
+ // Same as before
18
+ }
19
+ async close() {
20
+ // Same as before
21
+ }
22
+ // ============= NOUN OPERATIONS =============
23
+ /**
24
+ * Add a single noun
25
+ * OLD: addNoun(data, type, metadata)
26
+ * NEW: addNoun({ data, type, metadata })
27
+ */
28
+ async addNoun(params) {
29
+ // Implementation
30
+ return 'id';
31
+ }
32
+ /**
33
+ * Add multiple nouns in batch
34
+ * NEW METHOD for better performance
35
+ */
36
+ async addNouns(params) {
37
+ // Implementation
38
+ return {
39
+ successful: [],
40
+ failed: [],
41
+ total: 0,
42
+ duration: 0
43
+ };
44
+ }
45
+ /**
46
+ * Get a single noun by ID
47
+ * OLD: getNoun(id)
48
+ * NEW: getNoun(id) - unchanged, simple enough
49
+ */
50
+ async getNoun(id) {
51
+ // Implementation
52
+ return null;
53
+ }
54
+ /**
55
+ * Get multiple nouns with filtering
56
+ * NEW METHOD for batch retrieval
57
+ */
58
+ async getNouns(params) {
59
+ // Implementation
60
+ return {
61
+ items: [],
62
+ hasMore: false
63
+ };
64
+ }
65
+ /**
66
+ * Update a noun
67
+ * OLD: updateNoun(id, data, metadata) - scattered
68
+ * NEW: updateNoun({ id, data, metadata })
69
+ */
70
+ async updateNoun(params) {
71
+ // Implementation
72
+ }
73
+ /**
74
+ * Delete a noun
75
+ * OLD: deleteNoun(id)
76
+ * NEW: deleteNoun(id) - unchanged, simple enough
77
+ */
78
+ async deleteNoun(id) {
79
+ // Implementation
80
+ }
81
+ // ============= VERB OPERATIONS =============
82
+ /**
83
+ * Add a single verb (relationship)
84
+ * OLD: addVerb(source, target, type, metadata, weight)
85
+ * NEW: addVerb({ source, target, type, weight, metadata })
86
+ */
87
+ async addVerb(params) {
88
+ // Implementation
89
+ return 'id';
90
+ }
91
+ /**
92
+ * Add multiple verbs in batch
93
+ * NEW METHOD for better performance
94
+ */
95
+ async addVerbs(params) {
96
+ // Implementation
97
+ return {
98
+ successful: [],
99
+ failed: [],
100
+ total: 0,
101
+ duration: 0
102
+ };
103
+ }
104
+ /**
105
+ * Get a single verb by ID
106
+ * OLD: getVerb(id)
107
+ * NEW: getVerb(id) - unchanged, simple enough
108
+ */
109
+ async getVerb(id) {
110
+ // Implementation
111
+ return null;
112
+ }
113
+ /**
114
+ * Get multiple verbs with filtering
115
+ * OLD: getVerbsBySource(id), getVerbsByTarget(id), etc.
116
+ * NEW: getVerbs({ source?, target?, type? })
117
+ */
118
+ async getVerbs(params) {
119
+ // Implementation
120
+ return {
121
+ items: [],
122
+ hasMore: false
123
+ };
124
+ }
125
+ /**
126
+ * Delete a verb
127
+ * OLD: deleteVerb(id)
128
+ * NEW: deleteVerb(id) - unchanged, simple enough
129
+ */
130
+ async deleteVerb(id) {
131
+ // Implementation
132
+ }
133
+ // ============= SEARCH OPERATIONS =============
134
+ /**
135
+ * Unified search method
136
+ * OLD: search(options), searchText(query, limit)
137
+ * NEW: search({ query, limit, filter })
138
+ */
139
+ async search(params) {
140
+ // Implementation
141
+ return [];
142
+ }
143
+ /**
144
+ * Find similar items
145
+ * OLD: findSimilar(id, limit)
146
+ * NEW: findSimilar({ id, limit, filter })
147
+ */
148
+ async findSimilar(params) {
149
+ // Implementation
150
+ return [];
151
+ }
152
+ /**
153
+ * Find related items through graph traversal
154
+ * OLD: getRelated(id, options)
155
+ * NEW: findRelated({ id, depth, types })
156
+ */
157
+ async findRelated(params) {
158
+ // Implementation
159
+ return {
160
+ items: [],
161
+ hasMore: false
162
+ };
163
+ }
164
+ // ============= METADATA OPERATIONS =============
165
+ /**
166
+ * Get metadata for an entity
167
+ * OLD: getMetadata(id)
168
+ * NEW: getMetadata(id) - unchanged, simple enough
169
+ */
170
+ async getMetadata(id) {
171
+ // Implementation
172
+ return null;
173
+ }
174
+ /**
175
+ * Update metadata for an entity
176
+ * OLD: updateMetadata(id, metadata)
177
+ * NEW: updateMetadata({ id, metadata, merge })
178
+ */
179
+ async updateMetadata(params) {
180
+ // Implementation
181
+ }
182
+ // ============= STATISTICS =============
183
+ /**
184
+ * Get database statistics
185
+ * OLD: getStatistics()
186
+ * NEW: getStatistics({ detailed?, includeAugmentations? })
187
+ */
188
+ async getStatistics(params) {
189
+ // Implementation
190
+ return {
191
+ nouns: { total: 0, byType: {} },
192
+ verbs: { total: 0, byType: {} },
193
+ storage: { used: 0, type: 'memory' }
194
+ };
195
+ }
196
+ // ============= NEURAL API (unchanged - already good) =============
197
+ get neural() {
198
+ return {
199
+ /**
200
+ * Calculate similarity between two items
201
+ * Already good: neural.similar(a, b)
202
+ */
203
+ similar: async (a, b) => {
204
+ // Implementation
205
+ return 0;
206
+ },
207
+ /**
208
+ * Cluster items semantically
209
+ * Already good: neural.clusters(items?)
210
+ */
211
+ clusters: async (items) => {
212
+ // Implementation
213
+ return [];
214
+ },
215
+ /**
216
+ * Find nearest neighbors
217
+ * Already good: neural.neighbors(id, { limit })
218
+ */
219
+ neighbors: async (id, options) => {
220
+ // Implementation
221
+ return [];
222
+ },
223
+ /**
224
+ * Build semantic hierarchy
225
+ * Already good: neural.hierarchy(id)
226
+ */
227
+ hierarchy: async (id) => {
228
+ // Implementation
229
+ return {};
230
+ },
231
+ /**
232
+ * Detect outliers
233
+ * Already good: neural.outliers()
234
+ */
235
+ outliers: async () => {
236
+ // Implementation
237
+ return [];
238
+ },
239
+ /**
240
+ * Get visualization data
241
+ * Already good: neural.visualize()
242
+ */
243
+ visualize: async () => {
244
+ // Implementation
245
+ return {};
246
+ }
247
+ };
248
+ }
249
+ // ============= AUGMENTATIONS (unchanged - already consistent) =============
250
+ get augmentations() {
251
+ return {
252
+ add: (aug) => { },
253
+ remove: (name) => { },
254
+ get: (name) => null,
255
+ execute: async (op, params) => { },
256
+ getTypes: () => []
257
+ };
258
+ }
259
+ }
260
+ /**
261
+ * Migration wrapper for backward compatibility
262
+ * This allows existing code to work with the new API
263
+ */
264
+ export class BrainyDataMigrationWrapper extends BrainyDataV3 {
265
+ /**
266
+ * OLD SIGNATURE: addNoun(data, type, metadata)
267
+ * Wraps to NEW: addNoun({ data, type, metadata })
268
+ */
269
+ async addNoun(dataOrParams, type, metadata) {
270
+ // If called with object params (new style)
271
+ if (arguments.length === 1 && typeof dataOrParams === 'object' && 'type' in dataOrParams) {
272
+ return super.addNoun(dataOrParams);
273
+ }
274
+ // If called with positional params (old style)
275
+ console.warn('Deprecated: Use addNoun({ data, type, metadata }) instead');
276
+ return super.addNoun({
277
+ data: dataOrParams,
278
+ type: type,
279
+ metadata
280
+ });
281
+ }
282
+ /**
283
+ * OLD SIGNATURE: addVerb(source, target, type, metadata, weight)
284
+ * Wraps to NEW: addVerb({ source, target, type, weight, metadata })
285
+ */
286
+ async addVerb(sourceOrParams, target, type, metadata, weight) {
287
+ // If called with object params (new style)
288
+ if (arguments.length === 1 && typeof sourceOrParams === 'object' && 'source' in sourceOrParams) {
289
+ return super.addVerb(sourceOrParams);
290
+ }
291
+ // If called with positional params (old style)
292
+ console.warn('Deprecated: Use addVerb({ source, target, type, weight, metadata }) instead');
293
+ return super.addVerb({
294
+ source: sourceOrParams,
295
+ target: target,
296
+ type: type,
297
+ weight,
298
+ metadata
299
+ });
300
+ }
301
+ /**
302
+ * OLD SIGNATURE: searchText(query, limit)
303
+ * Wraps to NEW: search({ query, limit })
304
+ */
305
+ async searchText(query, limit) {
306
+ console.warn('Deprecated: Use search({ query, limit }) instead');
307
+ return this.search({ query, limit });
308
+ }
309
+ /**
310
+ * OLD SIGNATURE: findSimilar(id, limit)
311
+ * Wraps to NEW: findSimilar({ id, limit })
312
+ */
313
+ async findSimilar(idOrParams, limit) {
314
+ // If called with object params (new style)
315
+ if (typeof idOrParams === 'object') {
316
+ return super.findSimilar(idOrParams);
317
+ }
318
+ // If called with positional params (old style)
319
+ console.warn('Deprecated: Use findSimilar({ id, limit }) instead');
320
+ return super.findSimilar({ id: idOrParams, limit });
321
+ }
322
+ /**
323
+ * OLD METHODS: getVerbsBySource, getVerbsByTarget
324
+ * Wraps to NEW: getVerbs({ source }) or getVerbs({ target })
325
+ */
326
+ async getVerbsBySource(sourceId) {
327
+ console.warn('Deprecated: Use getVerbs({ source }) instead');
328
+ const result = await this.getVerbs({ source: sourceId });
329
+ return result.items;
330
+ }
331
+ async getVerbsByTarget(targetId) {
332
+ console.warn('Deprecated: Use getVerbs({ target }) instead');
333
+ const result = await this.getVerbs({ target: targetId });
334
+ return result.items;
335
+ }
336
+ }
337
+ //# sourceMappingURL=brainyDataV3.js.map
@@ -3,13 +3,13 @@
3
3
  * Optimized for modern frameworks like Angular, React, Vue, etc.
4
4
  * Auto-detects environment and uses optimal storage (OPFS in browsers)
5
5
  */
6
- import { BrainyData, BrainyDataConfig } from './brainyData.js';
6
+ import { Brainy, BrainyConfig } from './brainy.js';
7
7
  import { VerbType, NounType } from './types/graphTypes.js';
8
8
  /**
9
- * Create a BrainyData instance optimized for browser frameworks
9
+ * Create a Brainy instance optimized for browser frameworks
10
10
  * Auto-detects environment and selects optimal storage and settings
11
11
  */
12
- export declare function createBrowserBrainyData(config?: Partial<BrainyDataConfig>): Promise<BrainyData>;
13
- export { VerbType, NounType, BrainyData };
14
- export type { BrainyDataConfig };
15
- export default createBrowserBrainyData;
12
+ export declare function createBrowserBrainy(config?: Partial<BrainyConfig>): Promise<Brainy>;
13
+ export { VerbType, NounType, Brainy };
14
+ export type { BrainyConfig };
15
+ export default createBrowserBrainy;
@@ -3,29 +3,32 @@
3
3
  * Optimized for modern frameworks like Angular, React, Vue, etc.
4
4
  * Auto-detects environment and uses optimal storage (OPFS in browsers)
5
5
  */
6
- import { BrainyData } from './brainyData.js';
6
+ import { Brainy } from './brainy.js';
7
7
  import { VerbType, NounType } from './types/graphTypes.js';
8
8
  /**
9
- * Create a BrainyData instance optimized for browser frameworks
9
+ * Create a Brainy instance optimized for browser frameworks
10
10
  * Auto-detects environment and selects optimal storage and settings
11
11
  */
12
- export async function createBrowserBrainyData(config = {}) {
13
- // BrainyData already has environment detection and will automatically:
12
+ export async function createBrowserBrainy(config = {}) {
13
+ // Brainy already has environment detection and will automatically:
14
14
  // - Use OPFS storage in browsers with fallback to Memory
15
15
  // - Use FileSystem storage in Node.js
16
16
  // - Request persistent storage when appropriate
17
17
  const browserConfig = {
18
18
  storage: {
19
- requestPersistentStorage: true // Request persistent storage for better performance
19
+ type: 'opfs',
20
+ options: {
21
+ requestPersistentStorage: true // Request persistent storage for better performance
22
+ }
20
23
  },
21
24
  ...config
22
25
  };
23
- const brainyData = new BrainyData(browserConfig);
26
+ const brainyData = new Brainy(browserConfig);
24
27
  await brainyData.init();
25
28
  return brainyData;
26
29
  }
27
30
  // Re-export types and constants for framework use
28
- export { VerbType, NounType, BrainyData };
31
+ export { VerbType, NounType, Brainy };
29
32
  // Default export for easy importing
30
- export default createBrowserBrainyData;
33
+ export default createBrowserBrainy;
31
34
  //# sourceMappingURL=browserFramework.js.map
@@ -3,12 +3,12 @@
3
3
  * Core MIT open source functionality only - no enterprise features
4
4
  * Optimized for browser usage with all dependencies bundled
5
5
  */
6
- import { BrainyData } from './brainyData.js';
6
+ import { Brainy } from './brainy.js';
7
7
  import { VerbType, NounType } from './types/graphTypes.js';
8
8
  /**
9
- * Create a BrainyData instance optimized for browser usage
9
+ * Create a Brainy instance optimized for browser usage
10
10
  * Auto-detects environment and selects optimal storage and settings
11
11
  */
12
- export declare function createBrowserBrainyData(config?: {}): Promise<BrainyData<any>>;
13
- export { VerbType, NounType, BrainyData };
14
- export default createBrowserBrainyData;
12
+ export declare function createBrowserBrainy(config?: {}): Promise<Brainy<any>>;
13
+ export { VerbType, NounType, Brainy };
14
+ export default createBrowserBrainy;
@@ -3,29 +3,32 @@
3
3
  * Core MIT open source functionality only - no enterprise features
4
4
  * Optimized for browser usage with all dependencies bundled
5
5
  */
6
- import { BrainyData } from './brainyData.js';
6
+ import { Brainy } from './brainy.js';
7
7
  import { VerbType, NounType } from './types/graphTypes.js';
8
8
  /**
9
- * Create a BrainyData instance optimized for browser usage
9
+ * Create a Brainy instance optimized for browser usage
10
10
  * Auto-detects environment and selects optimal storage and settings
11
11
  */
12
- export async function createBrowserBrainyData(config = {}) {
13
- // BrainyData already has environment detection and will automatically:
12
+ export async function createBrowserBrainy(config = {}) {
13
+ // Brainy already has environment detection and will automatically:
14
14
  // - Use OPFS storage in browsers with fallback to Memory
15
15
  // - Use FileSystem storage in Node.js
16
16
  // - Request persistent storage when appropriate
17
17
  const browserConfig = {
18
18
  storage: {
19
- requestPersistentStorage: true // Request persistent storage for better performance
19
+ type: 'opfs',
20
+ options: {
21
+ requestPersistentStorage: true
22
+ }
20
23
  },
21
24
  ...config
22
25
  };
23
- const brainyData = new BrainyData(browserConfig);
26
+ const brainyData = new Brainy(browserConfig);
24
27
  await brainyData.init();
25
28
  return brainyData;
26
29
  }
27
30
  // Re-export core types and classes for browser use
28
- export { VerbType, NounType, BrainyData };
31
+ export { VerbType, NounType, Brainy };
29
32
  // Default export for easy importing
30
- export default createBrowserBrainyData;
33
+ export default createBrowserBrainy;
31
34
  //# sourceMappingURL=browserFramework.minimal.js.map