@miso.ai/client-sdk-dev-tool 1.4.5 → 1.4.7-beta.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.
Files changed (2) hide show
  1. package/dist/es/debug.js +17 -13
  2. package/package.json +3 -2
package/dist/es/debug.js CHANGED
@@ -1,3 +1,7 @@
1
+ const _excluded = ["groupName", "apiName", "url", "bulk"];
2
+
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+
1
5
  const TAG = '%cMiso';
2
6
  const STYLE = 'color: #fff; background-color: #334cbb; padding: 2px 2px 1px 4px;';
3
7
  const ID = 'std:debug';
@@ -22,12 +26,12 @@ function _logw(path, name, data) {
22
26
 
23
27
 
24
28
  function _path(path) {
25
- return "<".concat(typeof path === 'string' ? path : path.filter(v => v).join('/'), ">");
29
+ return `<${typeof path === 'string' ? path : path.filter(v => v).join('/')}>`;
26
30
  } // format event name
27
31
 
28
32
 
29
33
  function _name(name) {
30
- return "[".concat(name, "]");
34
+ return `[${name}]`;
31
35
  }
32
36
 
33
37
  function _wrapObj(value) {
@@ -81,9 +85,9 @@ export default class DebugPlugin {
81
85
  case 'client':
82
86
  switch (path[1]) {
83
87
  case 'api':
84
- this._handleApiEvent(name, { ...data,
88
+ this._handleApiEvent(name, Object.assign({}, data, {
85
89
  groupName: path[2]
86
- });
90
+ }));
87
91
 
88
92
  return;
89
93
  }
@@ -110,15 +114,15 @@ export default class DebugPlugin {
110
114
  _handleApiEvent(eventName, _ref2) {
111
115
  let {
112
116
  groupName,
113
- apiName,
114
117
  url,
115
- bulk,
116
- ...data
117
- } = _ref2;
118
+ bulk
119
+ } = _ref2,
120
+ data = _objectWithoutPropertiesLoose(_ref2, _excluded);
121
+
118
122
  const pathname = new URL(url).pathname;
119
123
  const args = ['api', eventName];
120
- bulk && args.push("(bulk ".concat(bulk.bulkId, ")"));
121
- args.push("POST ".concat(pathname));
124
+ bulk && args.push(`(bulk ${bulk.bulkId})`);
125
+ args.push(`POST ${pathname}`);
122
126
 
123
127
  if (groupName === 'interactions') {
124
128
  // TODO: handle multiple interactions
@@ -128,15 +132,15 @@ export default class DebugPlugin {
128
132
  args.push(type);
129
133
  }
130
134
 
131
- args.push([{ ...data,
135
+ args.push([Object.assign({}, data, {
132
136
  url
133
- }]);
137
+ })]);
134
138
 
135
139
  _log.apply(undefined, args);
136
140
  }
137
141
 
138
142
  _handlePluginsEvent(eventName, plugin) {
139
- _log('plugins', eventName, "".concat(plugin.id || '(anonymous)'), [plugin]);
143
+ _log('plugins', eventName, `${plugin.id || '(anonymous)'}`, [plugin]);
140
144
  }
141
145
 
142
146
  _handlePluginSpecificEvent(pluginId, path, name, data) {
package/package.json CHANGED
@@ -13,6 +13,7 @@
13
13
  "start": "npx babel src --root-mode upward --out-dir dist/es --watch",
14
14
  "build:clean": "npx rimraf dist",
15
15
  "build:esm": "npx babel src --root-mode upward --out-dir dist/es",
16
+ "build:cjs": "BABEL_ENV=cjs npx babel src --root-mode upward --out-dir dist/cjs",
16
17
  "build": "npm run build:clean && npm run build:esm"
17
18
  },
18
19
  "repository": "MisoAI/miso-client-js-sdk",
@@ -25,7 +26,7 @@
25
26
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
26
27
  },
27
28
  "dependencies": {
28
- "@miso.ai/commons": "1.4.5"
29
+ "@miso.ai/commons": "1.4.7-beta.0"
29
30
  },
30
- "version": "1.4.5"
31
+ "version": "1.4.7-beta.0"
31
32
  }