@nginstack/engine-node 60.0.1 → 60.0.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/README.md CHANGED
@@ -6,7 +6,7 @@ Engine node API can be used to start and stop an Engine programmatically in a No
6
6
 
7
7
  ### Prerequisites
8
8
 
9
- * [Node.js](https://nodejs.org) 14 or greater.
9
+ * [Node.js](https://nodejs.org) 16 or greater.
10
10
 
11
11
  ### Installation
12
12
 
package/lib/Engine.js CHANGED
@@ -1,7 +1,6 @@
1
1
  const child_process = require('child_process');
2
2
  const path = require('path');
3
3
  const fs = require('fs');
4
- const url = require('url');
5
4
  const del = require('del');
6
5
  const request = require('request');
7
6
  const getPort = require('get-port');
@@ -15,7 +14,7 @@ const net = require('net');
15
14
 
16
15
  tmp.setGracefulCleanup();
17
16
 
18
- const ENGINE_APP = 'Engine64.exe';
17
+ const ENGINE_APP = os.platform() == 'win32' ? 'engine64.exe' : 'engine';
19
18
  const NGINT_APP_PATH = '/bin/win64/ngint.exe';
20
19
  const EXIT_CODE_RESTART_REQUIRED = 4;
21
20
  const ENGINE_STATUS_URL = '/api/service-status/v1/status';
@@ -125,12 +124,7 @@ class Engine {
125
124
  this.monitorTimeoutId_ = null;
126
125
  }
127
126
  this.monitorEnabled_ = true;
128
- request.get(url.format({
129
- protocol: 'http',
130
- hostname: 'localhost',
131
- port: this.httpPort,
132
- pathname: ENGINE_STATUS_URL
133
- }), (error, response) => {
127
+ request.get(`http://localhost:${this.httpPort}${ENGINE_STATUS_URL}`, (_error, response) => {
134
128
  if (response && response.statusCode) {
135
129
  this.lastStatusCode_ = response.statusCode;
136
130
  if (this.lastStatusCode_ === 500) {
@@ -250,7 +244,7 @@ class Engine {
250
244
  if (!httpUrl.startsWith('http://') && !httpUrl.startsWith('https://')) {
251
245
  httpUrl = 'http://' + httpUrl;
252
246
  }
253
- request.get(url.resolve(httpUrl, ENGINE_DOWNLOAD_URL))
247
+ request.get(new URL(ENGINE_DOWNLOAD_URL, httpUrl).toString())
254
248
  .pipe(fs.createWriteStream(this.enginePath))
255
249
  .on('close', () => {
256
250
  resolve();
@@ -506,7 +500,7 @@ class Engine {
506
500
  const hash = crypto.createHash('sha256');
507
501
  hash.update(os.hostname());
508
502
  hash.update(getWorkspacePath());
509
- return ('_' + hash.digest('hex').toUpperCase()).substr(0, INSTANCE_ID_LENGTH);
503
+ return ('_' + hash.digest('hex').toUpperCase()).substring(0, INSTANCE_ID_LENGTH);
510
504
  }
511
505
  }
512
506
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nginstack/engine-node",
3
- "version": "60.0.1",
3
+ "version": "60.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,5 +24,5 @@
24
24
  "thread-sleep": "^2.2.0",
25
25
  "tmp": "^0.2.1"
26
26
  },
27
- "gitHead": "0d6cc445ee3e472515a1d861dd515539102dea79"
27
+ "gitHead": "04220d66e188e03f53186458381d4303124a227a"
28
28
  }