triangle-utils 1.4.91 → 1.4.92

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.
@@ -18,5 +18,6 @@ export declare class UtilsS3Vectors {
18
18
  query(s3_vector_id_prefix: string, coordinates: number[], num_vectors: number, filters?: Record<string, any> | undefined): Promise<{
19
19
  s3_vector_id: string;
20
20
  distance: number;
21
+ headers: Record<string, any>;
21
22
  }[]>;
22
23
  }
@@ -211,9 +211,15 @@ export class UtilsS3Vectors {
211
211
  console.log("Bad distance:", distance);
212
212
  continue;
213
213
  }
214
+ const headers = new_vector.metadata;
215
+ if (!(typeof headers === "object" && Object.keys(headers).every((header_id) => typeof header_id === "string"))) {
216
+ console.log("Bad headers:", headers);
217
+ continue;
218
+ }
214
219
  results.push({
215
220
  s3_vector_id: s3_vector_id,
216
- distance: distance
221
+ distance: distance,
222
+ headers: headers
217
223
  });
218
224
  }
219
225
  return results;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.91",
3
+ "version": "1.4.92",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -224,7 +224,7 @@ export class UtilsS3Vectors {
224
224
  if (new_vectors === undefined) {
225
225
  return []
226
226
  }
227
- const results : { s3_vector_id : string, distance : number }[] = []
227
+ const results : { s3_vector_id : string, distance : number, headers : Record<string, any> }[] = []
228
228
  for (const new_vector of new_vectors) {
229
229
  const s3_vector_key = new_vector.key
230
230
  if (s3_vector_key === undefined) {
@@ -237,9 +237,15 @@ export class UtilsS3Vectors {
237
237
  console.log("Bad distance:", distance)
238
238
  continue
239
239
  }
240
+ const headers : any = new_vector.metadata
241
+ if (!(typeof headers === "object" && Object.keys(headers).every((header_id : any) => typeof header_id === "string"))) {
242
+ console.log("Bad headers:", headers)
243
+ continue
244
+ }
240
245
  results.push({
241
246
  s3_vector_id : s3_vector_id,
242
- distance : distance
247
+ distance : distance,
248
+ headers : headers
243
249
  })
244
250
  }
245
251
  return results