@coderich/sandman 0.0.6 → 0.0.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderich/sandman",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "main": "index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,9 @@ module.exports = class ConfigClient extends Config {
29
29
  const unflatData = Util.unflatten(flatData);
30
30
  const rawData = key === undefined ? unflatData : Util.get(unflatData, key);
31
31
  super.set(dataSymbol, rawData);
32
- return super.get(dataSymbol);
32
+ const resolvedData = super.get(dataSymbol);
33
+ super.del(dataSymbol);
34
+ return resolvedData;
33
35
  }
34
36
 
35
37
  mergeDir(dir = this.#configDir) {
@@ -55,6 +57,8 @@ module.exports = class ConfigClient extends Config {
55
57
  this.del(key);
56
58
  }
57
59
  });
60
+
61
+ return watcher;
58
62
  }
59
63
 
60
64
  #ignore({ name, filepath, paths }) {
@@ -65,7 +65,7 @@ exports.toCURL = (request, { pretty = true, redactAuth = false } = {}) => {
65
65
  if (redactAuth && /^authorization$/i.test(k)) {
66
66
  hdrs[k] = hdrs[k].replace(/(?<=^.{6}).+/, '***REDACTED***');
67
67
  }
68
- parts.push('-H', shq(`${k}: ${hdrs[k]}`));
68
+ parts.push('-H', exports.shq(`${k}: ${hdrs[k]}`));
69
69
  }
70
70
 
71
71
  // body (skip for GET)
package/src/Sandman.js CHANGED
@@ -14,13 +14,14 @@ module.exports = class Sandman extends EventEmitter {
14
14
  this.#readline = ReadlineService.createInterface(this.#cli, this.#configClient);
15
15
 
16
16
  this.#readline.on('line', async (line) => {
17
- if (!line) return this.#readline.prompt();
17
+ if (!line) return this.#prompt();
18
18
  const [cmd, ...args] = line.trim().split(' ');
19
19
  const info = this.#cli[cmd] ? { cmd, args } : { cmd: 'run', args: [cmd, ...args] };
20
20
  const value = await Promise.resolve(this.#cli[info.cmd](...info.args)).catch(e => e);
21
21
  return this.emit(cmd, value);
22
22
  });
23
23
 
24
+ this.#configClient.watch();
24
25
  this.#prompt();
25
26
  }
26
27