@coherentglobal/spark-execute-sdk 0.3.13 → 0.3.15
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/package.json +3 -3
- package/.github/workflows/build-publish.yml +0 -50
- package/examples/UsingBearerTokenFNAsync/bearerTokenExample.js +0 -22
- package/examples/UsingBearerTokenFNAsync/config.js +0 -88
- package/examples/UsingBearerTokenFNAsync/index.html +0 -207
- package/examples/UsingBearerTokenFNAsync/modelCInput.json +0 -15
- package/examples/UsingBearerTokenFNAsync/models/Model_C.zip +0 -0
- package/examples/UsingBearerTokenString/bearerTokenExample.js +0 -22
- package/examples/UsingBearerTokenString/config.js +0 -182
- package/examples/UsingBearerTokenString/index.html +0 -191
- package/examples/UsingBearerTokenString/modelCInput.json +0 -15
- package/examples/UsingBearerTokenString/models/Model_C.zip +0 -0
- package/examples/UsingSyntheticKeyFNAsync/bearerTokenExample.js +0 -22
- package/examples/UsingSyntheticKeyFNAsync/config.js +0 -195
- package/examples/UsingSyntheticKeyFNAsync/index.html +0 -205
- package/examples/UsingSyntheticKeyFNAsync/modelCInput.json +0 -15
- package/examples/UsingSyntheticKeyFNAsync/models/Model_C.zip +0 -0
- package/examples/UsingSyntheticKeyString/bearerTokenExample.js +0 -41
- package/examples/UsingSyntheticKeyString/config.js +0 -182
- package/examples/UsingSyntheticKeyString/index.html +0 -192
- package/examples/UsingSyntheticKeyString/modelCInput.json +0 -17
- package/examples/UsingSyntheticKeyString/models/Model_C.zip +0 -0
- package/examples/asyncFunctionModel/config.js +0 -96
- package/examples/asyncFunctionModel/modelCInput.json +0 -15
- package/examples/asyncFunctionModel/models/Model_C.zip +0 -0
- package/examples/asyncFunctionModel/node.js +0 -125
- package/examples/asyncFunctionModel/tool.js +0 -17
- package/examples/base64Model/config.js +0 -96
- package/examples/base64Model/modelCInput.json +0 -15
- package/examples/base64Model/models/Model_C.zip +0 -0
- package/examples/base64Model/node.js +0 -125
- package/examples/base64Model/tool.js +0 -17
- package/examples/base64modelBrowser/config.js +0 -96
- package/examples/base64modelBrowser/index.html +0 -194
- package/examples/base64modelBrowser/modelCInput.json +0 -15
- package/examples/base64modelBrowser/models/Model_C.zip +0 -0
- package/examples/base64modelBrowser/models/base64model.txt +0 -1
- package/examples/base64modelBrowser/node.js +0 -126
- package/examples/base64modelBrowser/tool.js +0 -17
- package/examples/binary/config.js +0 -96
- package/examples/binary/modelCInput.json +0 -15
- package/examples/binary/models/Model_C.zip +0 -0
- package/examples/binary/models/binary.txt +0 -1
- package/examples/binary/node.js +0 -131
- package/examples/binary/tool.js +0 -18
- package/examples/functionModel/config.js +0 -96
- package/examples/functionModel/index.html +0 -218
- package/examples/functionModel/modelCInput.json +0 -15
- package/examples/functionModel/models/0211e8f0-9988-4514-a761-9782db6700ce.zip +0 -0
- package/examples/functionModel/node.js +0 -138
- package/examples/functionModel/tool.js +0 -17
- package/examples/nodejs/node.js +0 -250
- package/examples/nodejs/test_models/Archive.zip +0 -0
- package/examples/nodejs/test_models/BlackScholes.zip +0 -0
- package/examples/nodejs/test_models/Model_A.zip +0 -0
- package/examples/nodejs/test_models/Par7.zip +0 -0
- package/examples/unzippedModel/config.js +0 -96
- package/examples/unzippedModel/index.html +0 -195
- package/examples/unzippedModel/modelCInput.json +0 -15
- 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 +0 -21
- package/examples/unzippedModel/models/0211e8f0-9988-4514-a761-9782db6700ce/Model_C.wasm +0 -0
- package/examples/unzippedModel/node.js +0 -125
- package/examples/unzippedModel/tool.js +0 -17
- package/examples/v16UpstreamDownStream/config.js +0 -151
- package/examples/v16UpstreamDownStream/configs/Downstream.json +0 -93
- package/examples/v16UpstreamDownStream/configs/Upstream.json +0 -102
- package/examples/v16UpstreamDownStream/index.html +0 -216
- package/examples/v16UpstreamDownStream/inputs/Downstream.json +0 -15
- package/examples/v16UpstreamDownStream/inputs/Upstream.json +0 -13
- package/examples/v16UpstreamDownStream/models/DownstreamService_example/DownstreamService_example.data +0 -0
- package/examples/v16UpstreamDownStream/models/DownstreamService_example/DownstreamService_example.js +0 -21
- package/examples/v16UpstreamDownStream/models/DownstreamService_example/DownstreamService_example.wasm +0 -0
- package/examples/v16UpstreamDownStream/models/DownstreamService_example.zip +0 -0
- package/examples/v16UpstreamDownStream/models/UpstreamService_example.zip +0 -0
- package/examples/v16UpstreamDownStream/models/base64modelA.txt +0 -1
- package/examples/v16UpstreamDownStream/models/base64modelB.txt +0 -1
- package/examples/v16UpstreamDownStream/node.js +0 -226
- package/examples/v16UpstreamDownStream/tools.js +0 -25
- package/src/tenant_resolver/externalResolver_coherent.js +0 -118
- package/src/tenant_resolver/externalResolver_test.js +0 -118
- package/test/config.test.js +0 -124
- package/test/mock-data/dummy-config.json +0 -102
- package/test/mock-data/valid.json +0 -21
- package/test/spark-sdk.test.js +0 -20
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<meta name="theme-color" content="#000000" />
|
|
7
|
-
<meta name="Demo" content="Demo App" />
|
|
8
|
-
<title>Spark Execute SDK Demo App</title>
|
|
9
|
-
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<h1>Spark Execute SDK Demo</h1>
|
|
13
|
-
|
|
14
|
-
<br /><br />
|
|
15
|
-
<label>Payload:</label><br />
|
|
16
|
-
<textarea
|
|
17
|
-
id="myTextarea"
|
|
18
|
-
rows="20"
|
|
19
|
-
cols="100"
|
|
20
|
-
type="text"
|
|
21
|
-
onChange="handleChange()"
|
|
22
|
-
></textarea>
|
|
23
|
-
<br /><br />
|
|
24
|
-
<button id="calcButton" onClick="handleSubmit()" >Run Calc</button
|
|
25
|
-
><br /><br />
|
|
26
|
-
<label>Logs:</label><br /><br />
|
|
27
|
-
<p id="logsP"></p>
|
|
28
|
-
<br /><br />
|
|
29
|
-
<label>Response Data:</label><br /><br />
|
|
30
|
-
<textarea
|
|
31
|
-
disabled
|
|
32
|
-
rows="20"
|
|
33
|
-
cols="100"
|
|
34
|
-
type="text"
|
|
35
|
-
id="responseP"
|
|
36
|
-
></textarea>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<!-- <script src="../../dist/browser.js"></script> -->
|
|
41
|
-
<script src="https://cdn.jsdelivr.net/npm/@coherentglobal/spark-execute-sdk@0.3.8/dist/browser.js"></script>
|
|
42
|
-
<script>
|
|
43
|
-
const modelpath = "./models/0211e8f0-9988-4514-a761-9782db6700ce.zip"
|
|
44
|
-
|
|
45
|
-
const getModel = async () => {
|
|
46
|
-
const result = await fetch(modelpath)
|
|
47
|
-
.then(response => response.blob())
|
|
48
|
-
.then( blob => {
|
|
49
|
-
return blobToBase64(blob)
|
|
50
|
-
.then((base64String) => {
|
|
51
|
-
return base64String.split(",")[1];
|
|
52
|
-
});
|
|
53
|
-
})
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const blobToBase64 = (blob) => {
|
|
58
|
-
return new Promise((resolve, _) => {
|
|
59
|
-
const reader = new FileReader();
|
|
60
|
-
reader.onloadend = () => resolve(reader.result);
|
|
61
|
-
reader.readAsDataURL(blob);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const config = {
|
|
66
|
-
sparkEndpoint: {
|
|
67
|
-
url: "https://spark.dev.coherent.global",
|
|
68
|
-
tenant: "coherent",
|
|
69
|
-
authType: "bearerToken",
|
|
70
|
-
bearerToken: ""
|
|
71
|
-
},
|
|
72
|
-
nodeGenModels: [
|
|
73
|
-
{
|
|
74
|
-
versionId: "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
75
|
-
type: "function",
|
|
76
|
-
binary: getModel,
|
|
77
|
-
metaData:{
|
|
78
|
-
"id": "7156c7a4-8a81-4d83-ac7f-a54ce02009da",
|
|
79
|
-
"url": "/docstore/api/v1/documents/versions/tokens/ItHPu2LY%2F626xeFbg%2BlSskCRy0%2FKjVp0H4uIcJmX%2BH0ehoZgRGXefIcHwR9PuX7kKHk3ywjoy6hVqkIDPWn4jAcsDN07VXdys0%2Fi4LdSxmtKGKF8IT9f%2FZZWRGWTmNWQ9SweGfiT7xc5N2%2BC9aTmlySAtACZkcdYDpsKtSuhvSJrRrSkzlt9Ra4TPBXTaokPfGR6VzK%2FMKM%2B3y3aXt3sT0P5EIRF%2BtMrVmpwmTTGva8%3D/Model_C.c1engine",
|
|
80
|
-
"EngineInformation": {
|
|
81
|
-
"FileSize": 4885,
|
|
82
|
-
"Author": "francisc.camillo@coherent.global",
|
|
83
|
-
"ProductName": "ExecuteSDK",
|
|
84
|
-
"Revision": "1.0.0",
|
|
85
|
-
"Description": null,
|
|
86
|
-
"FileMD5Hash": "3E9395DB32F0E8430BD8865DDA53753C",
|
|
87
|
-
"UniversalFileHash": null,
|
|
88
|
-
"ReleaseDate": "2022-08-23T13:06:52.786Z",
|
|
89
|
-
"ServiceName": "Model_C",
|
|
90
|
-
"NoOfInstance": 1,
|
|
91
|
-
"UploaderEmail": "francisc.camillo@coherent.global",
|
|
92
|
-
"DefaultEngineType": "NodeGen",
|
|
93
|
-
"OriginalFileName": "Model_C.xlsx",
|
|
94
|
-
"SizeOfUploadedFile": 4885,
|
|
95
|
-
"ReleaseNote": null,
|
|
96
|
-
"IsTypeScriptFile": false,
|
|
97
|
-
"IsJsSheetEngineGenerated": false,
|
|
98
|
-
"EngineUpgradeType": "minor",
|
|
99
|
-
"PublicAPI": true,
|
|
100
|
-
"FileGuid": "42efc880-91f1-4928-88cc-b29b68327f26",
|
|
101
|
-
"ServiceGuid": "bcc2f47d-0682-4d2b-9174-5b01f903ee6b",
|
|
102
|
-
"ServiceVersionGuid": "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
103
|
-
"BaseUrl": "https://excel.dev.coherent.global",
|
|
104
|
-
"Tenant": "coherent",
|
|
105
|
-
"AllowToStoreHistory": true,
|
|
106
|
-
"CalcMode": "AUTO",
|
|
107
|
-
"ForceInputsWriteBeforeCalcModeChanges": true,
|
|
108
|
-
"Provenance": null,
|
|
109
|
-
"VersionLabel": "Model_C",
|
|
110
|
-
"ExplainerType": "",
|
|
111
|
-
"IsXParameter": false,
|
|
112
|
-
"XParameterSetVersionId": "",
|
|
113
|
-
"VersionUpgradeAssert": "OFF"
|
|
114
|
-
},
|
|
115
|
-
"XInputTable": [
|
|
116
|
-
{
|
|
117
|
-
"Input Name": "Input",
|
|
118
|
-
"Description": null,
|
|
119
|
-
"Address": "C2"
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
"XOutputTable": [
|
|
123
|
-
{
|
|
124
|
-
"Output Name": "Output1",
|
|
125
|
-
"Description": null,
|
|
126
|
-
"Address": "C3"
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
"FormsService": null,
|
|
130
|
-
"StaticService": null,
|
|
131
|
-
"VersionId": "0211e8f0-9988-4514-a761-9782db6700ce"
|
|
132
|
-
,
|
|
133
|
-
"created": "2022-08-23T13:06:55.017422Z",
|
|
134
|
-
"effectiveStartDate": "2009-12-31T16:00:00Z",
|
|
135
|
-
"effectiveEndDate": "2119-12-31T16:00:00Z",
|
|
136
|
-
"path": "/products/ExecuteSDK/productfactory/engines/Model_C/Model_C.c1engine",
|
|
137
|
-
"privacyLevel": "Private",
|
|
138
|
-
"dateTime1": "2009-12-31T16:00:00Z",
|
|
139
|
-
"dateTime2": "2119-12-31T16:00:00Z",
|
|
140
|
-
"status1": "nodegen",
|
|
141
|
-
"status2": "Model_C.xlsx",
|
|
142
|
-
"email1": null,
|
|
143
|
-
"email2": null,
|
|
144
|
-
"amount1": 4885,
|
|
145
|
-
"amount2": 9184,
|
|
146
|
-
"amount3": null,
|
|
147
|
-
"type": "EngineDocument",
|
|
148
|
-
"policyNumber": "francisc.camillo@coherent.global",
|
|
149
|
-
"name1": "Model_C",
|
|
150
|
-
"name2": "Model_C.c1engine",
|
|
151
|
-
"otherString1": "1.0.0",
|
|
152
|
-
"otherString2": "EngineFile",
|
|
153
|
-
"referenceId": "ExecuteSDK~Model_C.c1engine",
|
|
154
|
-
"disposition": null,
|
|
155
|
-
"productName": "ExecuteSDK",
|
|
156
|
-
"content": null,
|
|
157
|
-
"latestVersionId": "0211e8f0-9988-4514-a761-9782db6700ce"
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
const dataInput2 = {
|
|
163
|
-
"request_data": {
|
|
164
|
-
"inputs": {
|
|
165
|
-
"Input": 1
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
"request_meta": {
|
|
169
|
-
"version_id": "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
170
|
-
"call_purpose": "Spark - API Tester",
|
|
171
|
-
"source_system": "SPARK",
|
|
172
|
-
"correlation_id": "",
|
|
173
|
-
"requested_output": null,
|
|
174
|
-
"service_category": ""
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
document.getElementById("myTextarea").value = JSON.stringify(dataInput2);
|
|
179
|
-
|
|
180
|
-
var spark = new Spark(config);
|
|
181
|
-
console.log("INITIALIZE SPARK", spark)
|
|
182
|
-
|
|
183
|
-
async function handleSubmit() {
|
|
184
|
-
const input = document.getElementById("myTextarea").value
|
|
185
|
-
const payload = JSON.parse(input);
|
|
186
|
-
const start = new Date();
|
|
187
|
-
try {
|
|
188
|
-
let res = await execute(payload);
|
|
189
|
-
const consumed = new Date - start;
|
|
190
|
-
document.getElementById(
|
|
191
|
-
"logsP"
|
|
192
|
-
).innerHTML = `\nComputation Time Consumed: ${consumed} ms\n`;
|
|
193
|
-
document.getElementById("responseP").innerHTML = `\n${JSON.stringify(
|
|
194
|
-
res,
|
|
195
|
-
null,
|
|
196
|
-
2
|
|
197
|
-
)}\n`;
|
|
198
|
-
console.log("RES", res)
|
|
199
|
-
} catch (err) {
|
|
200
|
-
console.log("ERROR", err)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// load();
|
|
204
|
-
async function execute(input) {
|
|
205
|
-
let result = await spark.execute(input);
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function handleChange() {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
</script>
|
|
214
|
-
</body>
|
|
215
|
-
|
|
216
|
-
</html>
|
|
217
|
-
|
|
218
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"request_data": {
|
|
3
|
-
"inputs": {
|
|
4
|
-
"Input": 1
|
|
5
|
-
}
|
|
6
|
-
},
|
|
7
|
-
"request_meta": {
|
|
8
|
-
"version_id": "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
9
|
-
"call_purpose": "Spark - API Tester",
|
|
10
|
-
"source_system": "SPARK",
|
|
11
|
-
"correlation_id": "",
|
|
12
|
-
"requested_output": null,
|
|
13
|
-
"service_category": ""
|
|
14
|
-
}
|
|
15
|
-
}
|
|
Binary file
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
console.log("SPARK START: ");
|
|
2
|
-
|
|
3
|
-
const Spark = require("../../src/node.js");
|
|
4
|
-
const modelC = require("./modelCInput.json");
|
|
5
|
-
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const location = "./models/0211e8f0-9988-4514-a761-9782db6700ce.zip";
|
|
8
|
-
|
|
9
|
-
const file = fs.readFileSync(location);
|
|
10
|
-
|
|
11
|
-
// generate base64
|
|
12
|
-
const data = file.toString("base64");
|
|
13
|
-
const buffer = Buffer.from(data, "base64");
|
|
14
|
-
|
|
15
|
-
const getModel = () => {
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const config = {
|
|
20
|
-
sparkEndpoint: {
|
|
21
|
-
url: "https://spark.dev.coherent.global",
|
|
22
|
-
tenant: "coherent",
|
|
23
|
-
authType: "bearerToken",
|
|
24
|
-
bearerToken: "",
|
|
25
|
-
},
|
|
26
|
-
nodeGenModels: [
|
|
27
|
-
{
|
|
28
|
-
versionId: "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
29
|
-
type: "function",
|
|
30
|
-
binary: getModel,
|
|
31
|
-
metaData: {
|
|
32
|
-
id: "7156c7a4-8a81-4d83-ac7f-a54ce02009da",
|
|
33
|
-
url: "/docstore/api/v1/documents/versions/tokens/ItHPu2LY%2F626xeFbg%2BlSskCRy0%2FKjVp0H4uIcJmX%2BH0ehoZgRGXefIcHwR9PuX7kKHk3ywjoy6hVqkIDPWn4jAcsDN07VXdys0%2Fi4LdSxmtKGKF8IT9f%2FZZWRGWTmNWQ9SweGfiT7xc5N2%2BC9aTmlySAtACZkcdYDpsKtSuhvSJrRrSkzlt9Ra4TPBXTaokPfGR6VzK%2FMKM%2B3y3aXt3sT0P5EIRF%2BtMrVmpwmTTGva8%3D/Model_C.c1engine",
|
|
34
|
-
EngineInformation: {
|
|
35
|
-
FileSize: 4885,
|
|
36
|
-
Author: "francisc.camillo@coherent.global",
|
|
37
|
-
ProductName: "ExecuteSDK",
|
|
38
|
-
Revision: "1.0.0",
|
|
39
|
-
Description: null,
|
|
40
|
-
FileMD5Hash: "3E9395DB32F0E8430BD8865DDA53753C",
|
|
41
|
-
UniversalFileHash: null,
|
|
42
|
-
ReleaseDate: "2022-08-23T13:06:52.786Z",
|
|
43
|
-
ServiceName: "Model_C",
|
|
44
|
-
NoOfInstance: 1,
|
|
45
|
-
UploaderEmail: "francisc.camillo@coherent.global",
|
|
46
|
-
DefaultEngineType: "NodeGen",
|
|
47
|
-
OriginalFileName: "Model_C.xlsx",
|
|
48
|
-
SizeOfUploadedFile: 4885,
|
|
49
|
-
ReleaseNote: null,
|
|
50
|
-
IsTypeScriptFile: false,
|
|
51
|
-
IsJsSheetEngineGenerated: false,
|
|
52
|
-
EngineUpgradeType: "minor",
|
|
53
|
-
PublicAPI: true,
|
|
54
|
-
FileGuid: "42efc880-91f1-4928-88cc-b29b68327f26",
|
|
55
|
-
ServiceGuid: "bcc2f47d-0682-4d2b-9174-5b01f903ee6b",
|
|
56
|
-
ServiceVersionGuid: "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
57
|
-
BaseUrl: "https://excel.dev.coherent.global",
|
|
58
|
-
Tenant: "coherent",
|
|
59
|
-
AllowToStoreHistory: true,
|
|
60
|
-
CalcMode: "AUTO",
|
|
61
|
-
ForceInputsWriteBeforeCalcModeChanges: true,
|
|
62
|
-
Provenance: null,
|
|
63
|
-
VersionLabel: "Model_C",
|
|
64
|
-
ExplainerType: "",
|
|
65
|
-
IsXParameter: false,
|
|
66
|
-
XParameterSetVersionId: "",
|
|
67
|
-
VersionUpgradeAssert: "OFF",
|
|
68
|
-
},
|
|
69
|
-
XInputTable: [
|
|
70
|
-
{
|
|
71
|
-
"Input Name": "Input",
|
|
72
|
-
Description: null,
|
|
73
|
-
Address: "C2",
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
XOutputTable: [
|
|
77
|
-
{
|
|
78
|
-
"Output Name": "Output1",
|
|
79
|
-
Description: null,
|
|
80
|
-
Address: "C3",
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
FormsService: null,
|
|
84
|
-
StaticService: null,
|
|
85
|
-
VersionId: "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
86
|
-
created: "2022-08-23T13:06:55.017422Z",
|
|
87
|
-
effectiveStartDate: "2009-12-31T16:00:00Z",
|
|
88
|
-
effectiveEndDate: "2119-12-31T16:00:00Z",
|
|
89
|
-
path: "/products/ExecuteSDK/productfactory/engines/Model_C/Model_C.c1engine",
|
|
90
|
-
privacyLevel: "Private",
|
|
91
|
-
dateTime1: "2009-12-31T16:00:00Z",
|
|
92
|
-
dateTime2: "2119-12-31T16:00:00Z",
|
|
93
|
-
status1: "nodegen",
|
|
94
|
-
status2: "Model_C.xlsx",
|
|
95
|
-
email1: null,
|
|
96
|
-
email2: null,
|
|
97
|
-
amount1: 4885,
|
|
98
|
-
amount2: 9184,
|
|
99
|
-
amount3: null,
|
|
100
|
-
type: "EngineDocument",
|
|
101
|
-
policyNumber: "francisc.camillo@coherent.global",
|
|
102
|
-
name1: "Model_C",
|
|
103
|
-
name2: "Model_C.c1engine",
|
|
104
|
-
otherString1: "1.0.0",
|
|
105
|
-
otherString2: "EngineFile",
|
|
106
|
-
referenceId: "ExecuteSDK~Model_C.c1engine",
|
|
107
|
-
disposition: null,
|
|
108
|
-
productName: "ExecuteSDK",
|
|
109
|
-
content: null,
|
|
110
|
-
latestVersionId: "0211e8f0-9988-4514-a761-9782db6700ce",
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
let spark;
|
|
117
|
-
try {
|
|
118
|
-
spark = new Spark(config);
|
|
119
|
-
} catch (err) {
|
|
120
|
-
console.log("ERR: ", err);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const modelToTest = "0211e8f0-9988-4514-a761-9782db6700ce"; // Model C
|
|
124
|
-
const dataInput = modelC;
|
|
125
|
-
|
|
126
|
-
async function execute() {
|
|
127
|
-
console.log("Reached");
|
|
128
|
-
try {
|
|
129
|
-
let result = await spark.execute(dataInput);
|
|
130
|
-
|
|
131
|
-
console.log("Final Result", result);
|
|
132
|
-
return result;
|
|
133
|
-
} catch (err) {
|
|
134
|
-
console.log("No model found", err);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
(async () => await execute())();
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const location = "./models/Model_C.zip"
|
|
3
|
-
|
|
4
|
-
const file = fs.readFileSync(location)
|
|
5
|
-
|
|
6
|
-
// generate base64
|
|
7
|
-
const data = file.toString('base64')
|
|
8
|
-
const buffer = Buffer.from(data, 'base64')
|
|
9
|
-
const uint = new Uint8Array(buffer)
|
|
10
|
-
console.log(uint)
|
|
11
|
-
// fs.writeFileSync('./models/base64model.txt', data)
|
|
12
|
-
|
|
13
|
-
// generate blob
|
|
14
|
-
// const blob = atob(data)
|
|
15
|
-
// fs.writeFileSync('./models/blobmodel.txt', blob)
|
|
16
|
-
|
|
17
|
-
|