varsnap 1.8.0 → 1.8.3

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/CHANGELOG.md CHANGED
@@ -1,6 +1,28 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 1.8.3 (2022-03-27)
5
+ ------------------
6
+
7
+ - Resolve issue with importing by webpack/enhanced-resolve
8
+ - Update dependencies
9
+
10
+
11
+ 1.8.2 (2022-01-29)
12
+ ------------------
13
+
14
+ - Remove dependency on `remove-query-string`
15
+ - Return branch from `setGitBranchEnv`
16
+ - Update dependencies
17
+
18
+
19
+ 1.8.1 (2022-01-15)
20
+ ------------------
21
+
22
+ - Fix varsnap import config
23
+ - Update dependencies
24
+
25
+
4
26
  1.8.0 (2022-01-14)
5
27
  ------------------
6
28
 
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- import querystring = require('querystring');
3
- export declare const version = "1.8.0";
1
+ export declare const version = "1.8.3";
4
2
  export declare const clientName: string;
5
3
  export interface Config {
6
4
  varsnap: boolean;
@@ -11,7 +9,7 @@ export interface Config {
11
9
  logger?: Logger;
12
10
  }
13
11
  declare type ConfigKeys = keyof Config;
14
- declare type rawJSONObject = ConsumeSnapResponse | ProduceTrialResponse | TrialGroupRequest | TrialGroupResponse | querystring.ParsedUrlQueryInput;
12
+ declare type rawJSONObject = ConsumeSnapResponse | ProduceTrialResponse | TrialGroupRequest | TrialGroupResponse | Record<string, string>;
15
13
  export interface Logger {
16
14
  debug(s: string): void;
17
15
  log(s: string): void;
@@ -2,13 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runTests = exports.varsnap = exports.Consumer = exports.Producer = exports.Util = exports.clientName = exports.version = void 0;
4
4
  const axios_1 = require("axios");
5
- const querystring = require("querystring");
6
5
  const child_process_1 = require("child_process");
7
6
  const produceURL = 'https://www.varsnap.com/api/snap/produce/';
8
7
  const consumeURL = 'https://www.varsnap.com/api/snap/consume/';
9
8
  const produceTrialURL = 'https://www.varsnap.com/api/trial/produce/';
10
9
  const trialGroupURL = 'https://www.varsnap.com/api/trial_group/';
11
- exports.version = '1.8.0';
10
+ exports.version = '1.8.3';
12
11
  exports.clientName = 'javascript.' + exports.version;
13
12
  const defaultConfig = {
14
13
  varsnap: true,
@@ -63,13 +62,15 @@ class Util {
63
62
  return 'javascript.' + exports.version + '.' + signature;
64
63
  }
65
64
  static ajax(url, requestData) {
65
+ const requestParams = new URLSearchParams(requestData);
66
+ const data = requestParams.toString();
66
67
  const options = {
67
68
  method: 'POST',
68
69
  url: url,
69
70
  headers: {
70
71
  'Content-Type': 'application/x-www-form-urlencoded',
71
72
  },
72
- data: querystring.stringify(requestData),
73
+ data: data,
73
74
  responseType: 'json',
74
75
  };
75
76
  if (Util.isNode() && options.headers) {
@@ -77,6 +78,8 @@ class Util {
77
78
  }
78
79
  const ajaxPromise = (0, axios_1.default)(options).then((response) => {
79
80
  return response.data;
81
+ }).catch((error) => {
82
+ return error;
80
83
  });
81
84
  return ajaxPromise;
82
85
  }
@@ -298,7 +301,7 @@ class Consumer {
298
301
  'consumer_token': Util.getConfig(this.config, 'consumerToken'),
299
302
  'snap_id': snap.id,
300
303
  'test_outputs': Producer.serialize(localOutputs),
301
- 'matches': matches,
304
+ 'matches': matches.toString(),
302
305
  'snap_outputs_formatted': Producer.serialize_formatted(prodOutputs),
303
306
  'test_outputs_formatted': Producer.serialize_formatted(localOutputs),
304
307
  };
@@ -1 +1 @@
1
- export declare function setGitBranchEnv(): void;
1
+ export declare function setGitBranchEnv(): Promise<string>;
@@ -11,9 +11,10 @@ function setGitBranchEnv() {
11
11
  env: 'none',
12
12
  branch: '',
13
13
  };
14
- core_1.Util.getBranch(config)
14
+ return core_1.Util.getBranch(config)
15
15
  .then((branch) => {
16
16
  process.env.GIT_BRANCH = branch;
17
+ return branch;
17
18
  });
18
19
  }
19
20
  exports.setGitBranchEnv = setGitBranchEnv;