varsnap 1.6.6 → 1.6.10
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 +28 -0
- package/dist/built/varsnap/core.d.ts +2 -1
- package/dist/built/varsnap/core.js +14 -5
- package/dist/varsnap.js +511 -353
- package/dist/varsnap.min.js +2 -2
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
CHANGELOG
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
1.6.10 (2022-01-01)
|
|
5
|
+
-------------------
|
|
6
|
+
|
|
7
|
+
- Update dependencies
|
|
8
|
+
- Simplify testing
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
1.6.9 (2021-09-11)
|
|
12
|
+
------------------
|
|
13
|
+
|
|
14
|
+
- Update dependencies
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
1.6.8 (2021-07-25)
|
|
18
|
+
------------------
|
|
19
|
+
|
|
20
|
+
- Remove "v" prefix from versions
|
|
21
|
+
- Optimize dependency installation during CI
|
|
22
|
+
- Update dependencies
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
1.6.7 (2021-05-22)
|
|
26
|
+
------------------
|
|
27
|
+
|
|
28
|
+
- Update dependencies
|
|
29
|
+
- Send client name when generating trial group
|
|
30
|
+
|
|
31
|
+
|
|
4
32
|
1.6.6 (2021-04-10)
|
|
5
33
|
------------------
|
|
6
34
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import querystring = require('querystring');
|
|
3
|
-
export declare const version = "
|
|
3
|
+
export declare const version = "1.6.10";
|
|
4
|
+
export declare const clientName: string;
|
|
4
5
|
export interface Config {
|
|
5
6
|
varsnap: boolean;
|
|
6
7
|
env: string;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runTests = exports.varsnap = exports.Consumer = exports.Producer = exports.Util = exports.version = void 0;
|
|
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
5
|
const querystring = require("querystring");
|
|
6
6
|
const produceURL = 'https://www.varsnap.com/api/snap/produce/';
|
|
7
7
|
const consumeURL = 'https://www.varsnap.com/api/snap/consume/';
|
|
8
8
|
const produceTrialURL = 'https://www.varsnap.com/api/trial/produce/';
|
|
9
9
|
const trialGroupURL = 'https://www.varsnap.com/api/trial_group/';
|
|
10
|
-
exports.version = '
|
|
10
|
+
exports.version = '1.6.10';
|
|
11
|
+
exports.clientName = 'javascript.' + exports.version;
|
|
11
12
|
const defaultConfig = {
|
|
12
13
|
varsnap: true,
|
|
13
14
|
env: 'development',
|
|
@@ -69,10 +70,10 @@ class Util {
|
|
|
69
70
|
data: querystring.stringify(requestData),
|
|
70
71
|
responseType: 'json',
|
|
71
72
|
};
|
|
72
|
-
if (typeof process === 'object' && typeof window === 'undefined') {
|
|
73
|
+
if (typeof process === 'object' && typeof window === 'undefined' && options.headers) {
|
|
73
74
|
options.headers['User-Agent'] = 'varsnap.js';
|
|
74
75
|
}
|
|
75
|
-
const ajaxPromise = axios_1.default(options).then((response) => {
|
|
76
|
+
const ajaxPromise = (0, axios_1.default)(options).then((response) => {
|
|
76
77
|
return response.data;
|
|
77
78
|
});
|
|
78
79
|
return ajaxPromise;
|
|
@@ -347,13 +348,21 @@ varsnap.version = exports.version;
|
|
|
347
348
|
function getTrialGroup(consumerConfig) {
|
|
348
349
|
const data = {
|
|
349
350
|
'consumer_token': Util.getConfig(consumerConfig, 'consumerToken'),
|
|
351
|
+
'client': exports.clientName,
|
|
350
352
|
};
|
|
351
353
|
const ajax = Util.ajax(trialGroupURL, data);
|
|
352
354
|
const trialGroup = ajax.then((rawResponse) => {
|
|
353
355
|
const response = rawResponse;
|
|
354
356
|
return response;
|
|
355
357
|
}).catch((error) => {
|
|
356
|
-
|
|
358
|
+
let errorMessage = '';
|
|
359
|
+
if (error && error.response && error.response.data && error.response.data.error) {
|
|
360
|
+
errorMessage = error.response.data.error;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
errorMessage = error.toString();
|
|
364
|
+
}
|
|
365
|
+
Util.error(consumerConfig, 'Cannot generate a new Trial Group: ' + errorMessage);
|
|
357
366
|
return {
|
|
358
367
|
status: 'not ok',
|
|
359
368
|
project_id: '',
|