@hypermode/functions-as
Advanced tools
Comparing version 0.12.0-alpha2 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.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75494
2492