@miso.ai/client-sdk-dev-tool 1.3.1 → 1.4.0

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 ADDED
@@ -0,0 +1,6 @@
1
+ # Miso SDK for JavaScript: Developer Tools Plugin
2
+ A collection of developer tools plugins.
3
+
4
+ Currently it's bundled in the standard build of SDK, but we may extract them to optional dependencies in the future.
5
+
6
+ Visit [Documentation](https://misoai.github.io/miso-client-js-sdk) for details.
package/dist/es/debug.js CHANGED
@@ -8,7 +8,17 @@ const _log = function (path, name) {
8
8
  }
9
9
 
10
10
  return console.log(TAG, STYLE, _path(path), _name(name), ...data);
11
- }; // format path
11
+ };
12
+
13
+ function _logw(path, name, data) {
14
+ if (data === undefined) {
15
+ _log(path, name);
16
+ } else if (Array.isArray(data)) {
17
+ _log(path, name, ...data.map(_wrapObj));
18
+ } else {
19
+ _log(path, name, _wrapObj(data));
20
+ }
21
+ } // format path
12
22
 
13
23
 
14
24
  function _path(path) {
@@ -20,6 +30,11 @@ function _name(name) {
20
30
  return "[".concat(name, "]");
21
31
  }
22
32
 
33
+ function _wrapObj(value) {
34
+ const type = typeof value;
35
+ return type === 'function' || type === 'object' && !Array.isArray(value) ? [value] : value;
36
+ }
37
+
23
38
  export default class DebugPlugin {
24
39
  constructor() {
25
40
  this._log = console.log.bind(console, TAG, STYLE);
@@ -85,11 +100,11 @@ export default class DebugPlugin {
85
100
  return;
86
101
  }
87
102
 
88
- _log(path.join('.'), name, [data]);
103
+ _logw(path.join('.'), name, data);
89
104
  }
90
105
 
91
106
  _handleCreateClient(eventName, data) {
92
- _log('client', eventName, [data]);
107
+ _logw('client', eventName, data);
93
108
  }
94
109
 
95
110
  _handleApiEvent(eventName, _ref2) {
@@ -125,7 +140,7 @@ export default class DebugPlugin {
125
140
  }
126
141
 
127
142
  _handlePluginSpecificEvent(pluginId, path, name, data) {
128
- _log([pluginId, path.join('.')], name, [data]);
143
+ _logw([pluginId, path.join('.')], name, data);
129
144
  }
130
145
 
131
146
  _getPath(component) {
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@miso.ai/commons": "1.3.1"
28
+ "@miso.ai/commons": "1.4.0"
29
29
  },
30
- "version": "1.3.1"
30
+ "version": "1.4.0"
31
31
  }