@coherentglobal/spark-execute-sdk 0.8.2 → 0.8.4

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 CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@coherentglobal/spark-execute-sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Coherent Spark Execute SDK for Node.js and Browser",
5
5
  "main": "src/node.js",
6
6
  "browser": "dist/browser.js",
7
7
  "types": "types/node.d.ts",
8
8
  "scripts": {
9
9
  "build": "npm run build:types && npm run bundle:full && npm run bundle:min",
10
+ "lint": "eslint",
10
11
  "build:types": "tsc --declaration",
11
- "bundle:full": "browserify src/browser.js --standalone Spark > dist/browser.js",
12
- "bundle:min": "browserify src/browser.js --standalone Spark | uglifyjs --compress --mangle --comments false > lib/sparkexecute.min.js",
13
- "test": "npx mocha --bail --exit --recursive --timeout 100000 --reporter nyan",
14
- "cover": "nyc --check-coverage --reporter=lcov --lines 65 mocha --bail --exit --recursive --timeout 100000"
12
+ "bundle:full": "mkdir -p dist && browserify src/browser.js --standalone Spark > dist/browser.js",
13
+ "bundle:min": "mkdir -p lib && browserify src/browser.js --standalone Spark | uglifyjs --compress --mangle --comments false > lib/sparkexecute.min.js",
14
+ "test": "npm run test:node && npm run test:browser",
15
+ "test:node": "npx mocha --bail --exit --timeout 100000 --reporter nyan --jobs 1 'test/!(spark-sdk-browser).test.js' 'test/**/*.test.js' --exclude 'test/spark-sdk-browser.test.js'",
16
+ "test:browser": "npx mocha --bail --exit --timeout 100000 --reporter nyan --jobs 1 'test/spark-sdk-browser.test.js'",
17
+ "cover": "nyc mocha --bail --exit --timeout 100000 --recursive"
15
18
  },
16
19
  "engines": {
17
20
  "node": ">=14.0.0"
@@ -19,18 +22,22 @@
19
22
  "directories": {
20
23
  "test": "test"
21
24
  },
25
+ "files": [
26
+ "types/",
27
+ "src/"
28
+ ],
22
29
  "keywords": [],
23
30
  "author": "",
24
31
  "license": "ISC",
25
32
  "dependencies": {
26
- "@coherentglobal/wasm-runner": "^0.0.102",
33
+ "@coherentglobal/wasm-runner": "^0.2.4",
27
34
  "@types/node": "^18.7.18",
28
35
  "axios": "^1.6.7",
29
36
  "fs": "^0.0.1-security",
30
37
  "got": "^11.8.6",
31
38
  "http-status-codes": "^2.2.0",
32
39
  "joi": "^17.6.0",
33
- "pino": "^8.5.0",
40
+ "pino": "^10.1.0",
34
41
  "serialize-anything": "^1.2.3",
35
42
  "uuid": "^9.0.0"
36
43
  },
@@ -65,7 +72,10 @@
65
72
  "uglify-js": "^3.17.0"
66
73
  },
67
74
  "overrides": {
68
- "@types/cacheable-request": "8.3.1"
75
+ "@types/cacheable-request": "8.3.1",
76
+ "form-data": "4.0.4",
77
+ "tmp": "0.2.5",
78
+ "pino": "^10.1.0"
69
79
  },
70
80
  "browserify": {
71
81
  "transform": [
@@ -86,5 +96,24 @@
86
96
  }
87
97
  ]
88
98
  ]
99
+ },
100
+ "nyc": {
101
+ "exclude": [
102
+ "src/resolver_temp/**",
103
+ "test/**",
104
+ "**/*.test.js",
105
+ "dist/**",
106
+ "lib/**",
107
+ "node_modules/**"
108
+ ],
109
+ "reporter": [
110
+ "text",
111
+ "lcov"
112
+ ],
113
+ "check-coverage": true,
114
+ "lines": 80,
115
+ "statements": 80,
116
+ "functions": 80,
117
+ "branches": 80
89
118
  }
90
119
  }
package/src/browser.js CHANGED
@@ -61,15 +61,15 @@ class Spark {
61
61
  /**
62
62
  * @private
63
63
  */
64
- this.model = this._models(this.config?.nodeGenModels);
64
+ this.model = this._models(this.config?.nodegenModels || this.config?.nodeGenModels);
65
65
 
66
66
  this.modelCount = 0;
67
67
  this._offlinePreventCleanupModels = [];
68
68
  this._offlineLastExecution = {};
69
69
  this._offlineLastExecuting = {};
70
70
 
71
- this.offlineMaxService = this.config?.offlineMaxService || parseInt(process.env.OFFLINE_MAX_SERVICE) || 20;
72
- this.timeout = this.config?.timeout || parseInt(process.env.TIMEOUT_MS) || 60000;
71
+ this.offlineMaxService = this.config?.offlineMaxService || 20;
72
+ this.timeout = this.config?.timeout || 60000;
73
73
  }
74
74
 
75
75
  log(msg) {
@@ -216,6 +216,7 @@ class Spark {
216
216
  if (!input?.request_meta) {
217
217
  input.request_meta = {};
218
218
  }
219
+
219
220
  if (versionID) {
220
221
  input.request_meta.version_id = versionId;
221
222
  }
@@ -258,14 +259,16 @@ class Spark {
258
259
  let hasVersionId = options?.version_id;
259
260
 
260
261
  if (hasVersionId && !this._registry.isExist(hasVersionId)) {
262
+ // Look up the model dynamically instead of using captured scope
263
+ const xcallModel = this._getModel(hasVersionId);
261
264
  await this._registry.append({
262
265
  id: hasVersionId,
263
- url: model.binary,
266
+ url: xcallModel.binary,
264
267
  meta: {
265
268
  folder_name:
266
- model?.metaData?.EngineInformation?.ProductName ?? "",
269
+ xcallModel?.metaData?.EngineInformation?.ProductName ?? "",
267
270
  service_name:
268
- model?.metaData?.EngineInformation?.ServiceName ?? "",
271
+ xcallModel?.metaData?.EngineInformation?.ServiceName ?? "",
269
272
  },
270
273
  });
271
274
 
@@ -279,16 +282,16 @@ class Spark {
279
282
  })
280
283
 
281
284
  } else {
282
- const model = this._getModelByMeta(folderName, serviceName);
283
- hasVersionId = model?.versionId;
285
+ const xcallModel = this._getModelByMeta(folderName, serviceName);
286
+ hasVersionId = xcallModel?.versionId;
284
287
  await this._registry.append({
285
288
  id: hasVersionId,
286
- url: model.binary,
289
+ url: xcallModel.binary,
287
290
  meta: {
288
291
  folder_name:
289
- model?.metaData?.EngineInformation?.ProductName ?? "",
292
+ xcallModel?.metaData?.EngineInformation?.ProductName ?? "",
290
293
  service_name:
291
- model?.metaData?.EngineInformation?.ServiceName ?? "",
294
+ xcallModel?.metaData?.EngineInformation?.ServiceName ?? "",
292
295
  },
293
296
  });
294
297
  }
@@ -302,7 +305,7 @@ class Spark {
302
305
  this._registry = new WasmRunner(undefined, callback, "");
303
306
  }
304
307
 
305
- while(this._offlineLastExecuting[versionId]) {
308
+ while (this._offlineLastExecuting[versionId]) {
306
309
  await utils.sleep(10);
307
310
  }
308
311
 
@@ -319,10 +322,10 @@ class Spark {
319
322
  service_name: model?.metaData?.EngineInformation?.ServiceName ?? "",
320
323
  },
321
324
  });
322
-
325
+
323
326
  this.modelCount = this.modelCount + 1;
324
327
 
325
- if(model && model.preventCleanup) {
328
+ if (model && model.preventCleanup) {
326
329
  this._offlinePreventCleanupModels.push(model?.versionId)
327
330
  }
328
331
  }
@@ -332,10 +335,11 @@ class Spark {
332
335
  let error = true;
333
336
  let duration = 0;
334
337
 
338
+ let result;
335
339
  while (error && retry <= MAX_RETRY) {
336
340
  const xcallChainId = xcallTracker.issueXcallChainId();
337
341
  const appendedInput = utils.appendingContext(tenant, input, null, null, xcallChainId, true);
338
- const result = await this._registry.execute(
342
+ result = await this._registry.execute(
339
343
  appendedInput,
340
344
  versionId,
341
345
  () => { },
@@ -384,17 +388,34 @@ class Spark {
384
388
  return result;
385
389
  }
386
390
  }
391
+
392
+ if (retry > MAX_RETRY && result) {
393
+ this._registry.remove(versionId);
394
+ console.log('Reappend failed model');
395
+ await this._registry.append({
396
+ id: versionId,
397
+ url: model.binary,
398
+ meta: {
399
+ folder_name:
400
+ model?.metaData?.EngineInformation?.ProductName ?? "",
401
+ service_name:
402
+ model?.metaData?.EngineInformation?.ServiceName ?? "",
403
+ },
404
+ });
405
+ this._offlineLastExecuting[versionId] = false;
406
+ return result
407
+ }
387
408
  } catch (err) {
388
409
  this._offlineLastExecution[versionId] = Date.now();
389
410
  this._offlineLastExecuting[versionId] = false;
390
- if(err instanceof ModelExecuteCancelled) {
411
+ if (err instanceof ModelExecuteCancelled) {
391
412
  throw new WasmRunnerErrors.ExecuteCancelled(versionId);
392
413
  }
393
414
  return err;
394
415
  }
395
416
  }
396
417
 
397
- async _cleanUp () {
418
+ async _cleanUp() {
398
419
  let nonExecuteModel = [];
399
420
  Object.keys(this._offlineLastExecuting).forEach((key) => {
400
421
  if (this._offlineLastExecuting[key] === false && this._offlinePreventCleanupModels.find(m => m === key) === undefined) { // key !== 'cf3c7e5a-2f3b-4c79-81b9-7e4b174258cd' && key !== 'a167da91-afa6-4579-bd22-09752a30b57b') {
@@ -484,6 +505,53 @@ class Spark {
484
505
  throw err;
485
506
  }
486
507
  }
508
+
509
+ /**
510
+ * Destroy the Spark instance and clean up resources
511
+ * @returns {Promise<void>}
512
+ */
513
+ async destroy() {
514
+ if (this._registry) {
515
+ try {
516
+ // Get all model IDs
517
+ const modelIds = Object.keys(this._offlineLastExecution);
518
+
519
+ // Remove all models
520
+ for (const modelId of modelIds) {
521
+ try {
522
+ if (this._registry.isExist(modelId)) {
523
+ await this._registry.remove(modelId);
524
+ }
525
+ } catch (err) {
526
+ this.log({
527
+ EventType: 'SDK.Destroy.ModelRemoveError',
528
+ TextMessage: `Error removing model ${modelId}: ${err.message}`,
529
+ });
530
+ }
531
+ }
532
+
533
+ // Destroy the registry if it has a destroy method
534
+ if (typeof this._registry.destroy === 'function') {
535
+ await this._registry.destroy();
536
+ }
537
+
538
+ this._registry = undefined;
539
+ this.modelCount = 0;
540
+ this._offlineLastExecution = {};
541
+ this._offlineLastExecuting = {};
542
+
543
+ this.log({
544
+ EventType: 'SDK.Destroy.Complete',
545
+ TextMessage: 'Spark instance destroyed successfully',
546
+ });
547
+ } catch (err) {
548
+ this.log({
549
+ EventType: 'SDK.Destroy.Error',
550
+ TextMessage: `Error during destroy: ${err.message}`,
551
+ });
552
+ }
553
+ }
554
+ }
487
555
  }
488
556
 
489
557
  module.exports = Spark;
package/src/findModels.js CHANGED
@@ -29,7 +29,7 @@ const findModel = (requestMeta, nodegenModels) => {
29
29
  versionA.metaData.EngineInformation.Revision.replace(
30
30
  /\d+/g,
31
31
  (n) => +n + 100000
32
- ).localCompare(
32
+ ).localeCompare(
33
33
  versionB.metaData.EngineInformation.Revision.replace(
34
34
  /\d+/g,
35
35
  (n) => +n + 100000
@@ -55,7 +55,7 @@ const findModel = (requestMeta, nodegenModels) => {
55
55
  versionA.metaData.EngineInformation.Revision.replace(
56
56
  /\d+/g,
57
57
  (n) => +n + 100000
58
- ).localCompare(
58
+ ).localeCompare(
59
59
  versionB.metaData.EngineInformation.Revision.replace(
60
60
  /\d+/g,
61
61
  (n) => +n + 100000
@@ -86,7 +86,7 @@ const findModel = (requestMeta, nodegenModels) => {
86
86
  versionA.metaData.EngineInformation.Revision.replace(
87
87
  /\d+/g,
88
88
  (n) => +n + 100000
89
- ).localCompare(
89
+ ).localeCompare(
90
90
  versionB.metaData.EngineInformation.Revision.replace(
91
91
  /\d+/g,
92
92
  (n) => +n + 100000
@@ -112,7 +112,7 @@ const findModel = (requestMeta, nodegenModels) => {
112
112
  versionA.metaData.EngineInformation.Revision.replace(
113
113
  /\d+/g,
114
114
  (n) => +n + 100000
115
- ).localCompare(
115
+ ).localeCompare(
116
116
  versionB.metaData.EngineInformation.Revision.replace(
117
117
  /\d+/g,
118
118
  (n) => +n + 100000
@@ -140,7 +140,7 @@ const findModel = (requestMeta, nodegenModels) => {
140
140
  versionA.metaData.EngineInformation.Revision.replace(
141
141
  /\d+/g,
142
142
  (n) => +n + 100000
143
- ).localCompare(
143
+ ).localeCompare(
144
144
  versionB.metaData.EngineInformation.Revision.replace(
145
145
  /\d+/g,
146
146
  (n) => +n + 100000
@@ -177,7 +177,7 @@ const findModel = (requestMeta, nodegenModels) => {
177
177
  versionA.metaData.EngineInformation.Revision.replace(
178
178
  /\d+/g,
179
179
  (n) => +n + 100000
180
- ).localCompare(
180
+ ).localeCompare(
181
181
  versionB.metaData.EngineInformation.Revision.replace(
182
182
  /\d+/g,
183
183
  (n) => +n + 100000
@@ -2,7 +2,7 @@ const WasmRunnerErrors = require("../error.js");
2
2
  const xcallTracker = require("../xcallTracker.js");
3
3
 
4
4
  const isEmpty = (obj) => {
5
- [Object, Array].includes((obj || {}).constructor) &&
5
+ return [Object, Array].includes((obj || {}).constructor) &&
6
6
  !Object.entries(obj || {}).length;
7
7
  };
8
8
 
@@ -18,7 +18,10 @@ const isValidURL = (url) => {
18
18
  function isBrowser() {
19
19
  try {
20
20
  // eslint-disable-next-line no-undef
21
- return window;
21
+ if(typeof window !== 'undefined') {
22
+ return true;
23
+ }
24
+ return false;
22
25
  } catch (e) {
23
26
  return false;
24
27
  }
package/src/node.js CHANGED
@@ -89,7 +89,12 @@ class Spark {
89
89
  /**
90
90
  * @private
91
91
  */
92
- this.model = this._models(this.config?.nodeGenModels);
92
+ this.model = this._models(this.config?.nodegenModels || this.config?.nodeGenModels);
93
+
94
+ /**
95
+ * @private
96
+ */
97
+ this.nodegenModel = this.config?.nodegenModels || this.config?.nodeGenModels
93
98
 
94
99
  /**
95
100
  * @private
@@ -261,8 +266,8 @@ class Spark {
261
266
  if (!this.isSerializedConfig) {
262
267
  const config = { ...this.config };
263
268
 
264
- if (config.nodeGenModels) {
265
- config.nodeGenModels.forEach((m) => {
269
+ if (this.nodegenModel) {
270
+ this.nodegenModel.forEach((m) => {
266
271
  if (m.binary) {
267
272
  const filePath = path.join(
268
273
  __dirname,
@@ -322,7 +327,7 @@ class Spark {
322
327
 
323
328
  _storeConfig() {
324
329
  fs.writeFileSync('config.json', JSON.stringify(this.config), () =>
325
- console.err(err)
330
+ logger.error(err)
326
331
  );
327
332
  return require.resolve('config.json');
328
333
  }
@@ -368,6 +373,55 @@ class Spark {
368
373
  */
369
374
  // async remove(versionId) {}
370
375
 
376
+ /**
377
+ * Destroy and cleanup all resources including WasmRunner workers
378
+ */
379
+ async destroy() {
380
+ if (this._registry) {
381
+ try {
382
+ // Get all model IDs
383
+ const modelIds = Object.keys(this._offlineLastExecution);
384
+
385
+ // Remove all models
386
+ for (const modelId of modelIds) {
387
+ try {
388
+ if (this._registry.isExist(modelId)) {
389
+ await this._registry.remove(modelId);
390
+ }
391
+ } catch (err) {
392
+ logger.debug({
393
+ EventType: 'SDK.Destroy.ModelRemoveError',
394
+ InstanceId: this.instanceid,
395
+ TextMessage: `Error removing model ${modelId}: ${err.message}`,
396
+ });
397
+ }
398
+ }
399
+
400
+ // Destroy the registry if it has a destroy method
401
+ if (typeof this._registry.destroy === 'function') {
402
+ await this._registry.destroy();
403
+ }
404
+
405
+ this._registry = undefined;
406
+ this.modelCount = 0;
407
+ this._offlineLastExecution = {};
408
+ this._offlineLastExecuting = {};
409
+
410
+ logger.debug({
411
+ EventType: 'SDK.Destroy.Complete',
412
+ InstanceId: this.instanceid,
413
+ TextMessage: 'Spark instance destroyed successfully',
414
+ });
415
+ } catch (err) {
416
+ logger.error({
417
+ EventType: 'SDK.Destroy.Error',
418
+ InstanceId: this.instanceid,
419
+ TextMessage: `Error during destroy: ${err.message}`,
420
+ });
421
+ }
422
+ }
423
+ }
424
+
371
425
  async offlineModel(input, versionID, tenant = 'default', cancellationToken) {
372
426
  let versionId;
373
427
  try {
@@ -382,6 +436,15 @@ class Spark {
382
436
  Input: input,
383
437
  });
384
438
  input.callid = callid;
439
+
440
+ if(versionID) {
441
+ if(!input.request_meta) {
442
+ input.request_meta = {}
443
+ }
444
+
445
+ input.request_meta.version_id = versionID
446
+ }
447
+
385
448
  const model = findModel(input.request_meta, this.model);
386
449
 
387
450
  versionId = versionID || (model && model?.versionId);
@@ -407,10 +470,11 @@ class Spark {
407
470
  TextMessage: `Execute uuid: ${versionId}`,
408
471
  });
409
472
 
473
+ const modelSize = model?.replica || this.replica || 1;
410
474
  await this._registry.append({
411
475
  id: versionId,
412
476
  url: model?.binary || model?.binaryPath || '',
413
- size: model.replica || this.replica || 1,
477
+ size: modelSize,
414
478
  });
415
479
  this.modelCount = this.modelCount + 1;
416
480
  logger.debug({
@@ -446,6 +510,7 @@ class Spark {
446
510
  TextMessage: `Execute uuid: ${versionId}`,
447
511
  });
448
512
  this._offlineLastExecuting[versionId] = true;
513
+
449
514
  let result = await this._registry.execute(
450
515
  input,
451
516
  versionId,
package/src/validate.js CHANGED
@@ -1,5 +1,27 @@
1
1
  const Joi = require("joi");
2
2
 
3
+ modelConfig = Joi.array()
4
+ .items(
5
+ Joi.object({
6
+ versionId: Joi.string(),
7
+ type: Joi.string(),
8
+ binary: [
9
+ Joi.string().allow(""),
10
+ Joi.function().allow(""),
11
+ Joi.object({
12
+ servicename: Joi.string(),
13
+ wasm: Joi.string(),
14
+ js: Joi.string(),
15
+ data: Joi.string(),
16
+ }),
17
+ ],
18
+ binaryPath: Joi.string(),
19
+ metaData: Joi.object(),
20
+ replica: Joi.number().integer().min(1),
21
+ preventCleanup: Joi.boolean(),
22
+ })
23
+ )
24
+
3
25
  const rules = Joi.object({
4
26
  replica: Joi.number().integer().min(1),
5
27
  sparkEndpoint: Joi.object({
@@ -17,33 +39,13 @@ const rules = Joi.object({
17
39
  syntheticKey: [Joi.string().allow(""), Joi.function().allow("")], // allow fns
18
40
  bearerToken: [Joi.string().allow(""), Joi.function().allow("")], // allow strings/fns
19
41
  }).and("url", "tenant", "authType"),
20
- nodeGenModels: Joi.array()
21
- .items(
22
- Joi.object({
23
- versionId: Joi.string(),
24
- type: Joi.string(),
25
- binary: [
26
- Joi.string().allow(""),
27
- Joi.function().allow(""),
28
- Joi.object({
29
- servicename: Joi.string(),
30
- wasm: Joi.string(),
31
- js: Joi.string(),
32
- data: Joi.string(),
33
- }),
34
- ],
35
- binaryPath: Joi.string(),
36
- metaData: Joi.object(),
37
- replica: Joi.number().integer().min(1),
38
- preventCleanup: Joi.boolean(),
39
- })
40
- )
41
- .required(),
42
+ nodegenModels: modelConfig,
43
+ nodeGenModels: modelConfig,
42
44
  // externalUuid: Joi.string().allow(),
43
45
  // xParameters: Joi.array().items(),
44
46
  // xCallCallback: Joi.func()
45
47
  timeout: Joi.number().integer().min(1), // in ms
46
- }).required();
48
+ }).xor('nodeGenModels', 'nodegenModels').required();
47
49
 
48
50
  const validate = (config) => {
49
51
  const isValidConfig = rules.validate(config);
@@ -88,6 +88,11 @@ declare class Spark {
88
88
  offlineModel(input: any, versionID: any, instance: any, tenant: string | undefined, cancellationToken: any): Promise<any>;
89
89
  _cleanUp(): Promise<void>;
90
90
  onlineModelEndpoint(input: any, versionID: any): Promise<any>;
91
+ /**
92
+ * Destroy the Spark instance and clean up resources
93
+ * @returns {Promise<void>}
94
+ */
95
+ destroy(): Promise<void>;
91
96
  }
92
97
  import { CancellationToken } from "@coherentglobal/wasm-runner";
93
98
  import WasmRunnerErrors = require("./error.js");
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.js"],"names":[],"mappings":";AAOA;IACE,iDAA2C;IAE3C;;OAEG;IACH,oBAFW,MAAM,gBA6DhB;IA1DC;;OAEG;IACH,kBAA0B;IAMxB,YAAyB;IAG3B;;OAEG;IACH,eAAyC;IAEzC;;OAEG;IACH,eAAsD;IACtD;;OAEG;IACH,iBAA0D;IAC1D;;OAEG;IACH,cAGI;IACJ;;OAEG;IACH,YAAgD;IAChD;;OAEG;IACH,qBAA2C;IAE3C;;OAEG;IACH,iBAA2C;IAE3C;;OAEG;IACH,cAAqD;IAErD,mBAAmB;IACnB,oCAAsC;IACtC,0BAA+B;IAC/B,0BAA+B;IAE/B,uBAA0G;IAC1G,aAAgF;IAGlF,oBAEC;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAuBlB;IACD;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAsBlB;IACD;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAOnB;IAED,wDASC;IAED;;;;;;OAMG;IACH,oCAJW,MAAM,sDAiBhB;IAED;;;;;;;OAOG;IACH,eALW,MAAM,4DAGJ,MAAM,CA0BlB;IAED,0HAwLC;IAED,0BA0BC;IAED,8DA6DC;CACF"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.js"],"names":[],"mappings":";AAOA;IACE,iDAA2C;IAE3C;;OAEG;IACH,oBAFW,MAAM,gBA6DhB;IA1DC;;OAEG;IACH,kBAA0B;IAMxB,YAAyB;IAG3B;;OAEG;IACH,eAAyC;IAEzC;;OAEG;IACH,eAAsD;IACtD;;OAEG;IACH,iBAA0D;IAC1D;;OAEG;IACH,cAGI;IACJ;;OAEG;IACH,YAAgD;IAChD;;OAEG;IACH,qBAA2C;IAE3C;;OAEG;IACH,iBAA2C;IAE3C;;OAEG;IACH,cAAmF;IAEnF,mBAAmB;IACnB,oCAAsC;IACtC,0BAA+B;IAC/B,0BAA+B;IAE/B,uBAA6D;IAC7D,aAA4C;IAG9C,oBAEC;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAuBlB;IACD;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAsBlB;IACD;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAOnB;IAED,wDASC;IAED;;;;;;OAMG;IACH,oCAJW,MAAM,sDAiBhB;IAED;;;;;;;OAOG;IACH,eALW,MAAM,4DAGJ,MAAM,CA0BlB;IAED,0HA6MC;IAED,0BA0BC;IAED,8DA6DC;IAED;;;OAGG;IACH,WAFa,QAAQ,IAAI,CAAC,CA2CzB;CACF"}
@@ -1,8 +1,8 @@
1
- export function isEmpty(obj: any): void;
1
+ export function isEmpty(obj: any): boolean;
2
2
  export function isValidURL(url: any): boolean;
3
3
  export function isCompatible(): boolean;
4
4
  export function isWasmSupported(): boolean;
5
- export function isBrowser(): false | (Window & typeof globalThis);
5
+ export function isBrowser(): boolean;
6
6
  export function getAuthHeaders(token: any, authType: any, tenant: any): {
7
7
  "x-tenant-name": any;
8
8
  "x-synthetic-key": any;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.js"],"names":[],"mappings":"AAGA,wCAGC;AAED,8CAOC;AA6BD,wCAMC;AAxBD,2CAgBC;AAzBD,kEAOC;AA8BD;;;;EAYC;AAED,wJA4BC;AAED;;;EAsBC;AAED,oDAEC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.js"],"names":[],"mappings":"AAGA,2CAGC;AAED,8CAOC;AAgCD,wCAMC;AAxBD,2CAgBC;AA5BD,qCAUC;AA8BD;;;;EAYC;AAED,wJA4BC;AAED;;;EAsBC;AAED,oDAEC"}
package/types/logger.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- declare const _exports: any;
1
+ declare const _exports: pino.Logger<never, boolean>;
2
2
  export = _exports;
3
+ import pino = require("pino");
3
4
  //# sourceMappingURL=logger.d.ts.map
package/types/node.d.ts CHANGED
@@ -42,6 +42,10 @@ declare class Spark {
42
42
  * @private
43
43
  */
44
44
  private model;
45
+ /**
46
+ * @private
47
+ */
48
+ private nodegenModel;
45
49
  /**
46
50
  * @private
47
51
  */
@@ -91,6 +95,10 @@ declare class Spark {
91
95
  /**
92
96
  * Remove Model
93
97
  */
98
+ /**
99
+ * Destroy and cleanup all resources including WasmRunner workers
100
+ */
101
+ destroy(): Promise<void>;
94
102
  offlineModel(input: any, versionID: any, tenant: string | undefined, cancellationToken: any): Promise<import("@coherentglobal/wasm-runner/dist/types.js").ResponseObject>;
95
103
  /**
96
104
  *
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAiBA;IACE,iDAA2C;IAE3C;;OAEG;IACH,oBAFW,MAAM,+CA+EhB;IA5EC;;OAEG;IACH,kBAA0B;IAGxB,SAAsB;IAGxB;;OAEG;IACH,mBAC4D;IAU1D,eAAsB;IAMxB,aAAwC;IAExC,uBAA0G;IAE1G,aAAgF;IAEhF;;OAEG;IACH,eAAsD;IACtD;;OAEG;IACH,iBAA0D;IAC1D;;OAEG;IACH,cAGI;IACJ;;OAEG;IACH,YAAgD;IAChD;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAqD;IAErD;;OAEG;IACH,yBAAmD;IAEnD;;OAEG;IACH,iBAAkD;IAClD,mBAAmB;IACnB,0BAA+B;IAC/B,0BAA+B;IAC/B,oCAAsC;IAGxC;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAelB;IAED,0CASC;IAED;;;;;;;OAOG;IACH,eALW,MAAM,uFAGJ,MAAM,CAsClB;IAED;;;;;;OAMG;IACH,oCAJW,MAAM,sDAiBhB;IAED,+BAiFC;IAED,wDAYC;IAED,uBAKC;IAED,0BA0BC;IAED;;OAEG;IAGH,0KAyGC;IAGD;;;;;;;OAOG;IACH,2BANW,MAAM,aACN,MAAM,iDAEN,iBAAiB,gBAiF3B;CACF"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.js"],"names":[],"mappings":";AAmBA;IACE,iDAA2C;IAE3C;;OAEG;IACH,oBAFW,MAAM,+CAwFhB;IArFC;;OAEG;IACH,kBAA0B;IAGxB,SAAsB;IAGxB;;OAEG;IACH,mBAC4D;IAU1D,eAAsB;IAMxB,aAAwC;IAExC,uBAGI;IAEJ,aACmE;IAEnE;;OAEG;IACH,eAAsD;IACtD;;OAEG;IACH,iBAA0D;IAC1D;;OAEG;IACH,cAGI;IACJ;;OAEG;IACH,YAAgD;IAChD;;OAEG;IACH,qBAA2C;IAC3C;;OAEG;IACH,cAAmF;IAEnF;;OAEG;IACH,qBAA4E;IAE5E;;OAEG;IACH,yBAAmD;IAEnD;;OAEG;IACH,iBAAkD;IAClD,mBAAmB;IACnB,0BAA+B;IAC/B,0BAA+B;IAC/B,oCAAsC;IAGxC;;;;OAIG;IACH,iBAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,MAAM,CAelB;IAED,0CASC;IAED;;;;;;;OAOG;IACH,eALW,MAAM,uFAGJ,MAAM,CA2ClB;IAED;;;;;;OAMG;IACH,oCAJW,MAAM,sDAiBhB;IAED,+BAkFC;IAED,wDAYC;IAED,uBAKC;IAED,0BAkCC;IAED;;OAEG;IAGH;;OAEG;IACH,yBA4CC;IAED,0KA8HC;IAED;;;;;;;OAOG;IACH,2BANW,MAAM,aACN,MAAM,iDAEN,iBAAiB,gBAsF3B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.js"],"names":[],"mappings":";AA+CA,kEAGC"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.js"],"names":[],"mappings":";AAiDA,kEAGC"}
package/.babelrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "esmodules": true
8
- }
9
- }
10
- ]
11
- ]
12
- }
package/.eslintrc.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "extends": [
3
- "airbnb/base",
4
- "prettier",
5
- "plugin:node/recommended",
6
- "plugin:mocha/recommended"
7
- ],
8
- "parserOptions": {
9
- "ecmaVersion": 2020
10
- },
11
- "plugins": ["prettier", "mocha"],
12
- "rules": {
13
- "prettier/prettier": "error",
14
- "no-unused-vars": "warn",
15
- "no-console": "off",
16
- "func-names": "off",
17
- "no-process-exit": "off",
18
- "object-shorthand": "off",
19
- "class-methods-use-this": "off"
20
- }
21
- }
package/.prettierrc DELETED
File without changes