@soulcraft/brainy 0.9.11 → 0.9.12

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D23.11.0-brightgreen.svg)](https://nodejs.org/)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.1.6-blue.svg)](https://www.typescriptlang.org/)
8
8
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
9
- [![npm](https://img.shields.io/badge/npm-v0.9.11-blue.svg)](https://www.npmjs.com/package/@soulcraft/brainy)
9
+ [![npm](https://img.shields.io/badge/npm-v0.9.12-blue.svg)](https://www.npmjs.com/package/@soulcraft/brainy)
10
10
 
11
11
  [//]: # ([![Cartographer](https://img.shields.io/badge/Cartographer-Official%20Standard-brightgreen)](https://github.com/sodal-project/cartographer))
12
12
 
@@ -1060,8 +1060,9 @@ The repository includes a comprehensive demo that showcases Brainy's main featur
1060
1060
  which automatically deploys when pushing to the main branch or can be manually triggered
1061
1061
  - To use a custom domain (like www.soulcraft.com):
1062
1062
  1. A CNAME file is already included in the demo directory
1063
- 2. In your GitHub repository settings, go to Pages > Custom domain and enter your domain
1064
- 3. Configure your domain's DNS settings to point to GitHub Pages:
1063
+ 2. In your GitHub repository settings, go to Pages > Custom domain and enter your domain
1064
+ 3. Configure your domain's DNS settings to point to GitHub Pages:
1065
+
1065
1066
  - Add a CNAME record for www pointing to `<username>.github.io` (e.g., `soulcraft-research.github.io`)
1066
1067
  - Or for an apex domain (soulcraft.com), add A records pointing to GitHub Pages IP addresses
1067
1068
 
package/dist/brainy.js CHANGED
@@ -2967,7 +2967,8 @@ function findUSELoadFunction(sentenceEncoderModule) {
2967
2967
  }
2968
2968
  }
2969
2969
  // Also check nested objects
2970
- else if (typeof sentenceEncoderModule[key] === 'object' && sentenceEncoderModule[key] !== null) {
2970
+ else if (typeof sentenceEncoderModule[key] === 'object' &&
2971
+ sentenceEncoderModule[key] !== null) {
2971
2972
  for (const nestedKey in sentenceEncoderModule[key]) {
2972
2973
  if (typeof sentenceEncoderModule[key][nestedKey] === 'function') {
2973
2974
  const fnName = sentenceEncoderModule[key][nestedKey].name || nestedKey;
@@ -7501,7 +7502,7 @@ class BrainyData {
7501
7502
  console.log('Retrying Universal Sentence Encoder initialization...');
7502
7503
  try {
7503
7504
  // Wait a moment before retrying
7504
- await new Promise(resolve => setTimeout(resolve, 1000));
7505
+ await new Promise((resolve) => setTimeout(resolve, 1000));
7505
7506
  // Try again with a different approach - use the non-threaded version
7506
7507
  // This is a fallback in case the threaded version fails
7507
7508
  const { createTensorFlowEmbeddingFunction } = await Promise.resolve().then(function () { return embedding; });
@@ -7764,19 +7765,25 @@ class BrainyData {
7764
7765
  }
7765
7766
  });
7766
7767
  // Process vector items (already embedded)
7767
- const vectorPromises = vectorItems.map(item => this.add(item.vectorOrData, item.metadata, options));
7768
+ const vectorPromises = vectorItems.map((item) => this.add(item.vectorOrData, item.metadata, options));
7768
7769
  // Process text items in a single batch embedding operation
7769
7770
  let textPromises = [];
7770
7771
  if (textItems.length > 0) {
7771
7772
  // Extract just the text for batch embedding
7772
- const texts = textItems.map(item => item.text);
7773
+ const texts = textItems.map((item) => item.text);
7773
7774
  // Perform batch embedding
7774
7775
  const embeddings = await defaultBatchEmbeddingFunction(texts);
7775
7776
  // Add each item with its embedding
7776
- textPromises = textItems.map((item, i) => this.add(embeddings[i], item.metadata, { ...options, forceEmbed: false }));
7777
+ textPromises = textItems.map((item, i) => this.add(embeddings[i], item.metadata, {
7778
+ ...options,
7779
+ forceEmbed: false
7780
+ }));
7777
7781
  }
7778
7782
  // Combine all promises
7779
- const batchResults = await Promise.all([...vectorPromises, ...textPromises]);
7783
+ const batchResults = await Promise.all([
7784
+ ...vectorPromises,
7785
+ ...textPromises
7786
+ ]);
7780
7787
  // Add the results to our ids array
7781
7788
  ids.push(...batchResults);
7782
7789
  }
@@ -8714,8 +8721,10 @@ class BrainyData {
8714
8721
  let attempts = 0;
8715
8722
  const maxAttempts = 100; // Prevent infinite loop
8716
8723
  const delay = 50; // ms
8717
- while (this.isInitializing && !this.isInitialized && attempts < maxAttempts) {
8718
- await new Promise(resolve => setTimeout(resolve, delay));
8724
+ while (this.isInitializing &&
8725
+ !this.isInitialized &&
8726
+ attempts < maxAttempts) {
8727
+ await new Promise((resolve) => setTimeout(resolve, delay));
8719
8728
  attempts++;
8720
8729
  }
8721
8730
  if (!this.isInitialized) {
package/dist/unified.js CHANGED
@@ -2965,7 +2965,8 @@ function findUSELoadFunction(sentenceEncoderModule) {
2965
2965
  }
2966
2966
  }
2967
2967
  // Also check nested objects
2968
- else if (typeof sentenceEncoderModule[key] === 'object' && sentenceEncoderModule[key] !== null) {
2968
+ else if (typeof sentenceEncoderModule[key] === 'object' &&
2969
+ sentenceEncoderModule[key] !== null) {
2969
2970
  for (const nestedKey in sentenceEncoderModule[key]) {
2970
2971
  if (typeof sentenceEncoderModule[key][nestedKey] === 'function') {
2971
2972
  const fnName = sentenceEncoderModule[key][nestedKey].name || nestedKey;
@@ -7499,7 +7500,7 @@ class BrainyData {
7499
7500
  console.log('Retrying Universal Sentence Encoder initialization...');
7500
7501
  try {
7501
7502
  // Wait a moment before retrying
7502
- await new Promise(resolve => setTimeout(resolve, 1000));
7503
+ await new Promise((resolve) => setTimeout(resolve, 1000));
7503
7504
  // Try again with a different approach - use the non-threaded version
7504
7505
  // This is a fallback in case the threaded version fails
7505
7506
  const { createTensorFlowEmbeddingFunction } = await Promise.resolve().then(function () { return embedding; });
@@ -7762,19 +7763,25 @@ class BrainyData {
7762
7763
  }
7763
7764
  });
7764
7765
  // Process vector items (already embedded)
7765
- const vectorPromises = vectorItems.map(item => this.add(item.vectorOrData, item.metadata, options));
7766
+ const vectorPromises = vectorItems.map((item) => this.add(item.vectorOrData, item.metadata, options));
7766
7767
  // Process text items in a single batch embedding operation
7767
7768
  let textPromises = [];
7768
7769
  if (textItems.length > 0) {
7769
7770
  // Extract just the text for batch embedding
7770
- const texts = textItems.map(item => item.text);
7771
+ const texts = textItems.map((item) => item.text);
7771
7772
  // Perform batch embedding
7772
7773
  const embeddings = await defaultBatchEmbeddingFunction(texts);
7773
7774
  // Add each item with its embedding
7774
- textPromises = textItems.map((item, i) => this.add(embeddings[i], item.metadata, { ...options, forceEmbed: false }));
7775
+ textPromises = textItems.map((item, i) => this.add(embeddings[i], item.metadata, {
7776
+ ...options,
7777
+ forceEmbed: false
7778
+ }));
7775
7779
  }
7776
7780
  // Combine all promises
7777
- const batchResults = await Promise.all([...vectorPromises, ...textPromises]);
7781
+ const batchResults = await Promise.all([
7782
+ ...vectorPromises,
7783
+ ...textPromises
7784
+ ]);
7778
7785
  // Add the results to our ids array
7779
7786
  ids.push(...batchResults);
7780
7787
  }
@@ -8712,8 +8719,10 @@ class BrainyData {
8712
8719
  let attempts = 0;
8713
8720
  const maxAttempts = 100; // Prevent infinite loop
8714
8721
  const delay = 50; // ms
8715
- while (this.isInitializing && !this.isInitialized && attempts < maxAttempts) {
8716
- await new Promise(resolve => setTimeout(resolve, delay));
8722
+ while (this.isInitializing &&
8723
+ !this.isInitialized &&
8724
+ attempts < maxAttempts) {
8725
+ await new Promise((resolve) => setTimeout(resolve, delay));
8717
8726
  attempts++;
8718
8727
  }
8719
8728
  if (!this.isInitialized) {
@@ -2,5 +2,5 @@
2
2
  * This file is auto-generated during the build process.
3
3
  * Do not modify this file directly.
4
4
  */
5
- export declare const VERSION = "0.9.11";
5
+ export declare const VERSION = "0.9.12";
6
6
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
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",
@@ -38,6 +38,11 @@
38
38
  "version:patch": "npm version patch",
39
39
  "version:minor": "npm version minor",
40
40
  "version:major": "npm version major",
41
+ "lint": "eslint --ext .ts,.js src/",
42
+ "lint:fix": "eslint --ext .ts,.js src/ --fix",
43
+ "format": "prettier --write \"src/**/*.{ts,js}\"",
44
+ "check-format": "prettier --check \"src/**/*.{ts,js}\"",
45
+ "check-style": "node scripts/check-code-style.js",
41
46
  "deploy": "npm run build && npm publish",
42
47
  "deploy:cloud:aws": "cd cloud-wrapper && npm run build && npm run deploy:aws",
43
48
  "deploy:cloud:gcp": "cd cloud-wrapper && npm run build && npm run deploy:gcp",