dcp-client 4.2.24 → 4.2.26

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.
@@ -11,30 +11,20 @@ const fs = require('fs');
11
11
 
12
12
  const dcpClient = require('..');
13
13
  const { Address } = require('dcp/wallet');
14
- const serializer = require('dcp/serialize');
15
-
16
- // To be able to serialize dcpConfig identities
17
- serializer.userCtors.dcpEth$$Address = Address;
18
- const { serializeAsync, deserialize } = serializer;
14
+ const kvin = require('kvin');
19
15
 
20
16
  let outputFd = +(process.env.BUILD_DCP_CONFIG_OUTPUT_FD || "3");
21
17
 
22
18
  async function main() {
23
- var input, initArgv, programName;
24
-
19
+ const custom = new kvin.KVIN();
20
+ custom.userCtors.dcpEth$$Address = Address;
21
+
25
22
  dcpClient._initHead();
26
23
 
27
- if (!process.stdin.isTTY)
28
- input = fs.readFileSync(process.stdin.fd, 'utf-8');
29
- if (input && input.length > 1) {
30
- ({ initArgv, programName } = deserialize(input));
31
- } else {
32
- initArgv = [];
33
- programName = false;
34
- }
35
-
36
- let outputObjects = await dcpClient.createAggregateConfig(initArgv, programName);
37
- const output = await serializeAsync(outputObjects);
24
+ const input = fs.readFileSync(process.stdin.fd, 'utf-8');
25
+ const { initConfig, options } = custom.deserialize(input);
26
+ const outputObjects = await dcpClient.createAggregateConfig(initConfig, options);
27
+ const output = await custom.serializeAsync(outputObjects);
38
28
 
39
29
  try {
40
30
  fs.writeSync(outputFd, output, 'utf-8');
package/bin/download CHANGED
@@ -7,7 +7,7 @@
7
7
  * @date May 2020
8
8
  */
9
9
 
10
- const dcpClient = require('..');
10
+ const dcpClient = require('..'); /* eslint-disable no-unused-vars */
11
11
  const fs = require('fs');
12
12
 
13
13
  function usage() {
@@ -16,6 +16,7 @@ function usage() {
16
16
  Where:
17
17
  --fd=N: send all output to file descriptor N
18
18
  --quiet: suppress progress messages
19
+ --silent: suppress progress and error messages
19
20
  `);
20
21
  }
21
22
 
@@ -29,6 +30,9 @@ async function main(argv) {
29
30
  let [,key,,value] = argv[i].match(/(^[^=]*)(=?)(.*)/); /* separate by first = */
30
31
 
31
32
  switch(key) {
33
+ case '--silent':
34
+ console.error = function(){};
35
+ /* fallthrough */
32
36
  case '--quiet':
33
37
  argv.splice(i--,1);
34
38
  console.log = console.debug = function(){};
package/dcp-client.js CHANGED
@@ -12,7 +12,21 @@
12
12
  * @author Wes Garland, wes@kingsds.network
13
13
  * @date Aug 2019
14
14
  */
15
- (function namespaceIIFE() {
15
+ const allScripts = document.getElementsByTagName('SCRIPT');
16
+ const thisScript = allScripts[allScripts.length - 1];
17
+
18
+ if (thisScript.getAttribute('data-autoinit') === 'false')
19
+ {
20
+ thisScript.removeAttribute('data-autoinit');
21
+ window.dcp = { init: namespace };
22
+ }
23
+ else
24
+ {
25
+ namespace();
26
+ }
27
+
28
+ function namespace()
29
+ {
16
30
 
17
31
  console.log(`%c
18
32
  _____ _____ ___________ _
@@ -31,8 +45,6 @@ https://distributed.computer/`, "font-weight: bold; font-size: 1.2em; color: #00
31
45
  var _dcpConfig = typeof dcpConfig === 'object' ? dcpConfig : undefined;
32
46
 
33
47
  {
34
- let allScripts = document.getElementsByTagName('SCRIPT');
35
- let thisScript = allScripts[allScripts.length - 1];
36
48
  let thisScriptURL = new URL(thisScript.src)
37
49
  let schedulerURL;
38
50
  let dcpConfigHref = thisScript.getAttribute('dcpConfig');
@@ -177,5 +189,5 @@ https://distributed.computer/`, "font-weight: bold; font-size: 1.2em; color: #00
177
189
  loadBundle(shimCallback);
178
190
  loadLinks();
179
191
  }
180
- })();
192
+ };
181
193