varsnap 1.10.1 → 1.11.1
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 +6 -5
- package/built/index.d.ts +2 -0
- package/built/index.js +3 -0
- package/built/index.js.map +1 -0
- package/built/test/config_tools.d.ts +10 -0
- package/built/test/config_tools.js +34 -0
- package/built/test/config_tools.js.map +1 -0
- package/built/test/core.d.ts +1 -0
- package/built/test/core.js +302 -0
- package/built/test/core.js.map +1 -0
- package/built/test/integration.d.ts +1 -0
- package/built/test/integration.js +168 -0
- package/built/test/integration.js.map +1 -0
- package/built/varsnap/core.d.ts +99 -0
- package/built/varsnap/core.js +408 -0
- package/built/varsnap/core.js.map +1 -0
- package/built/varsnap/index.d.ts +2 -0
- package/built/varsnap/index.js +3 -0
- package/built/varsnap/index.js.map +1 -0
- package/dist/browser.js +4612 -2304
- package/dist/browser.min.js +3 -3
- package/dist/index.d.ts +4 -2
- package/dist/node.cjs +1112 -0
- package/dist/node.min.cjs +15 -0
- package/package.json +29 -26
- package/varsnap/core.ts +509 -0
- package/varsnap/index.ts +3 -0
- package/dist/node.js +0 -826
- package/dist/node.min.js +0 -15
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const version = "1.11.1";
|
|
2
|
+
export declare const clientName: string;
|
|
3
|
+
export interface Config {
|
|
4
|
+
varsnap: boolean;
|
|
5
|
+
env: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
producerToken?: string;
|
|
8
|
+
consumerToken?: string;
|
|
9
|
+
logger?: Logger;
|
|
10
|
+
}
|
|
11
|
+
type ConfigKeys = keyof Config;
|
|
12
|
+
type rawJSONObject = ConsumeSnapResponse | ProduceTrialResponse | TrialGroupRequest | TrialGroupResponse | Record<string, string>;
|
|
13
|
+
export interface Logger {
|
|
14
|
+
debug(s: string): void;
|
|
15
|
+
log(s: string): void;
|
|
16
|
+
error(s: string): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class Util {
|
|
19
|
+
static getConfig(config: Config, configKey: ConfigKeys): string;
|
|
20
|
+
static setConfig(config: Config, configKey: ConfigKeys, configValue: string | boolean | Logger | undefined): Config;
|
|
21
|
+
static getSignature(targetFunc: TargetFunction, funcName: string): string;
|
|
22
|
+
static ajax(url: string, requestData: rawJSONObject): Promise<rawJSONObject>;
|
|
23
|
+
static debug(config: Config, data: string): void;
|
|
24
|
+
static log(config: Config, data: string): void;
|
|
25
|
+
static error(config: Config, data: string): void;
|
|
26
|
+
static resetProducers(): void;
|
|
27
|
+
static resetConsumers(): void;
|
|
28
|
+
static getProducers(): Producer[];
|
|
29
|
+
static getConsumers(): Consumer[];
|
|
30
|
+
static limitString(x: TargetFunctionInput[] | TargetFunctionOutput): string;
|
|
31
|
+
static isNode(): boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class Producer {
|
|
34
|
+
targetFunc: TargetFunction;
|
|
35
|
+
signature: string;
|
|
36
|
+
config: Config;
|
|
37
|
+
constructor(targetFunc: TargetFunction, signature: string, config: Config);
|
|
38
|
+
isEnabled(): boolean;
|
|
39
|
+
static serialize(data: TargetFunctionInput[] | TargetFunctionOutput): string;
|
|
40
|
+
static serialize_formatted(data: TargetFunctionInput[] | TargetFunctionOutput): string;
|
|
41
|
+
produce(args: TargetFunctionInput[], output: TargetFunctionOutput): Promise<boolean>;
|
|
42
|
+
}
|
|
43
|
+
interface ConsumeSnapResponse {
|
|
44
|
+
status: string;
|
|
45
|
+
results: Snap[];
|
|
46
|
+
}
|
|
47
|
+
interface Snap {
|
|
48
|
+
id: string;
|
|
49
|
+
inputs: string;
|
|
50
|
+
prod_outputs: string;
|
|
51
|
+
}
|
|
52
|
+
interface ProduceTrialResponse {
|
|
53
|
+
status: string;
|
|
54
|
+
trial_url: string;
|
|
55
|
+
}
|
|
56
|
+
export declare class Consumer {
|
|
57
|
+
targetFunc: TargetFunction;
|
|
58
|
+
signature: string;
|
|
59
|
+
config: Config;
|
|
60
|
+
constructor(targetFunc: TargetFunction, signature: string, config: Config);
|
|
61
|
+
isEnabled(): boolean;
|
|
62
|
+
static deserialize(data: string): TargetFunctionInput[] | TargetFunctionOutput | undefined;
|
|
63
|
+
consume(trialGroup: TrialGroupResponse): Promise<boolean>;
|
|
64
|
+
reportCentral(trialGroup: TrialGroupResponse, snap: Snap, prodOutputs: TargetFunctionOutput, localOutputs: TargetFunctionOutput, matches: boolean): Promise<string | boolean>;
|
|
65
|
+
reportLog(snapID: string, inputs: TargetFunctionInput[], prodOutputs: TargetFunctionOutput, localOutputs: TargetFunctionOutput, matches: boolean, trialURL: string | boolean): void;
|
|
66
|
+
reportTrialGroup(trialGroup: TrialGroupResponse): void;
|
|
67
|
+
}
|
|
68
|
+
export type TargetFunctionInput = any;
|
|
69
|
+
export type TargetFunctionOutput = any;
|
|
70
|
+
export interface TargetFunction {
|
|
71
|
+
(...args: TargetFunctionInput[]): TargetFunctionOutput;
|
|
72
|
+
}
|
|
73
|
+
export interface WrappedFunction {
|
|
74
|
+
(...args: TargetFunctionInput[]): TargetFunctionOutput;
|
|
75
|
+
producer: Producer;
|
|
76
|
+
consumer: Consumer;
|
|
77
|
+
signature: string;
|
|
78
|
+
}
|
|
79
|
+
export declare function varsnap(func: TargetFunction, funcName?: string): TargetFunction | WrappedFunction;
|
|
80
|
+
export declare namespace varsnap {
|
|
81
|
+
var _config: Config;
|
|
82
|
+
var updateConfig: (newConfig: Config) => void;
|
|
83
|
+
var reset: () => void;
|
|
84
|
+
var version: string;
|
|
85
|
+
var runTests: typeof import("./core.js").runTests;
|
|
86
|
+
}
|
|
87
|
+
interface TrialGroupRequest {
|
|
88
|
+
branch: string;
|
|
89
|
+
consumer_token: string;
|
|
90
|
+
client: string;
|
|
91
|
+
}
|
|
92
|
+
interface TrialGroupResponse {
|
|
93
|
+
status: string;
|
|
94
|
+
project_id: string;
|
|
95
|
+
trial_group_id: string;
|
|
96
|
+
trial_group_url: string;
|
|
97
|
+
}
|
|
98
|
+
export declare function runTests(): Promise<boolean>;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
const produceURL = 'https://www.varsnap.com/api/snap/produce/';
|
|
3
|
+
const consumeURL = 'https://www.varsnap.com/api/snap/consume/';
|
|
4
|
+
const produceTrialURL = 'https://www.varsnap.com/api/trial/produce/';
|
|
5
|
+
const trialGroupURL = 'https://www.varsnap.com/api/trial_group/';
|
|
6
|
+
export const version = '1.11.1';
|
|
7
|
+
export const clientName = 'javascript.' + version;
|
|
8
|
+
const defaultConfig = {
|
|
9
|
+
varsnap: true,
|
|
10
|
+
env: 'development',
|
|
11
|
+
branch: '',
|
|
12
|
+
producerToken: '',
|
|
13
|
+
consumerToken: '',
|
|
14
|
+
logger: console,
|
|
15
|
+
};
|
|
16
|
+
let Producers = [];
|
|
17
|
+
let Consumers = [];
|
|
18
|
+
export class Util {
|
|
19
|
+
static getConfig(config, configKey) {
|
|
20
|
+
if (!config) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
let val = config[configKey];
|
|
24
|
+
if (!val) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
val = val.toString().toLowerCase();
|
|
28
|
+
return val;
|
|
29
|
+
}
|
|
30
|
+
static setConfig(config, configKey, configValue) {
|
|
31
|
+
if (configKey === 'varsnap') {
|
|
32
|
+
if (typeof configValue === 'string') {
|
|
33
|
+
configValue = configValue === 'true';
|
|
34
|
+
}
|
|
35
|
+
config[configKey] = configValue;
|
|
36
|
+
}
|
|
37
|
+
if (configKey === 'env' || configKey === 'producerToken' || configKey === 'consumerToken' || configKey === 'branch') {
|
|
38
|
+
config[configKey] = configValue;
|
|
39
|
+
}
|
|
40
|
+
if (configKey === 'logger') {
|
|
41
|
+
config[configKey] = configValue;
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
44
|
+
}
|
|
45
|
+
static getSignature(targetFunc, funcName) {
|
|
46
|
+
let signature = '';
|
|
47
|
+
if (funcName !== '' && funcName !== undefined) {
|
|
48
|
+
signature = funcName;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Remove any implementation code from signature
|
|
52
|
+
signature = targetFunc.toString().split('{')[0];
|
|
53
|
+
// Trim preceding and trailing whitespace
|
|
54
|
+
signature = signature.replace(/^\s+|\s+$/g, '');
|
|
55
|
+
// Trim whitespace between comma separated arguments
|
|
56
|
+
signature = signature.replace(/,\s+/g, ',');
|
|
57
|
+
}
|
|
58
|
+
return 'javascript.' + version + '.' + signature;
|
|
59
|
+
}
|
|
60
|
+
static ajax(url, requestData) {
|
|
61
|
+
const requestParams = new URLSearchParams(requestData);
|
|
62
|
+
const data = requestParams.toString();
|
|
63
|
+
const options = {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
url: url,
|
|
66
|
+
headers: {
|
|
67
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
68
|
+
},
|
|
69
|
+
data: data,
|
|
70
|
+
responseType: 'json',
|
|
71
|
+
};
|
|
72
|
+
if (Util.isNode() && options.headers) {
|
|
73
|
+
options.headers['User-Agent'] = 'varsnap.js';
|
|
74
|
+
}
|
|
75
|
+
const ajaxPromise = axios(options).then((response) => {
|
|
76
|
+
return response.data;
|
|
77
|
+
}).catch((error) => {
|
|
78
|
+
return error;
|
|
79
|
+
});
|
|
80
|
+
return ajaxPromise;
|
|
81
|
+
}
|
|
82
|
+
static debug(config, data) {
|
|
83
|
+
if (config.logger) {
|
|
84
|
+
config.logger.debug(data);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
static log(config, data) {
|
|
88
|
+
if (config.logger) {
|
|
89
|
+
config.logger.log(data);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
static error(config, data) {
|
|
93
|
+
if (config.logger) {
|
|
94
|
+
config.logger.error(data);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static resetProducers() {
|
|
98
|
+
Producers = [];
|
|
99
|
+
}
|
|
100
|
+
static resetConsumers() {
|
|
101
|
+
Consumers = [];
|
|
102
|
+
}
|
|
103
|
+
static getProducers() {
|
|
104
|
+
return Producers;
|
|
105
|
+
}
|
|
106
|
+
static getConsumers() {
|
|
107
|
+
return Consumers;
|
|
108
|
+
}
|
|
109
|
+
static limitString(x) {
|
|
110
|
+
const limitedString = String(x);
|
|
111
|
+
const limit = 30;
|
|
112
|
+
const ellipsis = '...';
|
|
113
|
+
if (limitedString.length <= limit) {
|
|
114
|
+
return limitedString;
|
|
115
|
+
}
|
|
116
|
+
return limitedString.substring(0, 30 - ellipsis.length) + ellipsis;
|
|
117
|
+
}
|
|
118
|
+
static isNode() {
|
|
119
|
+
if (typeof process !== 'object') {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
if (typeof window !== 'undefined') {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export class Producer {
|
|
129
|
+
constructor(targetFunc, signature, config) {
|
|
130
|
+
this.targetFunc = targetFunc;
|
|
131
|
+
this.signature = signature;
|
|
132
|
+
this.config = config;
|
|
133
|
+
}
|
|
134
|
+
isEnabled() {
|
|
135
|
+
if (!this.config.varsnap) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (Util.getConfig(this.config, 'env') !== 'production') {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
if (!Util.getConfig(this.config, 'producerToken')) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
static serialize(data) {
|
|
147
|
+
return JSON.stringify(data);
|
|
148
|
+
}
|
|
149
|
+
static serialize_formatted(data) {
|
|
150
|
+
return JSON.stringify(data, null, 2);
|
|
151
|
+
}
|
|
152
|
+
produce(args, output) {
|
|
153
|
+
if (!this.isEnabled()) {
|
|
154
|
+
const errorPromise = new Promise((resolve) => {
|
|
155
|
+
return resolve(false);
|
|
156
|
+
});
|
|
157
|
+
return errorPromise;
|
|
158
|
+
}
|
|
159
|
+
Util.debug(this.config, 'Sending call to Varsnap');
|
|
160
|
+
return Promise.resolve(output).then((outputValue) => {
|
|
161
|
+
const data = {
|
|
162
|
+
'producer_token': Util.getConfig(this.config, 'producerToken'),
|
|
163
|
+
'signature': this.signature,
|
|
164
|
+
'inputs': Producer.serialize(args),
|
|
165
|
+
'prod_outputs': Producer.serialize(outputValue),
|
|
166
|
+
};
|
|
167
|
+
return Util.ajax(produceURL, data).then(() => {
|
|
168
|
+
return true;
|
|
169
|
+
}).catch((err) => {
|
|
170
|
+
if (err.response) {
|
|
171
|
+
if (err.response.status === 429) {
|
|
172
|
+
Util.error(this.config, 'Cannot produce to Varsnap; Signature at rate limit');
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
if (err.response.status === 404) {
|
|
176
|
+
Util.error(this.config, 'Cannot produce to Varsnap; check your producer token');
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
Util.error(this.config, err.response.statusText);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export class Consumer {
|
|
188
|
+
constructor(targetFunc, signature, config) {
|
|
189
|
+
this.targetFunc = targetFunc;
|
|
190
|
+
this.signature = signature;
|
|
191
|
+
this.config = config;
|
|
192
|
+
}
|
|
193
|
+
isEnabled() {
|
|
194
|
+
if (!this.config.varsnap) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
if (Util.getConfig(this.config, 'env') !== 'development') {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
if (!Util.getConfig(this.config, 'consumerToken')) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
static deserialize(data) {
|
|
206
|
+
if (data === '') {
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
return JSON.parse(data);
|
|
210
|
+
}
|
|
211
|
+
consume(trialGroup) {
|
|
212
|
+
if (!this.isEnabled()) {
|
|
213
|
+
const errorPromise = new Promise((resolve) => {
|
|
214
|
+
Util.error(this.config, 'Varsnap not enabled for testing');
|
|
215
|
+
return resolve(false);
|
|
216
|
+
});
|
|
217
|
+
return errorPromise;
|
|
218
|
+
}
|
|
219
|
+
const data = {
|
|
220
|
+
'consumer_token': Util.getConfig(this.config, 'consumerToken'),
|
|
221
|
+
'signature': this.signature,
|
|
222
|
+
};
|
|
223
|
+
const ajax = Util.ajax(consumeURL, data);
|
|
224
|
+
const consume = ajax.then((rawResponse) => {
|
|
225
|
+
const response = rawResponse;
|
|
226
|
+
if (!response || response.status !== 'ok') {
|
|
227
|
+
const errorPromise = new Promise((resolve) => {
|
|
228
|
+
Util.error(this.config, 'Received error from Varsnap: ' + response.status);
|
|
229
|
+
return resolve(false);
|
|
230
|
+
});
|
|
231
|
+
return [errorPromise];
|
|
232
|
+
}
|
|
233
|
+
if (response.results.length === 0) {
|
|
234
|
+
Util.log(this.config, 'No snaps found for signature: ' + data.signature);
|
|
235
|
+
}
|
|
236
|
+
const trialPromises = [];
|
|
237
|
+
for (const snap of response.results) {
|
|
238
|
+
const inputs = Consumer.deserialize(snap['inputs']);
|
|
239
|
+
const prodOutputs = Consumer.deserialize(snap['prod_outputs']);
|
|
240
|
+
let localOutputs;
|
|
241
|
+
try {
|
|
242
|
+
localOutputs = this.targetFunc(...inputs);
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
localOutputs = err;
|
|
246
|
+
}
|
|
247
|
+
const trialPromise = Promise.resolve(localOutputs).then((localOutputValue) => {
|
|
248
|
+
const prodOutputsSerialized = Producer.serialize(prodOutputs);
|
|
249
|
+
const localOutputsSerialized = Producer.serialize(localOutputValue);
|
|
250
|
+
const matches = prodOutputsSerialized === localOutputsSerialized;
|
|
251
|
+
this.reportCentral(trialGroup, snap, prodOutputs, localOutputValue, matches).then((trialURL) => {
|
|
252
|
+
this.reportLog(snap['id'], inputs, prodOutputs, localOutputValue, matches, trialURL);
|
|
253
|
+
});
|
|
254
|
+
return matches;
|
|
255
|
+
});
|
|
256
|
+
trialPromises.push(trialPromise);
|
|
257
|
+
}
|
|
258
|
+
return trialPromises;
|
|
259
|
+
}).then((trialPromises) => {
|
|
260
|
+
return Promise.all(trialPromises).then((results) => {
|
|
261
|
+
const allMatches = results.every((result) => result);
|
|
262
|
+
return allMatches;
|
|
263
|
+
});
|
|
264
|
+
}).catch((error) => {
|
|
265
|
+
Util.error(this.config, 'Cannot contact Varsnap: ' + error);
|
|
266
|
+
return false;
|
|
267
|
+
});
|
|
268
|
+
return consume;
|
|
269
|
+
}
|
|
270
|
+
reportCentral(trialGroup, snap, prodOutputs, localOutputs, matches) {
|
|
271
|
+
const data = {
|
|
272
|
+
'trial_group_id': trialGroup.trial_group_id,
|
|
273
|
+
'consumer_token': Util.getConfig(this.config, 'consumerToken'),
|
|
274
|
+
'snap_id': snap.id,
|
|
275
|
+
'test_outputs': Producer.serialize(localOutputs),
|
|
276
|
+
'matches': matches.toString(),
|
|
277
|
+
'snap_outputs_formatted': Producer.serialize_formatted(prodOutputs),
|
|
278
|
+
'test_outputs_formatted': Producer.serialize_formatted(localOutputs),
|
|
279
|
+
};
|
|
280
|
+
const ajax = Util.ajax(produceTrialURL, data);
|
|
281
|
+
const report = ajax.then((rawResponse) => {
|
|
282
|
+
const response = rawResponse;
|
|
283
|
+
if (!response || response.status !== 'ok') {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
const trialURL = response['trial_url'];
|
|
287
|
+
return trialURL;
|
|
288
|
+
}).catch((error) => {
|
|
289
|
+
Util.error(this.config, 'Cannot upload test results to Varsnap: ' + error);
|
|
290
|
+
return false;
|
|
291
|
+
});
|
|
292
|
+
return report;
|
|
293
|
+
}
|
|
294
|
+
reportLog(snapID, inputs, prodOutputs, localOutputs, matches, trialURL) {
|
|
295
|
+
if (matches) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
Util.log(this.config, '');
|
|
299
|
+
Util.log(this.config, 'Testing with Varsnap uuid: ' + snapID);
|
|
300
|
+
Util.log(this.config, 'Signature: ' + this.signature);
|
|
301
|
+
Util.log(this.config, 'Function input args: ' + Util.limitString(inputs));
|
|
302
|
+
Util.log(this.config, 'Production function outputs: ' + Util.limitString(prodOutputs));
|
|
303
|
+
Util.log(this.config, 'Your function outputs: ' + Util.limitString(localOutputs));
|
|
304
|
+
Util.log(this.config, 'Matching outputs: ' + matches);
|
|
305
|
+
let trialURLView = 'Cannot upload trial';
|
|
306
|
+
if (trialURL) {
|
|
307
|
+
trialURLView = String(trialURL);
|
|
308
|
+
}
|
|
309
|
+
Util.log(this.config, 'Trial URL: ' + trialURLView);
|
|
310
|
+
}
|
|
311
|
+
reportTrialGroup(trialGroup) {
|
|
312
|
+
Util.log(this.config, 'Trial Group: ' + trialGroup.trial_group_url);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export function varsnap(func, funcName) {
|
|
316
|
+
if (funcName === undefined) {
|
|
317
|
+
funcName = '';
|
|
318
|
+
}
|
|
319
|
+
const signature = Util.getSignature(func, funcName);
|
|
320
|
+
const producer = new Producer(func, signature, varsnap._config);
|
|
321
|
+
const consumer = new Consumer(func, signature, varsnap._config);
|
|
322
|
+
const wrapped = function (...args) {
|
|
323
|
+
let result;
|
|
324
|
+
try {
|
|
325
|
+
result = func(...args);
|
|
326
|
+
}
|
|
327
|
+
catch (err) {
|
|
328
|
+
producer.produce(args, err);
|
|
329
|
+
throw (err);
|
|
330
|
+
}
|
|
331
|
+
producer.produce(args, result);
|
|
332
|
+
return result;
|
|
333
|
+
};
|
|
334
|
+
wrapped.producer = producer;
|
|
335
|
+
wrapped.consumer = consumer;
|
|
336
|
+
wrapped.signature = signature;
|
|
337
|
+
Producers.push(producer);
|
|
338
|
+
Consumers.push(consumer);
|
|
339
|
+
return wrapped;
|
|
340
|
+
}
|
|
341
|
+
varsnap._config = defaultConfig;
|
|
342
|
+
varsnap.updateConfig = function updateConfig(newConfig) {
|
|
343
|
+
let config = varsnap._config;
|
|
344
|
+
for (const key of Object.keys(varsnap._config)) {
|
|
345
|
+
if (Object.prototype.hasOwnProperty.call(newConfig, key)) {
|
|
346
|
+
config = Util.setConfig(config, key, newConfig[key]);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
varsnap._config = config;
|
|
350
|
+
};
|
|
351
|
+
varsnap.reset = function reset() {
|
|
352
|
+
Util.resetConsumers();
|
|
353
|
+
Util.resetProducers();
|
|
354
|
+
};
|
|
355
|
+
varsnap.version = version;
|
|
356
|
+
function getTrialGroup(consumerConfig) {
|
|
357
|
+
const data = {
|
|
358
|
+
'branch': Util.getConfig(consumerConfig, 'branch'),
|
|
359
|
+
'consumer_token': Util.getConfig(consumerConfig, 'consumerToken'),
|
|
360
|
+
'client': clientName,
|
|
361
|
+
};
|
|
362
|
+
const raw = data;
|
|
363
|
+
const ajax = Util.ajax(trialGroupURL, raw);
|
|
364
|
+
const trialGroup = ajax.then((rawResponse) => {
|
|
365
|
+
const response = rawResponse;
|
|
366
|
+
return response;
|
|
367
|
+
}).catch((error) => {
|
|
368
|
+
let errorMessage = '';
|
|
369
|
+
if (error && error.response && error.response.data) {
|
|
370
|
+
const response = error.response.data;
|
|
371
|
+
errorMessage = response.error;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
errorMessage = error.toString();
|
|
375
|
+
}
|
|
376
|
+
Util.error(consumerConfig, 'Cannot generate a new Trial Group: ' + errorMessage);
|
|
377
|
+
return {
|
|
378
|
+
status: 'not ok',
|
|
379
|
+
project_id: '',
|
|
380
|
+
trial_group_id: '',
|
|
381
|
+
trial_group_url: '',
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
return trialGroup;
|
|
385
|
+
}
|
|
386
|
+
export function runTests() {
|
|
387
|
+
const consumers = Util.getConsumers();
|
|
388
|
+
if (consumers.length === 0) {
|
|
389
|
+
return Promise.resolve(true);
|
|
390
|
+
}
|
|
391
|
+
const consumerConfig = consumers[0].config;
|
|
392
|
+
return getTrialGroup(consumerConfig).then((trialGroup) => {
|
|
393
|
+
const testPromises = [];
|
|
394
|
+
for (const consumer of consumers) {
|
|
395
|
+
const testPromise = consumer.consume(trialGroup);
|
|
396
|
+
testPromises.push(testPromise);
|
|
397
|
+
}
|
|
398
|
+
if (consumers.length > 0) {
|
|
399
|
+
consumers[0].reportTrialGroup(trialGroup);
|
|
400
|
+
}
|
|
401
|
+
return Promise.all(testPromises);
|
|
402
|
+
}).then((results) => {
|
|
403
|
+
const allPass = results.every((result) => result);
|
|
404
|
+
return allPass;
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
varsnap.runTests = runTests;
|
|
408
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../varsnap/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,GAAG,2CAA2C,CAAC;AAC/D,MAAM,UAAU,GAAG,2CAA2C,CAAC;AAC/D,MAAM,eAAe,GAAG,4CAA4C,CAAC;AACrE,MAAM,aAAa,GAAG,0CAA0C,CAAC;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;AAWlD,MAAM,aAAa,GAAW;IAC5B,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,OAAO;CAChB,CAAC;AAGF,IAAI,SAAS,GAAe,EAAE,CAAC;AAC/B,IAAI,SAAS,GAAe,EAAE,CAAC;AAQ/B,MAAM,OAAO,IAAI;IACf,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,S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