You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP →

@hypermode/functions-as

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hypermode/functions-as - npm Package Compare versions

Comparing version

to
0.12.0-alpha3

@@ -74,2 +74,3 @@ import * as utils from "./utils";

text: string;
labels: string[];
distance: f64;

@@ -82,2 +83,3 @@ score: f64;

text: string,
labels: string[],
distance: f64,

@@ -89,2 +91,3 @@ score: f64,

this.text = text;
this.labels = labels;
this.distance = distance;

@@ -224,2 +227,10 @@ this.score = score;

// @ts-expect-error: decorator
@external("hypermode", "getLabels")
declare function hostGetLabels(
collection: string,
namespace: string,
key: string,
): string[];
// @ts-expect-error: decorator
@external("hypermode", "searchCollectionByVector")

@@ -555,15 +566,15 @@ declare function hostSearchCollectionByVector(

console.error("Collection is empty.");
return new CollectionSearchResultObject("", "", "", 0.0, 0.0);
return new CollectionSearchResultObject("", "", "", [], 0.0, 0.0);
}
if (searchMethod.length == 0) {
console.error("Search method is empty.");
return new CollectionSearchResultObject("", "", "", 0.0, 0.0);
return new CollectionSearchResultObject("", "", "", [], 0.0, 0.0);
}
if (key1.length == 0) {
console.error("Key1 is empty.");
return new CollectionSearchResultObject("", "", "", 0.0, 0.0);
return new CollectionSearchResultObject("", "", "", [], 0.0, 0.0);
}
if (key2.length == 0) {
console.error("Key2 is empty.");
return new CollectionSearchResultObject("", "", "", 0.0, 0.0);
return new CollectionSearchResultObject("", "", "", [], 0.0, 0.0);
}

@@ -628,1 +639,17 @@ return hostComputeDistance(collection, namespace, searchMethod, key1, key2);

}
export function getLabels(
collection: string,
key: string,
namespace: string = "",
): string[] {
if (collection.length == 0) {
console.error("Collection is empty.");
return [];
}
if (key.length == 0) {
console.error("Key is empty.");
return [];
}
return hostGetLabels(collection, namespace, key);
}
{
"name": "@hypermode/functions-as",
"version": "0.12.0-alpha2",
"version": "0.12.0-alpha3",
"description": "Hypermode library for AssemblyScript functions",

@@ -5,0 +5,0 @@ "author": "Hypermode, Inc.",