dcp-worker 3.2.35 → 3.2.37

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/.eslintrc.js CHANGED
@@ -15,7 +15,7 @@
15
15
  module.exports = {
16
16
  root: true,
17
17
  reportUnusedDisableDirectives: true,
18
- extends: ['eslint:recommended', '@distributive'],
18
+ extends: ['eslint:recommended', '@distributive/eslint-config'],
19
19
  env: {
20
20
  node: true,
21
21
  es2022: true,
package/bin/dcp-worker CHANGED
@@ -50,9 +50,9 @@ require('dcp-client').init({ configName }).then(main).catch(handleUnhandled);
50
50
  function parseCliArgs()
51
51
  {
52
52
  var defaultPidFileName;
53
-
53
+
54
54
  defaultPidFileName = require('../lib/pidfile').getDefaultPidFileName(dcpConfig.worker.pidfile);
55
-
55
+
56
56
  const cliArgs = require('dcp/cli')
57
57
  .base('Standalone NodeJS DCP Worker')
58
58
  .options({
@@ -60,6 +60,10 @@ function parseCliArgs()
60
60
  describe: 'The address to deposit funds into, will use the default bank keystore if not provided.',
61
61
  type: 'string',
62
62
  },
63
+ defaultPaymentAddressToDCP: {
64
+ describe: 'If this option is set and no other payment address is provided, send payment for work completed to the DCP Community account',
65
+ type: 'boolean',
66
+ },
63
67
  cores: {
64
68
  alias: 'c',
65
69
  describe: 'Number of CPU and GPU cores to work with: the format is 7,1 (or just 7) for 7 CPU cores and 1 GPU',
@@ -171,7 +175,7 @@ function parseCliArgs()
171
175
  describe: 'Address of syslog server',
172
176
  type: 'string',
173
177
  group: 'Syslog output options',
174
- default: 'loghost',
178
+ default: 'loghost', // Unix standard for syslog
175
179
  },
176
180
  syslogFacility: {
177
181
  describe: 'Name of syslog facility',
@@ -254,7 +258,7 @@ function addConfig(target, ...objs)
254
258
  Object.assign(target, tmp);
255
259
  }
256
260
 
257
- /**
261
+ /**
258
262
  * Replacement for process.exit() that tries to increase the probability
259
263
  * that remote log messages will make it out over the network.
260
264
  */
@@ -291,13 +295,26 @@ async function main()
291
295
  process.on('unhandledRejection', handleUnhandled);
292
296
  process.on('uncaughtException', handleUnhandled);
293
297
 
298
+ const getOpts = {};
299
+ if (cliArgs.defaultPaymentAddressToDCP)
300
+ getOpts.oAuth = false;
301
+
294
302
  let paymentAddress = false
295
303
  || cliArgs.paymentAddress
296
304
  || dcpConfig.worker.paymentAddress
297
- || (await wallet.get()).address;
305
+ || (await wallet.get(getOpts).catch(error => {
306
+ // if flag is set and no other address is provided, use the DCP Community Account,
307
+ // which is 0x079DAC0612C710ab4e975dAb7171C7e4beF78c5a at time of writing
308
+ if ((error.code === 'ENOENT') && cliArgs.defaultPaymentAddressToDCP)
309
+ {
310
+ console.warn('Warning: Defaulting payment to DCP Community Account');
311
+ return {address:'0x079DAC0612C710ab4e975dAb7171C7e4beF78c5a'};
312
+ }
313
+ throw error;
314
+ })).address;
298
315
  if (typeof paymentAddress === 'string')
299
316
  paymentAddress = new wallet.Address(paymentAddress);
300
-
317
+
301
318
  if (cliArgs.pidFile)
302
319
  require('../lib/pidfile').write(cliArgs.pidFile);
303
320
 
@@ -311,7 +328,7 @@ async function main()
311
328
  identityKeystore = await wallet.getId();
312
329
  await wallet.addId(identityKeystore);
313
330
 
314
- /* Build the worker options, which are largely given by dcpConfig.worker. We use a reference for
331
+ /* Build the worker options, which are largely given by dcpConfig.worker. We use a reference for
315
332
  * dcpConfig.worker rather than copying it, so that runtime modifications to the worker configuration
316
333
  * in memory take effect immediately.
317
334
  *
@@ -389,7 +406,7 @@ async function main()
389
406
 
390
407
  if (cliArgs.outputMode === 'dashboard')
391
408
  require('../lib/dashboard-tui').init(worker, cliArgs);
392
-
409
+
393
410
  /* Let incorrect event-loop references keep us alive when linked with a debug library, but
394
411
  * exit quickly/accurately for production code even when the library isn't perfect.
395
412
  */
@@ -455,6 +472,14 @@ async function main()
455
472
  introBanner += ` + Verbosity level: ${cliArgs.verbose}` + '\n';
456
473
  if (telnetd.hasOwnProperty('port'))
457
474
  introBanner += ` ! telnetd listening on port ${telnetd.port}\n`;
475
+
476
+ const { worktimes } = require('dcp-client/libexec/sandbox/worktimes');
477
+ if (Object.keys(worktimes).length > 0)
478
+ {
479
+ introBanner += ' . Worktimes Available:\n';
480
+ for (const wt of worktimes)
481
+ introBanner += ` -\t${wt.name}@${wt.versions.join(';')}\n`;
482
+ }
458
483
 
459
484
  introBanner += ' . Supervisor version: ' + worker.supervisorVersion;
460
485
  introBanner += ' . Output mode: ' + cliArgs.outputMode + '\n';
@@ -475,7 +500,7 @@ async function main()
475
500
  await worker.start();
476
501
  }
477
502
 
478
- /**
503
+ /**
479
504
  * Process the cores and density cli arguments.
480
505
  *
481
506
  * cliArgs.cores is the core count of the hardware to use.
@@ -517,7 +542,7 @@ function processCoresAndDensity (dcpWorkerOptions, cliArgs)
517
542
  * Log a closing message (or messages). Since the dashboard clears the screen on exit, we use the
518
543
  * memoized console property to log the message after we destroy the instance of screen.
519
544
  */
520
- function logClosing(facility, ...message)
545
+ function logClosing(facility, ...message)
521
546
  {
522
547
  var screen = require('../lib/worker-loggers/dashboard').screen;
523
548
 
@@ -537,7 +562,7 @@ function logClosing(facility, ...message)
537
562
  console[facility](...message);
538
563
  }
539
564
 
540
- /**
565
+ /**
541
566
  * Fatal error handler: __must not ever throw no matter what__.
542
567
  * If we hit a fatal error, we are by definition no longer confident of our program state, meaning that
543
568
  * the worker must be restarted. This handler does its best to report the rejection and give the worker a few
@@ -549,7 +574,7 @@ function handleUnhandled(error)
549
574
  worker = false;
550
575
 
551
576
  process.exitCode = process.exitCode || EXIT_UNHANDLED;
552
-
577
+
553
578
  try
554
579
  {
555
580
  logClosing('error', error);
@@ -661,7 +686,7 @@ function sliceReport()
661
686
  }
662
687
 
663
688
  /**
664
- * Handle a signal which requests our the death of the Worker by
689
+ * Handle a signal which requests our the death of the Worker by
665
690
  * - stopping the worker
666
691
  * - unregistering the handler (this allows a second signal to forcibly terminate the process
667
692
  * if that is the default behaviour)
@@ -708,7 +733,7 @@ function getCleanupTimeoutMs()
708
733
  }
709
734
 
710
735
  /**
711
- * Ensure the default configuration hasn't been modified by the end-user-sysadmin. It is an
736
+ * Ensure the default configuration hasn't been modified by the end-user-sysadmin. It is an
712
737
  * attractive nuisance, as it looks just like the file they should modify, but if they make
713
738
  * security changes there that are overwritten in an subsequent update, it will be a problem.
714
739
  *
package/docs/CODEOWNERS CHANGED
@@ -12,8 +12,6 @@
12
12
 
13
13
  []
14
14
 
15
- [Brandon]
16
-
17
15
  [Eddie]
18
16
  /package-lock.json @eroosenmaallen
19
17
 
@@ -21,15 +19,17 @@
21
19
  /npm-hooks/ @wesgarland
22
20
  /README.md @wesgarland
23
21
  /docs/ @wesgarland
24
- /.eslintrc.json @wesgarland
22
+ /.eslintrc.js @wesgarland
25
23
  /.npmrc @wesgarland
26
24
  /.tidelift @wesgarland
27
25
  /lib/ @wesgarland
28
26
  /LICENSE.md @wesgarland
27
+ /.trunk/ @wesgarland
29
28
  /.gitignore @wesgarland
30
29
  /etc/ @wesgarland
31
30
  /.gitlab-ci.yml @wesgarland
32
31
  /bin/ @wesgarland
32
+ /catalog-info.yaml @wesgarland
33
33
  /etc/ @wesgarland
34
34
  /lib/ @wesgarland
35
35
  /bin/ @wesgarland
@@ -28,12 +28,12 @@ exports.init = function syslog$$init(cliArgs)
28
28
  {
29
29
  const syslogOptions = {
30
30
  syslogHostname: os.hostname(),
31
- transport: cliArgs.syslogTransport || 'udp', // tcp, udp, unix, tls
31
+ transport: cliArgs.syslogTransport, // tcp, udp, unix, tls
32
32
  port: cliArgs.syslogPort,
33
33
  facility: syslog.Facility[cliArgs.syslogFacility[0].toUpperCase() + cliArgs.syslogFacility.slice(1)],
34
34
  }
35
35
 
36
- syslogClient = syslog.createClient(cliArgs.syslogAddress || '127.0.0.1', syslogOptions);
36
+ syslogClient = syslog.createClient(cliArgs.syslogAddress, syslogOptions);
37
37
  processName = require('path').basename(process.mainModule.filename || process.argv0);
38
38
  exports.close = () => syslogClient.close();
39
39
  }
@@ -60,7 +60,7 @@ function log(level, ...argv)
60
60
  logMessage = logPrefix + logMessage;
61
61
  syslogClient.log(logMessage, { severity }, error => {
62
62
  if (error)
63
- _console.error('168: Unexpected error writing to syslog:');
63
+ _console.error('168: Unexpected error writing to syslog:', error);
64
64
  });
65
65
  }
66
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-worker",
3
- "version": "3.2.35",
3
+ "version": "3.2.37",
4
4
  "description": "JavaScript portion of DCP Workers for Node.js",
5
5
  "main": "bin/dcp-worker",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  "blessed": "^0.1.81",
41
41
  "blessed-contrib": "^4.11.0",
42
42
  "chalk": "^4.1.0",
43
- "dcp-client": "4.3.5",
43
+ "dcp-client": "4.3.6",
44
44
  "kvin": "^1.2.7",
45
45
  "posix-getopt": "^1.2.1",
46
46
  "semver": "^7.3.8",
@@ -51,11 +51,11 @@
51
51
  "telnet-console": "^1.0.4"
52
52
  },
53
53
  "devDependencies": {
54
+ "@distributive/eslint-config": "2.1.1",
54
55
  "@distributive/eslint-plugin": "1.0.2",
55
56
  "@kingsds/eslint-config": "^1.0.1",
56
57
  "@trunkio/launcher": "1.2.7",
57
- "eslint": ">=8",
58
- "eslint-plugin-jsdoc": "46.8.2"
58
+ "eslint": "8.56.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "node-eventlog": "https://gitpkg.now.sh/Distributive-Network/node-eventlog/package?dcp/0.0.1"
@@ -70,6 +70,10 @@
70
70
  "npm": ">=7"
71
71
  },
72
72
  "overrides": {
73
- "@azure/msal-node": "2.2.0"
73
+ "dbus-next": {
74
+ "usocket": {
75
+ "node-gyp": "10.0.1"
76
+ }
77
+ }
74
78
  }
75
79
  }