Comparing version 0.0.16 to 0.0.17
@@ -29,3 +29,6 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { value, name, storage, shape, minUploadSize: dataUrlLimit, key } = input; | ||
const { value, name, storage, shape, minUploadSize: dataUrlLimit = 4096, key } = input; | ||
// Null | ||
if (value === null) | ||
return { data: null, type: "null" }; | ||
// Value | ||
@@ -40,2 +43,7 @@ if (isFunctionValue(value)) | ||
} | ||
// Binary | ||
if (value instanceof ArrayBuffer) { | ||
const data = yield storage.upload({ name, buffer: value, type: types_1.UploadType.Value, dataUrlLimit, key }); | ||
return { data, type: "binary" }; | ||
} | ||
// String | ||
@@ -99,2 +107,5 @@ if (typeof (value) === "string") { | ||
const { value: { data, type } } = input; | ||
// Null | ||
if (type === "null") | ||
return null; | ||
// Download | ||
@@ -130,3 +141,3 @@ const buffer = yield getValueData(data); | ||
function isFunctionValue(value) { | ||
return value.data && value.type; | ||
return value && value.type && value.data !== undefined; // `data` can be `null` but must exist | ||
} | ||
@@ -133,0 +144,0 @@ exports.isFunctionValue = isFunctionValue; |
/** | ||
* Value data type. | ||
*/ | ||
export type Dtype = "int8" | "int16" | "int32" | "int64" | "uint8" | "uint16" | "uint32" | "uint64" | "float16" | "float32" | "float64" | "bool" | "string" | "list" | "dict" | "image" | "audio" | "video" | "model" | "binary"; | ||
export type Dtype = "int8" | "int16" | "int32" | "int64" | "uint8" | "uint16" | "uint32" | "uint64" | "float16" | "float32" | "float64" | "bool" | "string" | "list" | "dict" | "image" | "audio" | "video" | "model" | "binary" | "null"; |
@@ -11,3 +11,3 @@ import { Dtype } from "./dtype"; | ||
[key: string]: any; | ||
} | TypedArray; | ||
} | TypedArray | ArrayBuffer; | ||
/** | ||
@@ -14,0 +14,0 @@ * Prediction value. |
{ | ||
"name": "fxnjs", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Run AI prediction functions in your JavaScript and Node.js apps.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,2 +7,4 @@ # Function for JavaScript | ||
> *⚠️⚠️⚠️*: **Only use publishable access keys when using Function client-side (i.e. in the browser)**. This prevents others from extracting your keys and making predictions with your account. | ||
## Installing Function | ||
@@ -9,0 +11,0 @@ Function is distributed on NPM. Open a terminal and run the following command: |
Sorry, the diff of this file is too big to display
623485
54189
51