@coherentglobal/spark-execute-sdk 0.3.6 → 0.3.7
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/.github/workflows/build-publish.yml +4 -0
- package/dist/browser.js +215 -570
- package/examples/UsingBearerTokenFNAsync/index.html +1 -0
- package/examples/unzippedModel/config.js +96 -0
- package/examples/unzippedModel/index.html +195 -0
- package/examples/unzippedModel/modelCInput.json +15 -0
- package/examples/unzippedModel/models/0211e8f0-9988-4514-a761-9782db6700ce/Model_C.data +0 -0
- package/examples/unzippedModel/models/0211e8f0-9988-4514-a761-9782db6700ce/Model_C.js +21 -0
- package/examples/unzippedModel/models/0211e8f0-9988-4514-a761-9782db6700ce/Model_C.wasm +0 -0
- package/examples/unzippedModel/node.js +125 -0
- package/examples/unzippedModel/tool.js +17 -0
- package/package.json +2 -2
- package/src/browser.js +1 -0
- package/src/models.js +15 -4
- package/src/validate.js +11 -1
- package/types/browser.d.ts.map +1 -1
- package/types/models.d.ts.map +1 -1
- package/types/node.d.ts.map +1 -1
- package/types/validate.d.ts.map +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const location = "./models/0211e8f0-9988-4514-a761-9782db6700ce/Model_C.data";
|
|
3
|
+
|
|
4
|
+
const file = fs.readFileSync(location);
|
|
5
|
+
console.log(file);
|
|
6
|
+
|
|
7
|
+
// generate base64
|
|
8
|
+
const data = file.toString("base64");
|
|
9
|
+
console.log(data);
|
|
10
|
+
const buffer = Buffer.from(data, "base64");
|
|
11
|
+
const uint = new Uint8Array(buffer);
|
|
12
|
+
console.log(uint);
|
|
13
|
+
fs.writeFileSync("./models/base64model.txt", data);
|
|
14
|
+
|
|
15
|
+
// generate blob
|
|
16
|
+
// const blob = atob(data)
|
|
17
|
+
// fs.writeFileSync('./models/blobmodel.txt', blob)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coherentglobal/spark-execute-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"mains": "index.js",
|
|
6
6
|
"browser": "dist/browser.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@coherentglobal/wasm-runner": "^0.0.
|
|
23
|
+
"@coherentglobal/wasm-runner": "^0.0.51",
|
|
24
24
|
"@types/node": "^18.7.18",
|
|
25
25
|
"axios": "^0.27.2",
|
|
26
26
|
"chai": "^4.3.6",
|
package/src/browser.js
CHANGED
package/src/models.js
CHANGED
|
@@ -8,10 +8,21 @@ const processModels = (nodegen) => {
|
|
|
8
8
|
case "binary":
|
|
9
9
|
case "uint8array":
|
|
10
10
|
case "base64":
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (typeof nodegen.binary === "object") {
|
|
12
|
+
const model = {
|
|
13
|
+
servicename: nodegen.binary.servicename,
|
|
14
|
+
wasm: Buffer.from(nodegen.binary.wasm, "base64"),
|
|
15
|
+
js: Buffer.from(nodegen.binary.js, "base64"),
|
|
16
|
+
data: Buffer.from(nodegen.binary.data, "base64"),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
nodegen.binary = model;
|
|
20
|
+
console.log("NODE: ", nodegen.binary);
|
|
21
|
+
} else {
|
|
22
|
+
const model = Buffer.from(nodegen.binary, "base64");
|
|
23
|
+
nodegen.binary = model;
|
|
24
|
+
console.log("NODE: ", nodegen.binary);
|
|
25
|
+
}
|
|
15
26
|
break;
|
|
16
27
|
case "function":
|
|
17
28
|
const func = nodegen.binary;
|
package/src/validate.js
CHANGED
|
@@ -21,7 +21,17 @@ const rules = Joi.object({
|
|
|
21
21
|
Joi.object({
|
|
22
22
|
versionId: Joi.string(),
|
|
23
23
|
type: Joi.string(),
|
|
24
|
-
binary:
|
|
24
|
+
binary: [
|
|
25
|
+
Joi.string().allow(""),
|
|
26
|
+
Joi.function().allow(""),
|
|
27
|
+
Joi.object({
|
|
28
|
+
servicename: Joi.string(),
|
|
29
|
+
wasm: Joi.string(),
|
|
30
|
+
js: Joi.string(),
|
|
31
|
+
data: Joi.string(),
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
|
|
25
35
|
metaData: Joi.object(),
|
|
26
36
|
})
|
|
27
37
|
)
|
package/types/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.js"],"names":[],"mappings":";AAQA;IACE;;OAEG;IACH,oBAFW,MAAM,EAwChB;IArCC;;OAEG;IACH,eAAyC;IAMzC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,iBAAwB;IACxB;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,YAAc;IACd;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,wBAA4B;IAE9B;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.js"],"names":[],"mappings":";AAQA;IACE;;OAEG;IACH,oBAFW,MAAM,EAwChB;IArCC;;OAEG;IACH,eAAyC;IAMzC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,iBAAwB;IACxB;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,YAAc;IACd;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,wBAA4B;IAE9B;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAMlB;IACD;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAUlB;IACD;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;;;OAMG;IACH,eAJW,MAAM,cACN,MAAM,GACJ,MAAM,CAyElB;CACF"}
|
package/types/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.js"],"names":[],"mappings":";AACA;;;;GAIG;AACH,wCAHW,MAAM,UAkChB"}
|
package/types/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAUA;IACE;;OAEG;IACH,oBAFW,MAAM,EAyChB;IAtCC;;OAEG;IACH,eAAyC;IAMzC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,iBAAwB;IACxB;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,YAAc;IACd;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAwC;IAExC;;OAEG;IACH,wBAA4B;IAG9B;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAclB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;;;OAMG;IACH,eAJW,MAAM,cACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAUA;IACE;;OAEG;IACH,oBAFW,MAAM,EAyChB;IAtCC;;OAEG;IACH,eAAyC;IAMzC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,iBAAwB;IACxB;;OAEG;IACH,cAAwC;IACxC;;OAEG;IACH,YAAc;IACd;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAwC;IAExC;;OAEG;IACH,wBAA4B;IAG9B;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAclB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAOnB;IAED;;;;;;OAMG;IACH,eAJW,MAAM,cACN,MAAM,GACJ,MAAM,CAiFlB;CAMF"}
|
package/types/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.js"],"names":[],"mappings":";AA0CA,kEAGC"}
|