@miso.ai/client-sdk-dev-tool 1.4.2 → 1.4.4-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/dry-run.js +13 -23
  2. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { addUrlParameter } from '@miso.ai/commons';
1
2
  const ID = 'std:dry-run';
2
3
  export default class DryRunPlugin {
3
4
  constructor() {
@@ -12,31 +13,20 @@ export default class DryRunPlugin {
12
13
  } // TODO: config({ active })
13
14
 
14
15
 
15
- install(_, context) {
16
- const self = this;
17
-
18
- context.classes.api.ApiBase.prototype._send = async function (_ref) {
19
- let {
20
- url
21
- } = _ref;
22
-
23
- this._events.emit('dry-run-send', {
24
- url
25
- });
26
-
27
- return self._mockResponse();
28
- };
16
+ install(_, _ref) {
17
+ let {
18
+ addUrlPass
19
+ } = _ref;
20
+ addUrlPass(this._modifyUrl.bind(this));
29
21
  }
30
22
 
31
- _mockResponse() {
32
- // TODO: take api type
33
- return {
34
- data: {
35
- products: [],
36
- attributes: [],
37
- completions: {}
38
- }
39
- };
23
+ _modifyUrl(_ref2) {
24
+ let {
25
+ apiGroup,
26
+ apiName,
27
+ url
28
+ } = _ref2;
29
+ return apiGroup === 'interactions' && apiName === 'upload' ? addUrlParameter(url, 'dry_run', '1') : url;
40
30
  }
41
31
 
42
32
  }
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.4.2"
28
+ "@miso.ai/commons": "1.4.4-beta.0"
29
29
  },
30
- "version": "1.4.2"
30
+ "version": "1.4.4-beta.0"
31
31
  }