@coherentglobal/spark-execute-sdk 0.8.1 → 0.8.2

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/dist/browser.js CHANGED
@@ -12144,7 +12144,7 @@ var Spark = /*#__PURE__*/function () {
12144
12144
  eventType: "spark.validateconfig.startend.error",
12145
12145
  duration: _end - start
12146
12146
  });
12147
- throw new Error("ValidationError: ".concat(message));
12147
+ throw new Error("SDK Setup ValidationError: ".concat(message));
12148
12148
  }
12149
12149
  }
12150
12150
  /**
@@ -12209,7 +12209,7 @@ var Spark = /*#__PURE__*/function () {
12209
12209
  */
12210
12210
  }, {
12211
12211
  key: "execute",
12212
- value: function () {
12212
+ value: (function () {
12213
12213
  var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(input, version_id, cancellationToken) {
12214
12214
  var _input$request_meta, _input$request_meta2;
12215
12215
  var versionID, lookup, response;
@@ -12251,7 +12251,7 @@ var Spark = /*#__PURE__*/function () {
12251
12251
  return _execute.apply(this, arguments);
12252
12252
  }
12253
12253
  return execute;
12254
- }()
12254
+ }())
12255
12255
  }, {
12256
12256
  key: "offlineModel",
12257
12257
  value: function () {
@@ -12951,7 +12951,7 @@ var findModel = function findModel(requestMeta, nodegenModels) {
12951
12951
  }).reverse();
12952
12952
  }
12953
12953
  } else {
12954
- throw new Error("Model not found. requestMeta: " + JSON.stringify(requestMeta));
12954
+ throw new Error("SDK Setup Error: Model not found. requestMeta: " + JSON.stringify(requestMeta));
12955
12955
  }
12956
12956
  if (model.length === 0) {
12957
12957
  throw new WasmRunnerErrors.MissingModelError(requestMeta === null || requestMeta === void 0 ? void 0 : requestMeta.version_id);
@@ -13016,7 +13016,7 @@ var getAuthHeaders = function getAuthHeaders(token, authType, tenant) {
13016
13016
  } else if (authType === "bearerToken") {
13017
13017
  authHeaders.authorization = "Bearer ".concat(token);
13018
13018
  } else {
13019
- throw new Error("Invalid auth type ".concat(authType));
13019
+ throw new Error("Authentication Error: Invalid auth type ".concat(authType));
13020
13020
  }
13021
13021
  return authHeaders;
13022
13022
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coherentglobal/spark-execute-sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Coherent Spark Execute SDK for Node.js and Browser",
5
5
  "main": "src/node.js",
6
6
  "browser": "dist/browser.js",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@coherentglobal/wasm-runner": "^0.0.102",
27
27
  "@types/node": "^18.7.18",
28
- "axios": "^0.27.2",
28
+ "axios": "^1.6.7",
29
29
  "fs": "^0.0.1-security",
30
30
  "got": "^11.8.6",
31
31
  "http-status-codes": "^2.2.0",
package/src/browser.js CHANGED
@@ -126,7 +126,7 @@ class Spark {
126
126
  eventType: "spark.validateconfig.startend.error",
127
127
  duration: end - start,
128
128
  });
129
- throw new Error(`ValidationError: ${message}`);
129
+ throw new Error(`SDK Setup ValidationError: ${message}`);
130
130
  }
131
131
  }
132
132
  /**
package/src/findModels.js CHANGED
@@ -188,7 +188,7 @@ const findModel = (requestMeta, nodegenModels) => {
188
188
  }
189
189
  } else {
190
190
  throw new Error(
191
- "Model not found. requestMeta: " + JSON.stringify(requestMeta)
191
+ "SDK Setup Error: Model not found. requestMeta: " + JSON.stringify(requestMeta)
192
192
  );
193
193
  }
194
194
 
@@ -60,7 +60,7 @@ const getAuthHeaders = (token, authType, tenant) => {
60
60
  } else if (authType === "bearerToken") {
61
61
  authHeaders.authorization = `Bearer ${token}`;
62
62
  } else {
63
- throw new Error(`Invalid auth type ${authType}`);
63
+ throw new Error(`Authentication Error: Invalid auth type ${authType}`);
64
64
  }
65
65
 
66
66
  return authHeaders;
package/src/node.js CHANGED
@@ -130,11 +130,11 @@ class Spark {
130
130
  } else {
131
131
  const message = JSON.stringify(error.details);
132
132
  logger.error({
133
- EventType: 'ValidationError',
133
+ EventType: 'SDK.ValidationError',
134
134
  InstanceId: this.instanceid,
135
- TextMessage: message,
135
+ TextMessage: `SDK Validation Error: ${message}`,
136
136
  });
137
- throw new Error(`ValidationError: ${message}`);
137
+ throw new Error(`SDK Setup Error: ValidationError: ${message}`);
138
138
  }
139
139
  }
140
140
 
@@ -184,10 +184,10 @@ class Spark {
184
184
  break;
185
185
  }
186
186
  } catch (err) {
187
- logger.info({
188
- EventType: 'ExecuteModel.ERROR',
187
+ logger.error({
188
+ EventType: 'SDK.ExecuteModel.ERROR',
189
189
  InstanceId: this.instanceid,
190
- TextMessage: `Error while executing uuid: ${versionID} using priority:${this.priority[i]}`,
190
+ TextMessage: `SDK Execution Error: Error while executing uuid: ${versionID} using priority:${this.priority[i]}`,
191
191
  });
192
192
  error = err;
193
193
  }
@@ -476,7 +476,7 @@ class Spark {
476
476
  TimeStamp: Date.now(),
477
477
  EventType: 'SDK.OfflineModelExecutionError',
478
478
  InstanceId: this.instanceid,
479
- TextMessage: err.message,
479
+ TextMessage: `SDK Offline Model Execution Error: ${err.message}`,
480
480
  });
481
481
  if (err instanceof ModelExecuteCancelled) {
482
482
  throw new WasmRunnerErrors.ExecuteCancelled(versionId);
@@ -217,9 +217,9 @@ const sparkServiceVersionOne = async (requestData, context) => {
217
217
  } catch (err) {
218
218
  logger.error({
219
219
  eventType: "SDK.XCall.SparkService",
220
- msg: `WASMSERVER:DISPATCH_TYPE.SPARK_SERVICE ERROR: Request body is malform JSON ${JSON.stringify(requestData.request_body)}`,
220
+ msg: `Model Error: WASMSERVER:DISPATCH_TYPE.SPARK_SERVICE ERROR: Request body is malform JSON ${JSON.stringify(requestData.request_body)}`,
221
221
  });
222
- throw new Error(`Downstream Request body is malform JSON ${JSON.stringify(requestData.request_body)}`)
222
+ throw new Error(`Model Error: Downstream Request body is malform JSON ${JSON.stringify(requestData.request_body)}`)
223
223
  }
224
224
 
225
225
  const options = {};