@naturalcycles/abba 2.7.1 → 2.7.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/dist/abba.d.ts +1 -1
- package/dist/abba.js +6 -3
- package/package.json +1 -1
- package/src/abba.ts +10 -6
package/dist/abba.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Abba {
|
|
|
31
31
|
* Update experiment information, will also validate the buckets' ratio if experiment.active is true
|
|
32
32
|
* Cold method.
|
|
33
33
|
*/
|
|
34
|
-
saveExperiment(experiment: Experiment, buckets: Unsaved<Bucket>[]): Promise<ExperimentWithBuckets>;
|
|
34
|
+
saveExperiment(experiment: Experiment, buckets: (Unsaved<Bucket> | BucketInput)[]): Promise<ExperimentWithBuckets>;
|
|
35
35
|
private updateExclusions;
|
|
36
36
|
softDeleteExperiment(experimentId: string): Promise<void>;
|
|
37
37
|
/**
|
package/dist/abba.js
CHANGED
|
@@ -16,11 +16,14 @@ import { canGenerateNewAssignments, generateUserAssignmentData, getUserExclusion
|
|
|
16
16
|
const CACHE_TTL = 600_000;
|
|
17
17
|
export class Abba {
|
|
18
18
|
cfg;
|
|
19
|
-
experimentDao
|
|
20
|
-
bucketDao
|
|
21
|
-
userAssignmentDao
|
|
19
|
+
experimentDao;
|
|
20
|
+
bucketDao;
|
|
21
|
+
userAssignmentDao;
|
|
22
22
|
constructor(cfg) {
|
|
23
23
|
this.cfg = cfg;
|
|
24
|
+
this.experimentDao = experimentDao(cfg.db);
|
|
25
|
+
this.bucketDao = bucketDao(cfg.db);
|
|
26
|
+
this.userAssignmentDao = userAssignmentDao(cfg.db);
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Returns all experiments.
|
package/package.json
CHANGED
package/src/abba.ts
CHANGED
|
@@ -37,11 +37,15 @@ import {
|
|
|
37
37
|
const CACHE_TTL = 600_000
|
|
38
38
|
|
|
39
39
|
export class Abba {
|
|
40
|
-
private experimentDao
|
|
41
|
-
private bucketDao
|
|
42
|
-
private userAssignmentDao
|
|
43
|
-
|
|
44
|
-
constructor(public cfg: AbbaConfig) {
|
|
40
|
+
private experimentDao
|
|
41
|
+
private bucketDao
|
|
42
|
+
private userAssignmentDao
|
|
43
|
+
|
|
44
|
+
constructor(public cfg: AbbaConfig) {
|
|
45
|
+
this.experimentDao = experimentDao(cfg.db)
|
|
46
|
+
this.bucketDao = bucketDao(cfg.db)
|
|
47
|
+
this.userAssignmentDao = userAssignmentDao(cfg.db)
|
|
48
|
+
}
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Returns all experiments.
|
|
@@ -153,7 +157,7 @@ export class Abba {
|
|
|
153
157
|
*/
|
|
154
158
|
async saveExperiment(
|
|
155
159
|
experiment: Experiment,
|
|
156
|
-
buckets: Unsaved<Bucket>[],
|
|
160
|
+
buckets: (Unsaved<Bucket> | BucketInput)[],
|
|
157
161
|
): Promise<ExperimentWithBuckets> {
|
|
158
162
|
if (experiment.status === AssignmentStatus.Active) {
|
|
159
163
|
validateTotalBucketRatio(buckets)
|