@kenji71089/evaluation 0.0.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/.release-please-manifest.json +3 -0
- package/README.md +9 -0
- package/eslint.config.mjs +27 -0
- package/lib/clauseEvaluator.d.ts +22 -0
- package/lib/clauseEvaluator.js +299 -0
- package/lib/clauseEvaluator.mjs +214 -0
- package/lib/dependencyEvaluator.d.ts +6 -0
- package/lib/dependencyEvaluator.js +46 -0
- package/lib/dependencyEvaluator.mjs +19 -0
- package/lib/errors.d.ts +9 -0
- package/lib/errors.js +15 -0
- package/lib/errors.mjs +12 -0
- package/lib/evaluation.d.ts +25 -0
- package/lib/evaluation.js +503 -0
- package/lib/evaluation.mjs +328 -0
- package/lib/google/api/annotations_pb.d.ts +8 -0
- package/lib/google/api/annotations_pb.js +40 -0
- package/lib/google/api/annotations_pb.mjs +54 -0
- package/lib/google/api/annotations_pb_service.d.ts +3 -0
- package/lib/google/api/annotations_pb_service.js +3 -0
- package/lib/google/api/annotations_pb_service.mjs +3 -0
- package/lib/google/api/http_pb.d.ts +132 -0
- package/lib/google/api/http_pb.js +860 -0
- package/lib/google/api/http_pb.mjs +982 -0
- package/lib/google/api/http_pb_service.d.ts +3 -0
- package/lib/google/api/http_pb_service.js +3 -0
- package/lib/google/api/http_pb_service.mjs +3 -0
- package/lib/google/rpc/code_pb.d.ts +26 -0
- package/lib/google/rpc/code_pb.js +44 -0
- package/lib/google/rpc/code_pb.mjs +48 -0
- package/lib/google/rpc/code_pb_service.d.ts +3 -0
- package/lib/google/rpc/code_pb_service.js +3 -0
- package/lib/google/rpc/code_pb_service.mjs +3 -0
- package/lib/google/rpc/error_details_pb.d.ts +322 -0
- package/lib/google/rpc/error_details_pb.js +2220 -0
- package/lib/google/rpc/error_details_pb.mjs +2499 -0
- package/lib/google/rpc/error_details_pb_service.d.ts +3 -0
- package/lib/google/rpc/error_details_pb_service.js +3 -0
- package/lib/google/rpc/error_details_pb_service.mjs +3 -0
- package/lib/google/rpc/status_pb.d.ts +36 -0
- package/lib/google/rpc/status_pb.js +235 -0
- package/lib/google/rpc/status_pb.mjs +268 -0
- package/lib/google/rpc/status_pb_service.d.ts +3 -0
- package/lib/google/rpc/status_pb_service.js +3 -0
- package/lib/google/rpc/status_pb_service.mjs +3 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +199 -0
- package/lib/index.mjs +46 -0
- package/lib/modelFactory.d.ts +64 -0
- package/lib/modelFactory.js +206 -0
- package/lib/modelFactory.mjs +176 -0
- package/lib/proto/event/client/event_pb.d.ts +761 -0
- package/lib/proto/event/client/event_pb.js +5195 -0
- package/lib/proto/event/client/event_pb.mjs +5865 -0
- package/lib/proto/event/client/event_pb_service.d.ts +3 -0
- package/lib/proto/event/client/event_pb_service.js +3 -0
- package/lib/proto/event/client/event_pb_service.mjs +3 -0
- package/lib/proto/event/domain/event_pb.d.ts +4518 -0
- package/lib/proto/event/domain/event_pb.js +10834 -0
- package/lib/proto/event/domain/event_pb.mjs +33315 -0
- package/lib/proto/event/domain/event_pb_service.d.ts +3 -0
- package/lib/proto/event/domain/event_pb_service.js +3 -0
- package/lib/proto/event/domain/event_pb_service.mjs +3 -0
- package/lib/proto/event/domain/localized_message_pb.d.ts +29 -0
- package/lib/proto/event/domain/localized_message_pb.js +183 -0
- package/lib/proto/event/domain/localized_message_pb.mjs +206 -0
- package/lib/proto/event/domain/localized_message_pb_service.d.ts +3 -0
- package/lib/proto/event/domain/localized_message_pb_service.js +3 -0
- package/lib/proto/event/domain/localized_message_pb_service.mjs +3 -0
- package/lib/proto/event/service/feature_pb.d.ts +44 -0
- package/lib/proto/event/service/feature_pb.js +277 -0
- package/lib/proto/event/service/feature_pb.mjs +319 -0
- package/lib/proto/event/service/feature_pb_service.d.ts +3 -0
- package/lib/proto/event/service/feature_pb_service.js +3 -0
- package/lib/proto/event/service/feature_pb_service.mjs +3 -0
- package/lib/proto/event/service/segment_pb.d.ts +51 -0
- package/lib/proto/event/service/segment_pb.js +324 -0
- package/lib/proto/event/service/segment_pb.mjs +375 -0
- package/lib/proto/event/service/segment_pb_service.d.ts +3 -0
- package/lib/proto/event/service/segment_pb_service.js +3 -0
- package/lib/proto/event/service/segment_pb_service.mjs +3 -0
- package/lib/proto/event/service/user_pb.d.ts +49 -0
- package/lib/proto/event/service/user_pb.js +315 -0
- package/lib/proto/event/service/user_pb.mjs +362 -0
- package/lib/proto/event/service/user_pb_service.d.ts +3 -0
- package/lib/proto/event/service/user_pb_service.js +3 -0
- package/lib/proto/event/service/user_pb_service.mjs +3 -0
- package/lib/proto/feature/clause_pb.d.ts +57 -0
- package/lib/proto/feature/clause_pb.js +277 -0
- package/lib/proto/feature/clause_pb.mjs +312 -0
- package/lib/proto/feature/clause_pb_service.d.ts +3 -0
- package/lib/proto/feature/clause_pb_service.js +3 -0
- package/lib/proto/feature/clause_pb_service.mjs +3 -0
- package/lib/proto/feature/command_pb.d.ts +1213 -0
- package/lib/proto/feature/command_pb.js +8260 -0
- package/lib/proto/feature/command_pb.mjs +9275 -0
- package/lib/proto/feature/command_pb_service.d.ts +3 -0
- package/lib/proto/feature/command_pb_service.js +3 -0
- package/lib/proto/feature/command_pb_service.mjs +3 -0
- package/lib/proto/feature/evaluation_pb.d.ts +111 -0
- package/lib/proto/feature/evaluation_pb.js +685 -0
- package/lib/proto/feature/evaluation_pb.mjs +793 -0
- package/lib/proto/feature/evaluation_pb_service.d.ts +3 -0
- package/lib/proto/feature/evaluation_pb_service.js +3 -0
- package/lib/proto/feature/evaluation_pb_service.mjs +3 -0
- package/lib/proto/feature/feature_last_used_info_pb.d.ts +45 -0
- package/lib/proto/feature/feature_last_used_info_pb.js +283 -0
- package/lib/proto/feature/feature_last_used_info_pb.mjs +326 -0
- package/lib/proto/feature/feature_last_used_info_pb_service.d.ts +3 -0
- package/lib/proto/feature/feature_last_used_info_pb_service.js +3 -0
- package/lib/proto/feature/feature_last_used_info_pb_service.mjs +3 -0
- package/lib/proto/feature/feature_pb.d.ts +192 -0
- package/lib/proto/feature/feature_pb.js +1210 -0
- package/lib/proto/feature/feature_pb.mjs +1413 -0
- package/lib/proto/feature/feature_pb_service.d.ts +3 -0
- package/lib/proto/feature/feature_pb_service.js +3 -0
- package/lib/proto/feature/feature_pb_service.mjs +3 -0
- package/lib/proto/feature/flag_trigger_pb.d.ts +84 -0
- package/lib/proto/feature/flag_trigger_pb.js +452 -0
- package/lib/proto/feature/flag_trigger_pb.mjs +525 -0
- package/lib/proto/feature/flag_trigger_pb_service.d.ts +3 -0
- package/lib/proto/feature/flag_trigger_pb_service.js +3 -0
- package/lib/proto/feature/flag_trigger_pb_service.mjs +3 -0
- package/lib/proto/feature/prerequisite_pb.d.ts +29 -0
- package/lib/proto/feature/prerequisite_pb.js +183 -0
- package/lib/proto/feature/prerequisite_pb.mjs +206 -0
- package/lib/proto/feature/prerequisite_pb_service.d.ts +3 -0
- package/lib/proto/feature/prerequisite_pb_service.js +3 -0
- package/lib/proto/feature/prerequisite_pb_service.mjs +3 -0
- package/lib/proto/feature/reason_pb.d.ts +40 -0
- package/lib/proto/feature/reason_pb.js +196 -0
- package/lib/proto/feature/reason_pb.mjs +219 -0
- package/lib/proto/feature/reason_pb_service.d.ts +3 -0
- package/lib/proto/feature/reason_pb_service.js +3 -0
- package/lib/proto/feature/reason_pb_service.mjs +3 -0
- package/lib/proto/feature/rule_pb.d.ts +39 -0
- package/lib/proto/feature/rule_pb.js +254 -0
- package/lib/proto/feature/rule_pb.mjs +291 -0
- package/lib/proto/feature/rule_pb_service.d.ts +3 -0
- package/lib/proto/feature/rule_pb_service.js +3 -0
- package/lib/proto/feature/rule_pb_service.mjs +3 -0
- package/lib/proto/feature/segment_pb.d.ts +161 -0
- package/lib/proto/feature/segment_pb.js +974 -0
- package/lib/proto/feature/segment_pb.mjs +1127 -0
- package/lib/proto/feature/segment_pb_service.d.ts +3 -0
- package/lib/proto/feature/segment_pb_service.js +3 -0
- package/lib/proto/feature/segment_pb_service.mjs +3 -0
- package/lib/proto/feature/service_pb.d.ts +2158 -0
- package/lib/proto/feature/service_pb.js +5363 -0
- package/lib/proto/feature/service_pb.mjs +16348 -0
- package/lib/proto/feature/service_pb_service.d.ts +747 -0
- package/lib/proto/feature/service_pb_service.js +1424 -0
- package/lib/proto/feature/service_pb_service.mjs +1501 -0
- package/lib/proto/feature/strategy_pb.d.ts +110 -0
- package/lib/proto/feature/strategy_pb.js +712 -0
- package/lib/proto/feature/strategy_pb.mjs +803 -0
- package/lib/proto/feature/strategy_pb_service.d.ts +3 -0
- package/lib/proto/feature/strategy_pb_service.js +3 -0
- package/lib/proto/feature/strategy_pb_service.mjs +3 -0
- package/lib/proto/feature/target_pb.d.ts +31 -0
- package/lib/proto/feature/target_pb.js +207 -0
- package/lib/proto/feature/target_pb.mjs +232 -0
- package/lib/proto/feature/target_pb_service.d.ts +3 -0
- package/lib/proto/feature/target_pb_service.js +3 -0
- package/lib/proto/feature/target_pb_service.mjs +3 -0
- package/lib/proto/feature/variation_pb.d.ts +37 -0
- package/lib/proto/feature/variation_pb.js +233 -0
- package/lib/proto/feature/variation_pb.mjs +266 -0
- package/lib/proto/feature/variation_pb_service.d.ts +3 -0
- package/lib/proto/feature/variation_pb_service.js +3 -0
- package/lib/proto/feature/variation_pb_service.mjs +3 -0
- package/lib/proto/gateway/service_pb.d.ts +772 -0
- package/lib/proto/gateway/service_pb.js +5249 -0
- package/lib/proto/gateway/service_pb.mjs +6001 -0
- package/lib/proto/gateway/service_pb_service.d.ts +253 -0
- package/lib/proto/gateway/service_pb_service.js +436 -0
- package/lib/proto/gateway/service_pb_service.mjs +461 -0
- package/lib/proto/user/user_pb.d.ts +58 -0
- package/lib/proto/user/user_pb.js +410 -0
- package/lib/proto/user/user_pb.mjs +460 -0
- package/lib/proto/user/user_pb_service.d.ts +3 -0
- package/lib/proto/user/user_pb_service.js +3 -0
- package/lib/proto/user/user_pb_service.mjs +3 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb.d.ts +16 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb.js +100 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb.mjs +158 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb_service.d.ts +3 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb_service.js +3 -0
- package/lib/protoc-gen-openapiv2/options/annotations_pb_service.mjs +3 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb.d.ts +834 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb.js +5456 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb.mjs +6256 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb_service.d.ts +3 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb_service.js +3 -0
- package/lib/protoc-gen-openapiv2/options/openapiv2_pb_service.mjs +3 -0
- package/lib/ruleEvaluator.d.ts +13 -0
- package/lib/ruleEvaluator.js +80 -0
- package/lib/ruleEvaluator.mjs +41 -0
- package/lib/segmentEvaluator.d.ts +7 -0
- package/lib/segmentEvaluator.js +74 -0
- package/lib/segmentEvaluator.mjs +34 -0
- package/lib/strategyEvaluator.d.ts +10 -0
- package/lib/strategyEvaluator.js +135 -0
- package/lib/strategyEvaluator.mjs +83 -0
- package/lib/userEvaluation.d.ts +8 -0
- package/lib/userEvaluation.js +70 -0
- package/lib/userEvaluation.mjs +60 -0
- package/package.json +46 -0
- package/release-please-config.json +22 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GatewayClient = exports.SourceId = exports.GetSegmentUsersResponse = exports.GetSegmentUsersRequest = exports.GetFeatureFlagsResponse = exports.GetFeatureFlagsRequest = exports.createVariation = exports.createUser = exports.createTarget = exports.createStrategy = exports.createSegmentUser = exports.createEvaluation = exports.createFeature = exports.createPrerequisite = exports.createRule = exports.createReason = exports.createRolloutStrategy = exports.createFixedStrategy = exports.createClause = exports.Reason = exports.Clause = exports.Strategy = exports.Feature = exports.SegmentUsers = exports.SegmentUser = exports.User = exports.UserEvaluations = exports.Evaluation = exports.NewUserEvaluations = exports.Evaluator = void 0;
|
|
7
|
+
var evaluation_1 = require("./evaluation");
|
|
8
|
+
Object.defineProperty(exports, "Evaluator", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return evaluation_1.Evaluator;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var segment_pb_1 = require("./proto/feature/segment_pb");
|
|
15
|
+
Object.defineProperty(exports, "SegmentUser", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return segment_pb_1.SegmentUser;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "SegmentUsers", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return segment_pb_1.SegmentUsers;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var feature_pb_1 = require("./proto/feature/feature_pb");
|
|
28
|
+
Object.defineProperty(exports, "Feature", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return feature_pb_1.Feature;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var userEvaluation_1 = require("./userEvaluation");
|
|
35
|
+
Object.defineProperty(exports, "NewUserEvaluations", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function get() {
|
|
38
|
+
return userEvaluation_1.NewUserEvaluations;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var user_pb_1 = require("./proto/user/user_pb");
|
|
42
|
+
Object.defineProperty(exports, "User", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return user_pb_1.User;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var evaluation_pb_1 = require("./proto/feature/evaluation_pb");
|
|
49
|
+
Object.defineProperty(exports, "Evaluation", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return evaluation_pb_1.Evaluation;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "UserEvaluations", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return evaluation_pb_1.UserEvaluations;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var strategy_pb_1 = require("./proto/feature/strategy_pb");
|
|
62
|
+
Object.defineProperty(exports, "Strategy", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function get() {
|
|
65
|
+
return strategy_pb_1.Strategy;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var clause_pb_1 = require("./proto/feature/clause_pb");
|
|
69
|
+
Object.defineProperty(exports, "Clause", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function get() {
|
|
72
|
+
return clause_pb_1.Clause;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var reason_pb_1 = require("./proto/feature/reason_pb");
|
|
76
|
+
Object.defineProperty(exports, "Reason", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return reason_pb_1.Reason;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var modelFactory_1 = require("./modelFactory");
|
|
83
|
+
Object.defineProperty(exports, "createClause", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function get() {
|
|
86
|
+
return modelFactory_1.createClause;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "createFixedStrategy", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function get() {
|
|
92
|
+
return modelFactory_1.createFixedStrategy;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "createRolloutStrategy", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function get() {
|
|
98
|
+
return modelFactory_1.createRolloutStrategy;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(exports, "createReason", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function get() {
|
|
104
|
+
return modelFactory_1.createReason;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "createRule", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function get() {
|
|
110
|
+
return modelFactory_1.createRule;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "createPrerequisite", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function get() {
|
|
116
|
+
return modelFactory_1.createPrerequisite;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "createFeature", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function get() {
|
|
122
|
+
return modelFactory_1.createFeature;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(exports, "createEvaluation", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function get() {
|
|
128
|
+
return modelFactory_1.createEvaluation;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(exports, "createSegmentUser", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function get() {
|
|
134
|
+
return modelFactory_1.createSegmentUser;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "createStrategy", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function get() {
|
|
140
|
+
return modelFactory_1.createStrategy;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "createTarget", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function get() {
|
|
146
|
+
return modelFactory_1.createTarget;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, "createUser", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function get() {
|
|
152
|
+
return modelFactory_1.createUser;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, "createVariation", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function get() {
|
|
158
|
+
return modelFactory_1.createVariation;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
var service_pb_1 = require("./proto/gateway/service_pb");
|
|
162
|
+
Object.defineProperty(exports, "GetFeatureFlagsRequest", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return service_pb_1.GetFeatureFlagsRequest;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "GetFeatureFlagsResponse", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function get() {
|
|
171
|
+
return service_pb_1.GetFeatureFlagsResponse;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "GetSegmentUsersRequest", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function get() {
|
|
177
|
+
return service_pb_1.GetSegmentUsersRequest;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "GetSegmentUsersResponse", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function get() {
|
|
183
|
+
return service_pb_1.GetSegmentUsersResponse;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
var event_pb_1 = require("./proto/event/client/event_pb");
|
|
187
|
+
Object.defineProperty(exports, "SourceId", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function get() {
|
|
190
|
+
return event_pb_1.SourceId;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
var service_pb_service_1 = require("./proto/gateway/service_pb_service");
|
|
194
|
+
Object.defineProperty(exports, "GatewayClient", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function get() {
|
|
197
|
+
return service_pb_service_1.GatewayClient;
|
|
198
|
+
}
|
|
199
|
+
});
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GatewayClient = exports.SourceId = exports.GetSegmentUsersResponse = exports.GetSegmentUsersRequest = exports.GetFeatureFlagsResponse = exports.GetFeatureFlagsRequest = exports.createVariation = exports.createUser = exports.createTarget = exports.createStrategy = exports.createSegmentUser = exports.createEvaluation = exports.createFeature = exports.createPrerequisite = exports.createRule = exports.createReason = exports.createRolloutStrategy = exports.createFixedStrategy = exports.createClause = exports.Reason = exports.Clause = exports.Strategy = exports.Feature = exports.SegmentUsers = exports.SegmentUser = exports.User = exports.UserEvaluations = exports.Evaluation = exports.NewUserEvaluations = exports.Evaluator = void 0;
|
|
4
|
+
const evaluation_1 = require("./evaluation");
|
|
5
|
+
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return evaluation_1.Evaluator; } });
|
|
6
|
+
const segment_pb_1 = require("./proto/feature/segment_pb");
|
|
7
|
+
Object.defineProperty(exports, "SegmentUser", { enumerable: true, get: function () { return segment_pb_1.SegmentUser; } });
|
|
8
|
+
Object.defineProperty(exports, "SegmentUsers", { enumerable: true, get: function () { return segment_pb_1.SegmentUsers; } });
|
|
9
|
+
const feature_pb_1 = require("./proto/feature/feature_pb");
|
|
10
|
+
Object.defineProperty(exports, "Feature", { enumerable: true, get: function () { return feature_pb_1.Feature; } });
|
|
11
|
+
const userEvaluation_1 = require("./userEvaluation");
|
|
12
|
+
Object.defineProperty(exports, "NewUserEvaluations", { enumerable: true, get: function () { return userEvaluation_1.NewUserEvaluations; } });
|
|
13
|
+
const user_pb_1 = require("./proto/user/user_pb");
|
|
14
|
+
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_pb_1.User; } });
|
|
15
|
+
const evaluation_pb_1 = require("./proto/feature/evaluation_pb");
|
|
16
|
+
Object.defineProperty(exports, "Evaluation", { enumerable: true, get: function () { return evaluation_pb_1.Evaluation; } });
|
|
17
|
+
Object.defineProperty(exports, "UserEvaluations", { enumerable: true, get: function () { return evaluation_pb_1.UserEvaluations; } });
|
|
18
|
+
const strategy_pb_1 = require("./proto/feature/strategy_pb");
|
|
19
|
+
Object.defineProperty(exports, "Strategy", { enumerable: true, get: function () { return strategy_pb_1.Strategy; } });
|
|
20
|
+
const clause_pb_1 = require("./proto/feature/clause_pb");
|
|
21
|
+
Object.defineProperty(exports, "Clause", { enumerable: true, get: function () { return clause_pb_1.Clause; } });
|
|
22
|
+
const reason_pb_1 = require("./proto/feature/reason_pb");
|
|
23
|
+
Object.defineProperty(exports, "Reason", { enumerable: true, get: function () { return reason_pb_1.Reason; } });
|
|
24
|
+
const modelFactory_1 = require("./modelFactory");
|
|
25
|
+
Object.defineProperty(exports, "createClause", { enumerable: true, get: function () { return modelFactory_1.createClause; } });
|
|
26
|
+
Object.defineProperty(exports, "createFixedStrategy", { enumerable: true, get: function () { return modelFactory_1.createFixedStrategy; } });
|
|
27
|
+
Object.defineProperty(exports, "createRolloutStrategy", { enumerable: true, get: function () { return modelFactory_1.createRolloutStrategy; } });
|
|
28
|
+
Object.defineProperty(exports, "createReason", { enumerable: true, get: function () { return modelFactory_1.createReason; } });
|
|
29
|
+
Object.defineProperty(exports, "createRule", { enumerable: true, get: function () { return modelFactory_1.createRule; } });
|
|
30
|
+
Object.defineProperty(exports, "createPrerequisite", { enumerable: true, get: function () { return modelFactory_1.createPrerequisite; } });
|
|
31
|
+
Object.defineProperty(exports, "createFeature", { enumerable: true, get: function () { return modelFactory_1.createFeature; } });
|
|
32
|
+
Object.defineProperty(exports, "createEvaluation", { enumerable: true, get: function () { return modelFactory_1.createEvaluation; } });
|
|
33
|
+
Object.defineProperty(exports, "createSegmentUser", { enumerable: true, get: function () { return modelFactory_1.createSegmentUser; } });
|
|
34
|
+
Object.defineProperty(exports, "createStrategy", { enumerable: true, get: function () { return modelFactory_1.createStrategy; } });
|
|
35
|
+
Object.defineProperty(exports, "createTarget", { enumerable: true, get: function () { return modelFactory_1.createTarget; } });
|
|
36
|
+
Object.defineProperty(exports, "createUser", { enumerable: true, get: function () { return modelFactory_1.createUser; } });
|
|
37
|
+
Object.defineProperty(exports, "createVariation", { enumerable: true, get: function () { return modelFactory_1.createVariation; } });
|
|
38
|
+
const service_pb_1 = require("./proto/gateway/service_pb");
|
|
39
|
+
Object.defineProperty(exports, "GetFeatureFlagsRequest", { enumerable: true, get: function () { return service_pb_1.GetFeatureFlagsRequest; } });
|
|
40
|
+
Object.defineProperty(exports, "GetFeatureFlagsResponse", { enumerable: true, get: function () { return service_pb_1.GetFeatureFlagsResponse; } });
|
|
41
|
+
Object.defineProperty(exports, "GetSegmentUsersRequest", { enumerable: true, get: function () { return service_pb_1.GetSegmentUsersRequest; } });
|
|
42
|
+
Object.defineProperty(exports, "GetSegmentUsersResponse", { enumerable: true, get: function () { return service_pb_1.GetSegmentUsersResponse; } });
|
|
43
|
+
const event_pb_1 = require("./proto/event/client/event_pb");
|
|
44
|
+
Object.defineProperty(exports, "SourceId", { enumerable: true, get: function () { return event_pb_1.SourceId; } });
|
|
45
|
+
const service_pb_service_1 = require("./proto/gateway/service_pb_service");
|
|
46
|
+
Object.defineProperty(exports, "GatewayClient", { enumerable: true, get: function () { return service_pb_service_1.GatewayClient; } });
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Clause } from './proto/feature/clause_pb';
|
|
2
|
+
import { Evaluation } from './proto/feature/evaluation_pb';
|
|
3
|
+
import { Feature } from './proto/feature/feature_pb';
|
|
4
|
+
import { Prerequisite } from './proto/feature/prerequisite_pb';
|
|
5
|
+
import { Reason } from './proto/feature/reason_pb';
|
|
6
|
+
import { Rule } from './proto/feature/rule_pb';
|
|
7
|
+
import { SegmentUser } from './proto/feature/segment_pb';
|
|
8
|
+
import { FixedStrategy, RolloutStrategy, Strategy } from './proto/feature/strategy_pb';
|
|
9
|
+
import { Target } from './proto/feature/target_pb';
|
|
10
|
+
import { Variation } from './proto/feature/variation_pb';
|
|
11
|
+
import { User } from './proto/user/user_pb';
|
|
12
|
+
export declare function createUser(id: string, data: Record<string, string> | null): User;
|
|
13
|
+
export declare function createFeature(options?: {
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
version?: number;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
createdAt?: number;
|
|
19
|
+
variationType?: Feature.VariationTypeMap[keyof Feature.VariationTypeMap];
|
|
20
|
+
variations?: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
value: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
targets?: Array<{
|
|
27
|
+
variation: string;
|
|
28
|
+
users: string[];
|
|
29
|
+
}>;
|
|
30
|
+
rules?: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
attribute: string;
|
|
33
|
+
operator: Clause.OperatorMap[keyof Clause.OperatorMap];
|
|
34
|
+
values: string[];
|
|
35
|
+
fixedVariation: string;
|
|
36
|
+
}>;
|
|
37
|
+
defaultStrategy?: {
|
|
38
|
+
type: Strategy.TypeMap[keyof Strategy.TypeMap];
|
|
39
|
+
variation: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
prerequisitesList?: Array<Prerequisite>;
|
|
42
|
+
tagList?: Array<string>;
|
|
43
|
+
offVariation?: string;
|
|
44
|
+
}): Feature;
|
|
45
|
+
export declare function createTarget(variation: string, users: string[]): Target;
|
|
46
|
+
export declare function createFixedStrategy(variation: string): FixedStrategy;
|
|
47
|
+
export declare function createRolloutStrategy(options: {
|
|
48
|
+
variations: Array<{
|
|
49
|
+
variation: string;
|
|
50
|
+
weight: number;
|
|
51
|
+
}>;
|
|
52
|
+
}): RolloutStrategy;
|
|
53
|
+
export declare function createStrategy(options: {
|
|
54
|
+
type: Strategy.TypeMap[keyof Strategy.TypeMap];
|
|
55
|
+
fixedStrategy?: FixedStrategy;
|
|
56
|
+
rolloutStrategy?: RolloutStrategy;
|
|
57
|
+
}): Strategy;
|
|
58
|
+
export declare function createRule(id: string, attribute: string, operator: Clause.OperatorMap[keyof Clause.OperatorMap], values: string[], fixedVariation: string): Rule;
|
|
59
|
+
export declare function createClause(id: string, attribute: string, operator: Clause.OperatorMap[keyof Clause.OperatorMap], values: string[]): Clause;
|
|
60
|
+
export declare function createSegmentUser(userId: string, segmentId: string, state: SegmentUser.StateMap[keyof SegmentUser.StateMap]): SegmentUser;
|
|
61
|
+
export declare function createPrerequisite(featureId: string, variationId: string): Prerequisite;
|
|
62
|
+
export declare function createVariation(id: string, value: string, name: string, description: string): Variation;
|
|
63
|
+
export declare function createEvaluation(id: string, featureId: string, featureVersion: number, userId: string, variationId: string, variationValue: string, variationName: string, reason: Reason): Evaluation;
|
|
64
|
+
export declare function createReason(ruleId: string, type: Reason.TypeMap[keyof Reason.TypeMap]): Reason;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
exports.createUser = createUser;
|
|
19
|
+
exports.createFeature = createFeature;
|
|
20
|
+
exports.createTarget = createTarget;
|
|
21
|
+
exports.createFixedStrategy = createFixedStrategy;
|
|
22
|
+
exports.createRolloutStrategy = createRolloutStrategy;
|
|
23
|
+
exports.createStrategy = createStrategy;
|
|
24
|
+
exports.createRule = createRule;
|
|
25
|
+
exports.createClause = createClause;
|
|
26
|
+
exports.createSegmentUser = createSegmentUser;
|
|
27
|
+
exports.createPrerequisite = createPrerequisite;
|
|
28
|
+
exports.createVariation = createVariation;
|
|
29
|
+
exports.createEvaluation = createEvaluation;
|
|
30
|
+
exports.createReason = createReason;
|
|
31
|
+
var clause_pb_1 = require("./proto/feature/clause_pb");
|
|
32
|
+
var evaluation_pb_1 = require("./proto/feature/evaluation_pb");
|
|
33
|
+
var feature_pb_1 = require("./proto/feature/feature_pb");
|
|
34
|
+
var prerequisite_pb_1 = require("./proto/feature/prerequisite_pb");
|
|
35
|
+
var reason_pb_1 = require("./proto/feature/reason_pb");
|
|
36
|
+
var rule_pb_1 = require("./proto/feature/rule_pb");
|
|
37
|
+
var segment_pb_1 = require("./proto/feature/segment_pb");
|
|
38
|
+
var strategy_pb_1 = require("./proto/feature/strategy_pb");
|
|
39
|
+
var target_pb_1 = require("./proto/feature/target_pb");
|
|
40
|
+
var variation_pb_1 = require("./proto/feature/variation_pb");
|
|
41
|
+
var user_pb_1 = require("./proto/user/user_pb");
|
|
42
|
+
// Helper function to create a User instance
|
|
43
|
+
function createUser(id, data) {
|
|
44
|
+
var user = new user_pb_1.User();
|
|
45
|
+
user.setId(id);
|
|
46
|
+
var map = user.getDataMap();
|
|
47
|
+
if (data != null) {
|
|
48
|
+
Object.entries(data).forEach(function (_ref) {
|
|
49
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
50
|
+
key = _ref2[0],
|
|
51
|
+
value = _ref2[1];
|
|
52
|
+
return map.set(key, value);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return user;
|
|
56
|
+
}
|
|
57
|
+
function createFeature() {
|
|
58
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59
|
+
var defaultOptions = {
|
|
60
|
+
id: '',
|
|
61
|
+
name: '',
|
|
62
|
+
version: 0,
|
|
63
|
+
enabled: false,
|
|
64
|
+
createdAt: Date.now(),
|
|
65
|
+
variationType: feature_pb_1.Feature.VariationType.STRING,
|
|
66
|
+
variations: [],
|
|
67
|
+
targets: [],
|
|
68
|
+
rules: [],
|
|
69
|
+
defaultStrategy: undefined,
|
|
70
|
+
prerequisitesList: [],
|
|
71
|
+
tagList: [],
|
|
72
|
+
offVariation: undefined
|
|
73
|
+
};
|
|
74
|
+
var finalOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
75
|
+
var feature = new feature_pb_1.Feature();
|
|
76
|
+
feature.setId(finalOptions.id);
|
|
77
|
+
feature.setName(finalOptions.name);
|
|
78
|
+
feature.setVersion(finalOptions.version);
|
|
79
|
+
feature.setEnabled(finalOptions.enabled);
|
|
80
|
+
feature.setCreatedAt(finalOptions.createdAt);
|
|
81
|
+
feature.setVariationType(finalOptions.variationType);
|
|
82
|
+
// Set variations
|
|
83
|
+
var variationList = finalOptions.variations.map(function (v) {
|
|
84
|
+
return createVariation(v.id, v.value, v.name, v.description);
|
|
85
|
+
});
|
|
86
|
+
feature.setVariationsList(variationList);
|
|
87
|
+
// Set targets
|
|
88
|
+
var targetList = finalOptions.targets.map(function (t) {
|
|
89
|
+
return createTarget(t.variation, t.users);
|
|
90
|
+
});
|
|
91
|
+
feature.setTargetsList(targetList);
|
|
92
|
+
// Set rules
|
|
93
|
+
var ruleList = finalOptions.rules.map(function (r) {
|
|
94
|
+
return createRule(r.id, r.attribute, r.operator, r.values, r.fixedVariation);
|
|
95
|
+
});
|
|
96
|
+
feature.setRulesList(ruleList);
|
|
97
|
+
// Set default strategy
|
|
98
|
+
var defaultStrategy = finalOptions.defaultStrategy;
|
|
99
|
+
if (defaultStrategy !== undefined) {
|
|
100
|
+
var defaultFixedStrategy = createFixedStrategy(defaultStrategy.variation);
|
|
101
|
+
var strategy = createStrategy({
|
|
102
|
+
type: defaultStrategy.type,
|
|
103
|
+
fixedStrategy: defaultFixedStrategy
|
|
104
|
+
});
|
|
105
|
+
feature.setDefaultStrategy(strategy);
|
|
106
|
+
}
|
|
107
|
+
feature.setPrerequisitesList(finalOptions.prerequisitesList);
|
|
108
|
+
feature.setTagsList(finalOptions.tagList);
|
|
109
|
+
if (finalOptions.offVariation !== undefined) {
|
|
110
|
+
feature.setOffVariation(finalOptions.offVariation);
|
|
111
|
+
}
|
|
112
|
+
return feature;
|
|
113
|
+
}
|
|
114
|
+
function createTarget(variation, users) {
|
|
115
|
+
var target = new target_pb_1.Target();
|
|
116
|
+
target.setVariation(variation);
|
|
117
|
+
target.setUsersList(users);
|
|
118
|
+
return target;
|
|
119
|
+
}
|
|
120
|
+
function createFixedStrategy(variation) {
|
|
121
|
+
var fixedStrategy = new strategy_pb_1.FixedStrategy();
|
|
122
|
+
fixedStrategy.setVariation(variation);
|
|
123
|
+
return fixedStrategy;
|
|
124
|
+
}
|
|
125
|
+
function createRolloutStrategy(options) {
|
|
126
|
+
var rolloutStrategy = new strategy_pb_1.RolloutStrategy();
|
|
127
|
+
var variations = options.variations.map(function (v) {
|
|
128
|
+
var variation = new strategy_pb_1.RolloutStrategy.Variation();
|
|
129
|
+
variation.setVariation(v.variation);
|
|
130
|
+
variation.setWeight(v.weight);
|
|
131
|
+
return variation;
|
|
132
|
+
});
|
|
133
|
+
rolloutStrategy.setVariationsList(variations);
|
|
134
|
+
return rolloutStrategy;
|
|
135
|
+
}
|
|
136
|
+
function createStrategy(options) {
|
|
137
|
+
var strategy = new strategy_pb_1.Strategy();
|
|
138
|
+
strategy.setType(options.type);
|
|
139
|
+
strategy.setFixedStrategy(options.fixedStrategy);
|
|
140
|
+
strategy.setRolloutStrategy(options.rolloutStrategy);
|
|
141
|
+
return strategy;
|
|
142
|
+
}
|
|
143
|
+
//TODO: FIX ME - Rule should have a constructor that accepts all the parameters
|
|
144
|
+
//Current is missing many parameters
|
|
145
|
+
function createRule(id, attribute, operator, values, fixedVariation) {
|
|
146
|
+
var rule = new rule_pb_1.Rule();
|
|
147
|
+
rule.setId(id);
|
|
148
|
+
var fixedStrategy = createFixedStrategy(fixedVariation);
|
|
149
|
+
var strategy = createStrategy({
|
|
150
|
+
type: strategy_pb_1.Strategy.Type.FIXED,
|
|
151
|
+
fixedStrategy: fixedStrategy
|
|
152
|
+
});
|
|
153
|
+
rule.setStrategy(strategy);
|
|
154
|
+
rule.setClausesList([createClause(id, attribute, operator, values)]);
|
|
155
|
+
return rule;
|
|
156
|
+
}
|
|
157
|
+
function createClause(id, attribute, operator, values) {
|
|
158
|
+
var clause = new clause_pb_1.Clause();
|
|
159
|
+
clause.setId(id);
|
|
160
|
+
clause.setAttribute(attribute);
|
|
161
|
+
clause.setOperator(operator);
|
|
162
|
+
clause.setValuesList(values);
|
|
163
|
+
return clause;
|
|
164
|
+
}
|
|
165
|
+
function createSegmentUser(userId, segmentId, state) {
|
|
166
|
+
var segmentUser = new segment_pb_1.SegmentUser();
|
|
167
|
+
segmentUser.setUserId(userId);
|
|
168
|
+
segmentUser.setSegmentId(segmentId);
|
|
169
|
+
segmentUser.setState(state);
|
|
170
|
+
return segmentUser;
|
|
171
|
+
}
|
|
172
|
+
function createPrerequisite(featureId, variationId) {
|
|
173
|
+
var prerequisite = new prerequisite_pb_1.Prerequisite();
|
|
174
|
+
prerequisite.setFeatureId(featureId);
|
|
175
|
+
prerequisite.setVariationId(variationId);
|
|
176
|
+
return prerequisite;
|
|
177
|
+
}
|
|
178
|
+
// Function to create a Variation instance with the provided parameters
|
|
179
|
+
function createVariation(id, value, name, description) {
|
|
180
|
+
var variation = new variation_pb_1.Variation();
|
|
181
|
+
variation.setId(id);
|
|
182
|
+
variation.setValue(value);
|
|
183
|
+
variation.setName(name);
|
|
184
|
+
variation.setDescription(description);
|
|
185
|
+
return variation;
|
|
186
|
+
}
|
|
187
|
+
function createEvaluation(id, featureId, featureVersion, userId, variationId, variationValue, variationName, reason) {
|
|
188
|
+
var evaluation = new evaluation_pb_1.Evaluation();
|
|
189
|
+
evaluation.setId(id);
|
|
190
|
+
evaluation.setFeatureId(featureId);
|
|
191
|
+
evaluation.setFeatureVersion(featureVersion);
|
|
192
|
+
evaluation.setUserId(userId);
|
|
193
|
+
evaluation.setVariationId(variationId);
|
|
194
|
+
evaluation.setVariationValue(variationValue);
|
|
195
|
+
evaluation.setVariationName(variationName);
|
|
196
|
+
evaluation.setReason(reason);
|
|
197
|
+
return evaluation;
|
|
198
|
+
}
|
|
199
|
+
//TODO: should we set the ruleId to empty string as default?
|
|
200
|
+
//TODO: create optional constructor for Reason
|
|
201
|
+
function createReason(ruleId, type) {
|
|
202
|
+
var reason = new reason_pb_1.Reason();
|
|
203
|
+
reason.setType(type);
|
|
204
|
+
reason.setRuleId(ruleId);
|
|
205
|
+
return reason;
|
|
206
|
+
}
|