dcp-client 4.2.26 → 4.2.28

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.
@@ -7,16 +7,23 @@
7
7
  * @date March 2018
8
8
  */
9
9
  "use strict";
10
- let dcpTimers;
11
- try{
12
- dcpTimers = require('dcp/dcp-timers');
13
- } catch(e) {
14
- dcpTimers = require('dcp/common/dcp-timers');
15
- }
16
- const KVIN = require("kvin");
17
- const { setBackoffInterval, clearBackoffInterval } = dcpTimers;
18
- const dcpConfig = global.dcpConfig || require('dcp/dcp-config');
19
- var debugging = () => dcpConfig.standaloneWorker.debug;
10
+ const KVIN = require("kvin"); /* Cannot use internal KVIN to talk to evaluators because we need to send them the source code */
11
+ const { setBackoffInterval, clearBackoffInterval } = require('dcp/dcp-timers');
12
+ const { leafMerge } = require('dcp/utils');
13
+ const dcpConfig = require('dcp/dcp-config');
14
+ const defaultConfig = {
15
+ debug: process.env.DCP_SAW_DEBUG,
16
+ quiet: false,
17
+ evaluatorConnectBackoff:
18
+ {
19
+ maxInterval: 5 * 60 * 1000, // max: 5 minutes
20
+ baseInterval: 10 * 1000, // start: 10s
21
+ backoffFactor: 1.1 // each fail, back off by 10%
22
+ },
23
+ };
24
+ dcpConfig.standaloneWorker = Object.assign(dcpConfig.standaloneWorker || {},
25
+ leafMerge(defaultConfig, dcpConfig.standaloneWorker));
26
+ var debugging = dcpConfig.standaloneWorker.debug ? () => true : require('dcp/internal/debugging').scope('saw');
20
27
 
21
28
  function timestamp() {
22
29
  var now = new Date();
package/ns-map.js CHANGED
@@ -60,27 +60,8 @@ module.declare([], function $$nsMap(require, exports, module) {
60
60
 
61
61
  /**
62
62
  * LONG TERM PLAN
63
- * - put external modules in their own namepsace in webpack bundle - /dcp/internal/ ?
64
63
  * - ensure names in webpack need no translation except adding /dcp (looks good now)
65
64
  * - remove this module
66
65
  * - test all three load modes
67
66
  */
68
-
69
- /* Provide internal copies of third-party npm libraries when external (native?) copies not available */
70
- for (moduleIdentifier of [
71
- 'ethereumjs-util',
72
- 'ethereumjs-wallet',
73
- 'bignumber.js',
74
- 'socket.io-client',
75
- ]) {
76
- try {
77
- require.resolve(moduleIdentifier);
78
- } catch(e) {
79
- if (e.code === 'MODULE_NOT_FOUND')
80
- exports[moduleIdentifier] = moduleIdentifier;
81
- else
82
- throw e;
83
- }
84
- }
85
-
86
67
  }); /* end of module */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-client",
3
- "version": "4.2.26",
3
+ "version": "4.2.28",
4
4
  "description": "Core libraries for accessing DCP network",
5
5
  "keywords": [
6
6
  "dcp"
@@ -28,11 +28,14 @@
28
28
  "vtest": "npx peter -v tests"
29
29
  },
30
30
  "dependencies": {
31
+ "@kingsds/socket.io-client": "^4.5.4",
31
32
  "@kingsds/xmlhttprequest-ssl": "^2.1.0",
32
33
  "atob": "2.1.2",
33
34
  "bravojs": "^1.0.16",
34
35
  "btoa": "^1.2.1",
35
36
  "chalk": "^4.1.2",
37
+ "ethereumjs-util": "^7.1.5",
38
+ "ethereumjs-wallet": "^1.0.2",
36
39
  "html-to-text": "^5.1.1",
37
40
  "http-proxy-agent": "^4.0.1",
38
41
  "https-agent": "^1.0.0",
@@ -44,7 +47,7 @@
44
47
  "polyfill-crypto.getrandomvalues": "^1.0.0",
45
48
  "regedit": "^3.0.3",
46
49
  "semver": "^7.3.5",
47
- "webpack": "^5.75.0",
50
+ "webpack": "^5.79.0",
48
51
  "webpack-cli": "^4.7.2",
49
52
  "yargs": "16.2.0"
50
53
  },
@@ -52,7 +55,7 @@
52
55
  "@kingsds/eslint-config": "1.0.1",
53
56
  "eslint": "7.30.0",
54
57
  "express": "^4.18.2",
55
- "peter": "^2.3.5"
58
+ "peter": "^2.3.10"
56
59
  },
57
60
  "peerDependencies": {
58
61
  "dcp-worker": "^3.0.0"
@@ -7,6 +7,8 @@
7
7
  // Note: we are also using these test configs to test accepted forms
8
8
  // this file tests that we can use global keys like 'scheduler' and that
9
9
  // we can return an object
10
+ const bootstrapConfig = require('dcp/dcp-config');
11
+ dcpConfig.bank.location = bootstrapConfig.bank.location;
10
12
  dcpConfig.bank.location.pathname = '/from/tests-homedir/dcp-client/dcp-config';
11
13
 
12
14
  return {
@@ -11,10 +11,23 @@
11
11
  * Note: In registry-speak, keys are like directories and values are like files -- i.e. a key can
12
12
  * contain keys and/or values, but values cannot contain keys; only strings and numbers and stuff.
13
13
  *
14
+ *
15
+ * future - we will need a better way to return registry values, current proposal is to use
16
+ * REG_BINARY to encode richer types thus:
17
+ * 0x00 - null
18
+ * 0x20 - next 8 bytes are a little-endian float64
19
+ * 0x40 - next byte is start of Uint8Array
20
+ * 0x80 - false
21
+ * 0x81 - true
22
+ * 0x82 - undefined
23
+ * future - we should probably expand our understanding of types as follows
24
+ * REG_DWORD - integer
25
+ * REG_QWORD - bigint
26
+ * REG_NONE - treat as missing
27
+ *
14
28
  * @author Wes Garland, wes@kingsds.network
15
29
  * @date Jul 2020
16
30
  */
17
-
18
31
  const machHive = 'HKLM';
19
32
  const userHive = 'HKCU';
20
33
  const regedit = require('regedit');
@@ -133,63 +146,6 @@ exports.getObject = async function dcpClient$$windowsRegistry$getObject(hive, ke
133
146
  return tree;
134
147
  }
135
148
 
136
- /**
137
- * @deprecated
138
- * Get a DCP Config object for a certain configuration "level". Levels always exist in a
139
- * 'this program' and 'any program' sandwhich, provided programName is not falsey.
140
- *
141
- * @param {string} hive the hive to check: used to allow us to
142
- * differentiate between user-specific and
143
- * machine-wide configuration entries.
144
- * @param {string} programName the name of the program doing the configuration
145
- * lookup (ignored if falsey).
146
- * @param {boolean} override true if we are looking at the top-most level
147
- * of configury; used, for example, by registry
148
- * entries written by an adminsitrator as some
149
- * kind of group policy.
150
- *
151
- * @returns {object} a DCP config object describing the overrides at this specific configuration
152
- * "level", with no inheritance from levels either below or above this one.
153
- */
154
- async function getDcpConfig(hive, programName, override) {
155
- var tree = {};
156
- var baseKey = keyJoin(hive, exports.baseKey, override ? 'override' : 'dcp-client');
157
-
158
- if (await keyExists(keyJoin(baseKey, programName, 'dcp-config')))
159
- await regTree(keyJoin(baseKey, programName, 'dcp-config'), tree);
160
- if (await keyExists(keyJoin(baseKey, 'dcp-config')))
161
- await regTree(keyJoin(baseKey, 'dcp-config'), tree);
162
-
163
- return tree;
164
- }
165
-
166
- /** Return any DCP Config values defined in the registry for the user
167
- * @deprecated
168
- */
169
- exports.getUserDcpConfig = async function dcpClient$$windowsRegistry$getUserDcpConfig(programName) {
170
- if (!programName && programName !== false)
171
- programName = path.basename(process.argv[1], '.js');
172
- return getDcpConfig(userHive, programName, false);
173
- }
174
-
175
- /** Return any DCP Config values defined in the registry for the machine
176
- * @deprecated
177
- */
178
- exports.getMachDcpConfig = async function dcpClient$$windowsRegistry$getMachDcpConfig(programName) {
179
- if (!programName && programName !== false)
180
- programName = path.basename(process.argv[1], '.js');
181
- return getDcpConfig(machHive, programName, false);
182
- }
183
-
184
- /** Return any DCP Config values defined in the registry as administrative overrides
185
- * @deprecated
186
- */
187
- exports.getOverrideDcpConfig = async function dcpClient$$windowsRegistry$getOverrideDcpConfig() {
188
- if (!programName && programName !== false)
189
- programName = path.basename(process.argv[1], '.js');
190
- return getDcpConfig(machHive, programName, true)
191
- }
192
-
193
149
  /** Make all exported functions fast-path false return on non-windows */
194
150
  if (require('os').platform() !== 'win32') {
195
151
  for (let exp in exports) {