configcat-vue 1.2.2 → 1.3.0
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/configcat-vue.js +809 -691
- package/dist/configcat-vue.umd.cjs +7 -7
- package/package.json +3 -3
package/dist/configcat-vue.js
CHANGED
|
@@ -1,75 +1,30 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
for (const [n, i] of e)
|
|
5
|
-
r[n] = i;
|
|
6
|
-
return r;
|
|
7
|
-
}, Ge = {
|
|
8
|
-
emits: ["flagValueChanged"],
|
|
9
|
-
props: {
|
|
10
|
-
featureKey: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: !0
|
|
13
|
-
},
|
|
14
|
-
userObject: {
|
|
15
|
-
type: Object,
|
|
16
|
-
required: !1,
|
|
17
|
-
default: {}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
data() {
|
|
21
|
-
return {
|
|
22
|
-
isFeatureFlagEnabled: !1
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
mounted() {
|
|
26
|
-
this.configCatClient.getValueAsync(this.featureKey, !1, this.userObject).then((t) => {
|
|
27
|
-
this.isFeatureFlagEnabled = t;
|
|
28
|
-
}), this.configCatClient.on("configChanged", (t) => {
|
|
29
|
-
const e = t.settings[this.featureKey].value;
|
|
30
|
-
this.isFeatureFlagEnabled = e, this.$emit("flagValueChanged", e);
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
unmounted() {
|
|
34
|
-
this.configCatClient.dispose();
|
|
35
|
-
}
|
|
36
|
-
}, Je = { key: 0 }, $e = { key: 1 };
|
|
37
|
-
function Ye(t, e, r, n, i, o) {
|
|
38
|
-
return se(), ae("div", null, [
|
|
39
|
-
i.isFeatureFlagEnabled ? (se(), ae("div", Je, [
|
|
40
|
-
de(t.$slots, "default")
|
|
41
|
-
])) : (se(), ae("div", $e, [
|
|
42
|
-
de(t.$slots, "else")
|
|
43
|
-
]))
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
const Ut = /* @__PURE__ */ Be(Ge, [["render", Ye]]);
|
|
47
|
-
var ue = function(t, e) {
|
|
48
|
-
return ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
1
|
+
import { openBlock as Q, createElementBlock as ee, renderSlot as ge } from "vue";
|
|
2
|
+
var pe = function(t, e) {
|
|
3
|
+
return pe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
49
4
|
r.__proto__ = n;
|
|
50
5
|
} || function(r, n) {
|
|
51
6
|
for (var i in n)
|
|
52
7
|
Object.prototype.hasOwnProperty.call(n, i) && (r[i] = n[i]);
|
|
53
|
-
},
|
|
8
|
+
}, pe(t, e);
|
|
54
9
|
};
|
|
55
|
-
function
|
|
10
|
+
function B(t, e) {
|
|
56
11
|
if (typeof e != "function" && e !== null)
|
|
57
12
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
58
|
-
|
|
13
|
+
pe(t, e);
|
|
59
14
|
function r() {
|
|
60
15
|
this.constructor = t;
|
|
61
16
|
}
|
|
62
17
|
t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r());
|
|
63
18
|
}
|
|
64
|
-
var
|
|
65
|
-
return
|
|
19
|
+
var k = function() {
|
|
20
|
+
return k = Object.assign || function(e) {
|
|
66
21
|
for (var r, n = 1, i = arguments.length; n < i; n++) {
|
|
67
22
|
r = arguments[n];
|
|
68
23
|
for (var o in r)
|
|
69
24
|
Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
|
|
70
25
|
}
|
|
71
26
|
return e;
|
|
72
|
-
},
|
|
27
|
+
}, k.apply(this, arguments);
|
|
73
28
|
};
|
|
74
29
|
function S(t, e, r, n) {
|
|
75
30
|
function i(o) {
|
|
@@ -80,22 +35,22 @@ function S(t, e, r, n) {
|
|
|
80
35
|
return new (r || (r = Promise))(function(o, s) {
|
|
81
36
|
function a(l) {
|
|
82
37
|
try {
|
|
83
|
-
|
|
84
|
-
} catch (
|
|
85
|
-
s(
|
|
38
|
+
u(n.next(l));
|
|
39
|
+
} catch (h) {
|
|
40
|
+
s(h);
|
|
86
41
|
}
|
|
87
42
|
}
|
|
88
|
-
function
|
|
43
|
+
function c(l) {
|
|
89
44
|
try {
|
|
90
|
-
|
|
91
|
-
} catch (
|
|
92
|
-
s(
|
|
45
|
+
u(n.throw(l));
|
|
46
|
+
} catch (h) {
|
|
47
|
+
s(h);
|
|
93
48
|
}
|
|
94
49
|
}
|
|
95
|
-
function
|
|
96
|
-
l.done ? o(l.value) : i(l.value).then(a,
|
|
50
|
+
function u(l) {
|
|
51
|
+
l.done ? o(l.value) : i(l.value).then(a, c);
|
|
97
52
|
}
|
|
98
|
-
|
|
53
|
+
u((n = n.apply(t, e || [])).next());
|
|
99
54
|
});
|
|
100
55
|
}
|
|
101
56
|
function O(t, e) {
|
|
@@ -107,76 +62,78 @@ function O(t, e) {
|
|
|
107
62
|
return s = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
108
63
|
return this;
|
|
109
64
|
}), s;
|
|
110
|
-
function a(
|
|
65
|
+
function a(u) {
|
|
111
66
|
return function(l) {
|
|
112
|
-
return
|
|
67
|
+
return c([u, l]);
|
|
113
68
|
};
|
|
114
69
|
}
|
|
115
|
-
function u
|
|
70
|
+
function c(u) {
|
|
116
71
|
if (n)
|
|
117
72
|
throw new TypeError("Generator is already executing.");
|
|
118
|
-
for (; s && (s = 0,
|
|
73
|
+
for (; s && (s = 0, u[0] && (r = 0)), r; )
|
|
119
74
|
try {
|
|
120
|
-
if (n = 1, i && (o =
|
|
75
|
+
if (n = 1, i && (o = u[0] & 2 ? i.return : u[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, u[1])).done)
|
|
121
76
|
return o;
|
|
122
|
-
switch (i = 0, o && (
|
|
77
|
+
switch (i = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
|
|
123
78
|
case 0:
|
|
124
79
|
case 1:
|
|
125
|
-
o =
|
|
80
|
+
o = u;
|
|
126
81
|
break;
|
|
127
82
|
case 4:
|
|
128
|
-
return r.label++, { value:
|
|
83
|
+
return r.label++, { value: u[1], done: !1 };
|
|
129
84
|
case 5:
|
|
130
|
-
r.label++, i =
|
|
85
|
+
r.label++, i = u[1], u = [0];
|
|
131
86
|
continue;
|
|
132
87
|
case 7:
|
|
133
|
-
|
|
88
|
+
u = r.ops.pop(), r.trys.pop();
|
|
134
89
|
continue;
|
|
135
90
|
default:
|
|
136
|
-
if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (
|
|
91
|
+
if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
137
92
|
r = 0;
|
|
138
93
|
continue;
|
|
139
94
|
}
|
|
140
|
-
if (
|
|
141
|
-
r.label =
|
|
95
|
+
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
|
96
|
+
r.label = u[1];
|
|
142
97
|
break;
|
|
143
98
|
}
|
|
144
|
-
if (
|
|
145
|
-
r.label = o[1], o =
|
|
99
|
+
if (u[0] === 6 && r.label < o[1]) {
|
|
100
|
+
r.label = o[1], o = u;
|
|
146
101
|
break;
|
|
147
102
|
}
|
|
148
103
|
if (o && r.label < o[2]) {
|
|
149
|
-
r.label = o[2], r.ops.push(
|
|
104
|
+
r.label = o[2], r.ops.push(u);
|
|
150
105
|
break;
|
|
151
106
|
}
|
|
152
107
|
o[2] && r.ops.pop(), r.trys.pop();
|
|
153
108
|
continue;
|
|
154
109
|
}
|
|
155
|
-
|
|
110
|
+
u = e.call(t, r);
|
|
156
111
|
} catch (l) {
|
|
157
|
-
|
|
112
|
+
u = [6, l], i = 0;
|
|
158
113
|
} finally {
|
|
159
114
|
n = o = 0;
|
|
160
115
|
}
|
|
161
|
-
if (
|
|
162
|
-
throw
|
|
163
|
-
return { value:
|
|
116
|
+
if (u[0] & 5)
|
|
117
|
+
throw u[1];
|
|
118
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
164
119
|
}
|
|
165
120
|
}
|
|
166
|
-
function
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
121
|
+
function $e() {
|
|
122
|
+
for (var t = 0, e = 0, r = arguments.length; e < r; e++)
|
|
123
|
+
t += arguments[e].length;
|
|
124
|
+
for (var n = Array(t), i = 0, e = 0; e < r; e++)
|
|
125
|
+
for (var o = arguments[e], s = 0, a = o.length; s < a; s++, i++)
|
|
126
|
+
n[i] = o[s];
|
|
127
|
+
return n;
|
|
171
128
|
}
|
|
172
|
-
function
|
|
129
|
+
function C(t, e) {
|
|
173
130
|
return Object.defineProperty ? Object.defineProperty(t, "raw", { value: e }) : t.raw = e, t;
|
|
174
131
|
}
|
|
175
132
|
var K;
|
|
176
133
|
(function(t) {
|
|
177
134
|
t[t.Fetched = 0] = "Fetched", t[t.NotModified = 1] = "NotModified", t[t.Errored = 2] = "Errored";
|
|
178
135
|
})(K || (K = {}));
|
|
179
|
-
var
|
|
136
|
+
var q = function() {
|
|
180
137
|
function t(e, r, n, i) {
|
|
181
138
|
this.status = e, this.config = r, this.errorMessage = n, this.errorException = i;
|
|
182
139
|
}
|
|
@@ -187,35 +144,35 @@ var x = function() {
|
|
|
187
144
|
}, t.error = function(e, r, n) {
|
|
188
145
|
return new t(K.Errored, e, r ?? "Unknown error.", n);
|
|
189
146
|
}, t;
|
|
190
|
-
}(),
|
|
191
|
-
|
|
147
|
+
}(), ie = function(t) {
|
|
148
|
+
B(e, t);
|
|
192
149
|
function e(r) {
|
|
193
150
|
for (var n = [], i = 1; i < arguments.length; i++)
|
|
194
151
|
n[i - 1] = arguments[i];
|
|
195
|
-
var o = this, s
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return o = t.call(this, s) || this, o.cause = r, o instanceof e || (Object.setPrototypeOf || function(c, l) {
|
|
210
|
-
return c.__proto__ = l;
|
|
152
|
+
var o = t.call(this, function(s, a) {
|
|
153
|
+
switch (s) {
|
|
154
|
+
case "abort":
|
|
155
|
+
return "Request was aborted.";
|
|
156
|
+
case "timeout":
|
|
157
|
+
var c = a[0];
|
|
158
|
+
return "Request timed out. Timeout value: " + c + "ms";
|
|
159
|
+
case "failure":
|
|
160
|
+
var u = a[0], l = "Request failed due to a network or protocol error.";
|
|
161
|
+
return u ? l + " " + (u instanceof Error ? u.message : u + "") : l;
|
|
162
|
+
}
|
|
163
|
+
}(r, n)) || this;
|
|
164
|
+
return o.cause = r, o instanceof e || (Object.setPrototypeOf || function(s, a) {
|
|
165
|
+
return s.__proto__ = a;
|
|
211
166
|
})(o, e.prototype), o.args = n, o;
|
|
212
167
|
}
|
|
213
168
|
return e;
|
|
214
|
-
}(Error),
|
|
169
|
+
}(Error), M = function() {
|
|
215
170
|
function t(e, r, n, i) {
|
|
216
171
|
this.configJson = e, this.config = r, this.timestamp = n, this.httpETag = i;
|
|
217
172
|
}
|
|
218
|
-
return t.
|
|
173
|
+
return t.equals = function(e, r) {
|
|
174
|
+
return e.httpETag && r.httpETag ? e.httpETag === r.httpETag : e.configJson === r.configJson;
|
|
175
|
+
}, t.prototype.with = function(e) {
|
|
219
176
|
return new t(this.configJson, this.config, e, this.httpETag);
|
|
220
177
|
}, Object.defineProperty(t.prototype, "isEmpty", {
|
|
221
178
|
get: function() {
|
|
@@ -243,47 +200,47 @@ var x = function() {
|
|
|
243
200
|
if (isNaN(a))
|
|
244
201
|
throw new Error("Invalid fetch time: " + s);
|
|
245
202
|
n = o + 1, o = r[1], s = e.substring(n, o);
|
|
246
|
-
var
|
|
203
|
+
var c = s.length > 0 ? s : void 0;
|
|
247
204
|
n = o + 1, s = e.substring(n);
|
|
248
|
-
var
|
|
205
|
+
var u, l;
|
|
249
206
|
if (s.length > 0) {
|
|
250
207
|
try {
|
|
251
|
-
|
|
208
|
+
u = new de(JSON.parse(s));
|
|
252
209
|
} catch {
|
|
253
210
|
throw new Error("Invalid config JSON content: " + s);
|
|
254
211
|
}
|
|
255
212
|
l = s;
|
|
256
213
|
}
|
|
257
|
-
return new t(l,
|
|
214
|
+
return new t(l, u, a, c);
|
|
258
215
|
}, t.serializationFormatVersion = "v2", t.empty = new t(void 0, void 0, 0, void 0), t;
|
|
259
|
-
}(),
|
|
216
|
+
}(), de = function() {
|
|
260
217
|
function t(e) {
|
|
261
218
|
this.settings = e.f ? Object.fromEntries(Object.entries(e.f).map(function(r) {
|
|
262
219
|
var n = r[0], i = r[1];
|
|
263
|
-
return [n, new
|
|
264
|
-
})) : {}, this.preferences = e.p ? new
|
|
220
|
+
return [n, new ze(i)];
|
|
221
|
+
})) : {}, this.preferences = e.p ? new Ye(e.p) : void 0;
|
|
265
222
|
}
|
|
266
223
|
return t;
|
|
267
|
-
}(),
|
|
224
|
+
}(), X;
|
|
268
225
|
(function(t) {
|
|
269
226
|
t[t.No = 0] = "No", t[t.Should = 1] = "Should", t[t.Force = 2] = "Force";
|
|
270
|
-
})(
|
|
271
|
-
var
|
|
227
|
+
})(X || (X = {}));
|
|
228
|
+
var Ye = function() {
|
|
272
229
|
function t(e) {
|
|
273
230
|
this.baseUrl = e.u, this.redirectMode = e.r;
|
|
274
231
|
}
|
|
275
232
|
return t;
|
|
276
|
-
}(),
|
|
233
|
+
}(), Se;
|
|
277
234
|
(function(t) {
|
|
278
235
|
t[t.Boolean = 0] = "Boolean", t[t.String = 1] = "String", t[t.Int = 2] = "Int", t[t.Double = 3] = "Double";
|
|
279
|
-
})(
|
|
280
|
-
var
|
|
236
|
+
})(Se || (Se = {}));
|
|
237
|
+
var ze = function() {
|
|
281
238
|
function t(e) {
|
|
282
239
|
var r, n, i, o;
|
|
283
240
|
this.value = e.v, this.type = e.t, this.percentageOptions = (n = (r = e.p) === null || r === void 0 ? void 0 : r.map(function(s) {
|
|
284
|
-
return new
|
|
241
|
+
return new Ze(s);
|
|
285
242
|
})) !== null && n !== void 0 ? n : [], this.targetingRules = (o = (i = e.r) === null || i === void 0 ? void 0 : i.map(function(s) {
|
|
286
|
-
return new
|
|
243
|
+
return new Xe(s);
|
|
287
244
|
})) !== null && o !== void 0 ? o : [], this.variationId = e.i;
|
|
288
245
|
}
|
|
289
246
|
return t.fromValue = function(e) {
|
|
@@ -292,21 +249,21 @@ var Qe = function() {
|
|
|
292
249
|
v: e
|
|
293
250
|
});
|
|
294
251
|
}, t;
|
|
295
|
-
}(),
|
|
252
|
+
}(), g;
|
|
296
253
|
(function(t) {
|
|
297
254
|
t[t.In = 0] = "In", t[t.NotIn = 1] = "NotIn", t[t.Contains = 2] = "Contains", t[t.NotContains = 3] = "NotContains", t[t.SemVerIn = 4] = "SemVerIn", t[t.SemVerNotIn = 5] = "SemVerNotIn", t[t.SemVerLessThan = 6] = "SemVerLessThan", t[t.SemVerLessThanEqual = 7] = "SemVerLessThanEqual", t[t.SemVerGreaterThan = 8] = "SemVerGreaterThan", t[t.SemVerGreaterThanEqual = 9] = "SemVerGreaterThanEqual", t[t.NumberEqual = 10] = "NumberEqual", t[t.NumberNotEqual = 11] = "NumberNotEqual", t[t.NumberLessThan = 12] = "NumberLessThan", t[t.NumberLessThanEqual = 13] = "NumberLessThanEqual", t[t.NumberGreaterThan = 14] = "NumberGreaterThan", t[t.NumberGreaterThanEqual = 15] = "NumberGreaterThanEqual", t[t.SensitiveOneOf = 16] = "SensitiveOneOf", t[t.SensitiveNotOneOf = 17] = "SensitiveNotOneOf";
|
|
298
|
-
})(
|
|
299
|
-
var
|
|
255
|
+
})(g || (g = {}));
|
|
256
|
+
var Xe = function() {
|
|
300
257
|
function t(e) {
|
|
301
258
|
this.order = e.o, this.comparisonAttribute = e.a, this.comparator = e.t, this.comparisonValue = e.c, this.value = e.v, this.variationId = e.i;
|
|
302
259
|
}
|
|
303
260
|
return t;
|
|
304
|
-
}(),
|
|
261
|
+
}(), Ze = function() {
|
|
305
262
|
function t(e) {
|
|
306
263
|
this.order = e.o, this.percentage = e.p, this.value = e.v, this.variationId = e.i;
|
|
307
264
|
}
|
|
308
265
|
return t;
|
|
309
|
-
}(),
|
|
266
|
+
}(), ae = function() {
|
|
310
267
|
function t(e, r) {
|
|
311
268
|
this.errorMessage = e, this.errorException = r;
|
|
312
269
|
}
|
|
@@ -323,19 +280,19 @@ var et = function() {
|
|
|
323
280
|
}, t.failure = function(e, r) {
|
|
324
281
|
return new t(e, r);
|
|
325
282
|
}, t;
|
|
326
|
-
}(),
|
|
283
|
+
}(), T;
|
|
327
284
|
(function(t) {
|
|
328
285
|
t[t.Online = 0] = "Online", t[t.Offline = 1] = "Offline", t[t.Disposed = 2] = "Disposed";
|
|
329
|
-
})(
|
|
330
|
-
var
|
|
286
|
+
})(T || (T = {}));
|
|
287
|
+
var me = function() {
|
|
331
288
|
function t(e, r) {
|
|
332
|
-
this.configFetcher = e, this.options = r, this.pendingFetch = null, this.cacheKey = r.getCacheKey(), this.configFetcher = e, this.options = r, this.status = r.offline ?
|
|
289
|
+
this.configFetcher = e, this.options = r, this.pendingFetch = null, this.cacheKey = r.getCacheKey(), this.configFetcher = e, this.options = r, this.status = r.offline ? T.Offline : T.Online;
|
|
333
290
|
}
|
|
334
291
|
return t.prototype.dispose = function() {
|
|
335
|
-
this.status =
|
|
292
|
+
this.status = T.Disposed;
|
|
336
293
|
}, Object.defineProperty(t.prototype, "disposed", {
|
|
337
294
|
get: function() {
|
|
338
|
-
return this.status ===
|
|
295
|
+
return this.status === T.Disposed;
|
|
339
296
|
},
|
|
340
297
|
enumerable: !1,
|
|
341
298
|
configurable: !0
|
|
@@ -349,9 +306,9 @@ var ge = function() {
|
|
|
349
306
|
case 1:
|
|
350
307
|
return e = s.sent(), this.isOffline ? [3, 3] : [4, this.refreshConfigCoreAsync(e)];
|
|
351
308
|
case 2:
|
|
352
|
-
return r = s.sent(), n = r[0], i = r[1], [2, [
|
|
309
|
+
return r = s.sent(), n = r[0], i = r[1], [2, [ae.from(n), i]];
|
|
353
310
|
case 3:
|
|
354
|
-
return o = this.options.logger.configServiceCannotInitiateHttpCalls().toString(), [2, [
|
|
311
|
+
return o = this.options.logger.configServiceCannotInitiateHttpCalls().toString(), [2, [ae.failure(o), e]];
|
|
355
312
|
}
|
|
356
313
|
});
|
|
357
314
|
});
|
|
@@ -365,7 +322,7 @@ var ge = function() {
|
|
|
365
322
|
case 1:
|
|
366
323
|
return r = i.sent(), n = r.status === K.Fetched, n || r.config.timestamp > e.timestamp && (!r.config.isEmpty || e.isEmpty) ? [4, this.options.cache.set(this.cacheKey, r.config)] : [3, 3];
|
|
367
324
|
case 2:
|
|
368
|
-
i.sent(), this.onConfigUpdated(r.config), n && (r.config
|
|
325
|
+
i.sent(), this.onConfigUpdated(r.config), n && !M.equals(r.config, e) && this.onConfigChanged(r.config), e = r.config, i.label = 3;
|
|
369
326
|
case 3:
|
|
370
327
|
return [2, [r, e]];
|
|
371
328
|
}
|
|
@@ -374,7 +331,7 @@ var ge = function() {
|
|
|
374
331
|
}, t.prototype.onConfigUpdated = function(e) {
|
|
375
332
|
}, t.prototype.onConfigChanged = function(e) {
|
|
376
333
|
var r;
|
|
377
|
-
this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (r = e.config) !== null && r !== void 0 ? r : new
|
|
334
|
+
this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (r = e.config) !== null && r !== void 0 ? r : new de({}));
|
|
378
335
|
}, t.prototype.fetchAsync = function(e) {
|
|
379
336
|
var r = this, n;
|
|
380
337
|
return (n = this.pendingFetch) !== null && n !== void 0 ? n : this.pendingFetch = function() {
|
|
@@ -396,28 +353,28 @@ var ge = function() {
|
|
|
396
353
|
}, t.prototype.fetchLogicAsync = function(e) {
|
|
397
354
|
var r;
|
|
398
355
|
return S(this, void 0, void 0, function() {
|
|
399
|
-
var n, i, o, s, a,
|
|
400
|
-
return O(this, function(
|
|
401
|
-
switch (
|
|
356
|
+
var n, i, o, s, a, c;
|
|
357
|
+
return O(this, function(u) {
|
|
358
|
+
switch (u.label) {
|
|
402
359
|
case 0:
|
|
403
|
-
n = this.options, n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called."),
|
|
360
|
+
n = this.options, n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called."), u.label = 1;
|
|
404
361
|
case 1:
|
|
405
|
-
return
|
|
362
|
+
return u.trys.push([1, 3, , 4]), [4, this.fetchRequestAsync((r = e.httpETag) !== null && r !== void 0 ? r : null)];
|
|
406
363
|
case 2:
|
|
407
|
-
switch (o =
|
|
364
|
+
switch (o = u.sent(), s = o[0], a = o[1], s.statusCode) {
|
|
408
365
|
case 200:
|
|
409
|
-
return a ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), [2,
|
|
366
|
+
return a ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), [2, q.success(new M(s.body, a, M.generateTimestamp(), s.eTag))]) : (i = n.logger.fetchReceived200WithInvalidBody().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received but the HTTP response content was invalid. Returning null."), [2, q.error(e, i)]);
|
|
410
367
|
case 304:
|
|
411
|
-
return e ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), [2,
|
|
368
|
+
return e ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), [2, q.notModified(e.with(M.generateTimestamp()))]) : (i = n.logger.fetchReceived304WhenLocalCacheIsEmpty(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received when no config is cached locally. Returning null."), [2, q.error(e, i)]);
|
|
412
369
|
case 403:
|
|
413
370
|
case 404:
|
|
414
|
-
return i = n.logger.fetchFailedDueToInvalidSdkKey().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."), [2,
|
|
371
|
+
return i = n.logger.fetchFailedDueToInvalidSdkKey().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."), [2, q.error(e.with(M.generateTimestamp()), i)];
|
|
415
372
|
default:
|
|
416
|
-
return i = n.logger.fetchFailedDueToUnexpectedHttpResponse(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2,
|
|
373
|
+
return i = n.logger.fetchFailedDueToUnexpectedHttpResponse(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i)];
|
|
417
374
|
}
|
|
418
375
|
return [3, 4];
|
|
419
376
|
case 3:
|
|
420
|
-
return
|
|
377
|
+
return c = u.sent(), i = (c instanceof ie && c.cause === "timeout" ? n.logger.fetchFailedDueToRequestTimeout(c.args[0], c) : n.logger.fetchFailedDueToUnexpectedError(c)).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i, c)];
|
|
421
378
|
case 4:
|
|
422
379
|
return [2];
|
|
423
380
|
}
|
|
@@ -425,13 +382,13 @@ var ge = function() {
|
|
|
425
382
|
});
|
|
426
383
|
}, t.prototype.fetchRequestAsync = function(e, r) {
|
|
427
384
|
return r === void 0 && (r = 2), S(this, void 0, void 0, function() {
|
|
428
|
-
var n, i, o, s, a,
|
|
385
|
+
var n, i, o, s, a, c, u;
|
|
429
386
|
return O(this, function(l) {
|
|
430
387
|
switch (l.label) {
|
|
431
388
|
case 0:
|
|
432
389
|
n = this.options, n.logger.debug("ConfigServiceBase.fetchRequestAsync() - called."), i = 0, l.label = 1;
|
|
433
390
|
case 1:
|
|
434
|
-
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()"
|
|
391
|
+
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()" + (i > 0 ? ", retry " + i + "/" + r : "")), [4, this.configFetcher.fetchLogic(n, e)];
|
|
435
392
|
case 2:
|
|
436
393
|
if (o = l.sent(), o.statusCode !== 200)
|
|
437
394
|
return [2, [o]];
|
|
@@ -439,19 +396,19 @@ var ge = function() {
|
|
|
439
396
|
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."), [2, [o]];
|
|
440
397
|
s = void 0;
|
|
441
398
|
try {
|
|
442
|
-
s = new
|
|
399
|
+
s = new de(JSON.parse(o.body));
|
|
443
400
|
} catch {
|
|
444
401
|
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."), [2, [o]];
|
|
445
402
|
}
|
|
446
403
|
if (a = s.preferences, !a)
|
|
447
404
|
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): preferences is empty."), [2, [o, s]];
|
|
448
|
-
if (
|
|
405
|
+
if (c = a.baseUrl, !c || c === n.baseUrl)
|
|
449
406
|
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): baseUrl OK."), [2, [o, s]];
|
|
450
|
-
if (
|
|
407
|
+
if (u = a.redirectMode, n.baseUrlOverriden && u !== X.Force)
|
|
451
408
|
return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): options.baseUrlOverriden && redirect !== 2."), [2, [o, s]];
|
|
452
|
-
if (n.baseUrl =
|
|
409
|
+
if (n.baseUrl = c, u === X.No)
|
|
453
410
|
return [2, [o, s]];
|
|
454
|
-
if (
|
|
411
|
+
if (u === X.Should && n.logger.dataGovernanceIsOutOfSync(), i >= r)
|
|
455
412
|
return n.logger.fetchFailedDueToRedirectLoop(), [2, [o, s]];
|
|
456
413
|
l.label = 3;
|
|
457
414
|
case 3:
|
|
@@ -463,25 +420,88 @@ var ge = function() {
|
|
|
463
420
|
});
|
|
464
421
|
}, Object.defineProperty(t.prototype, "isOfflineExactly", {
|
|
465
422
|
get: function() {
|
|
466
|
-
return this.status ===
|
|
423
|
+
return this.status === T.Offline;
|
|
467
424
|
},
|
|
468
425
|
enumerable: !1,
|
|
469
426
|
configurable: !0
|
|
470
427
|
}), Object.defineProperty(t.prototype, "isOffline", {
|
|
471
428
|
get: function() {
|
|
472
|
-
return this.status !==
|
|
429
|
+
return this.status !== T.Online;
|
|
473
430
|
},
|
|
474
431
|
enumerable: !1,
|
|
475
432
|
configurable: !0
|
|
476
433
|
}), t.prototype.setOnlineCore = function() {
|
|
477
434
|
}, t.prototype.setOnline = function() {
|
|
478
|
-
this.status ===
|
|
435
|
+
this.status === T.Offline ? (this.setOnlineCore(), this.status = T.Online, this.options.logger.configServiceStatusChanged(T[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOnline");
|
|
479
436
|
}, t.prototype.setOfflineCore = function() {
|
|
480
437
|
}, t.prototype.setOffline = function() {
|
|
481
|
-
this.status ===
|
|
438
|
+
this.status === T.Online ? (this.setOfflineCore(), this.status = T.Offline, this.options.logger.configServiceStatusChanged(T[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOffline");
|
|
439
|
+
}, t.prototype.syncUpWithCache = function() {
|
|
440
|
+
return S(this, void 0, void 0, function() {
|
|
441
|
+
var e;
|
|
442
|
+
return O(this, function(r) {
|
|
443
|
+
switch (r.label) {
|
|
444
|
+
case 0:
|
|
445
|
+
return [4, this.options.cache.get(this.cacheKey)];
|
|
446
|
+
case 1:
|
|
447
|
+
return e = r.sent(), this.options.hooks.emit("clientReady", this.getReadyState(e)), [2];
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
}, t;
|
|
452
|
+
}(), Qe = function() {
|
|
453
|
+
function t() {
|
|
454
|
+
this.addListener = this.on, this.off = this.removeListener;
|
|
455
|
+
}
|
|
456
|
+
return t.prototype.on = function() {
|
|
457
|
+
return this;
|
|
458
|
+
}, t.prototype.once = function() {
|
|
459
|
+
return this;
|
|
460
|
+
}, t.prototype.removeListener = function() {
|
|
461
|
+
return this;
|
|
462
|
+
}, t.prototype.removeAllListeners = function() {
|
|
463
|
+
return this;
|
|
464
|
+
}, t.prototype.listeners = function() {
|
|
465
|
+
return [];
|
|
466
|
+
}, t.prototype.listenerCount = function() {
|
|
467
|
+
return 0;
|
|
468
|
+
}, t.prototype.eventNames = function() {
|
|
469
|
+
return [];
|
|
470
|
+
}, t.prototype.emit = function() {
|
|
471
|
+
return !1;
|
|
472
|
+
}, t;
|
|
473
|
+
}(), L;
|
|
474
|
+
(function(t) {
|
|
475
|
+
t[t.NoFlagData = 0] = "NoFlagData", t[t.HasLocalOverrideFlagDataOnly = 1] = "HasLocalOverrideFlagDataOnly", t[t.HasCachedFlagDataOnly = 2] = "HasCachedFlagDataOnly", t[t.HasUpToDateFlagData = 3] = "HasUpToDateFlagData";
|
|
476
|
+
})(L || (L = {}));
|
|
477
|
+
var Oe = new Qe(), et = function() {
|
|
478
|
+
function t(e) {
|
|
479
|
+
this.addListener = this.on, this.off = this.removeListener, this.eventEmitter = e;
|
|
480
|
+
}
|
|
481
|
+
return t.prototype.tryDisconnect = function() {
|
|
482
|
+
var e = this.eventEmitter;
|
|
483
|
+
return this.eventEmitter = Oe, e !== Oe;
|
|
484
|
+
}, t.prototype.on = function(e, r) {
|
|
485
|
+
return this.eventEmitter.on(e, r), this;
|
|
486
|
+
}, t.prototype.once = function(e, r) {
|
|
487
|
+
return this.eventEmitter.once(e, r), this;
|
|
488
|
+
}, t.prototype.removeListener = function(e, r) {
|
|
489
|
+
return this.eventEmitter.removeListener(e, r), this;
|
|
490
|
+
}, t.prototype.removeAllListeners = function(e) {
|
|
491
|
+
return this.eventEmitter.removeAllListeners(e), this;
|
|
492
|
+
}, t.prototype.listeners = function(e) {
|
|
493
|
+
return this.eventEmitter.listeners(e);
|
|
494
|
+
}, t.prototype.listenerCount = function(e) {
|
|
495
|
+
return this.eventEmitter.listenerCount(e);
|
|
496
|
+
}, t.prototype.eventNames = function() {
|
|
497
|
+
return this.eventEmitter.eventNames();
|
|
498
|
+
}, t.prototype.emit = function(e) {
|
|
499
|
+
for (var r, n = [], i = 1; i < arguments.length; i++)
|
|
500
|
+
n[i - 1] = arguments[i];
|
|
501
|
+
return (r = this.eventEmitter).emit.apply(r, $e([e], n));
|
|
482
502
|
}, t;
|
|
483
503
|
}();
|
|
484
|
-
function
|
|
504
|
+
function tt(t, e) {
|
|
485
505
|
var r, n = new Promise(function(i) {
|
|
486
506
|
return r = setTimeout(i, t);
|
|
487
507
|
});
|
|
@@ -489,11 +509,11 @@ function rt(t, e) {
|
|
|
489
509
|
return clearTimeout(r);
|
|
490
510
|
}), n;
|
|
491
511
|
}
|
|
492
|
-
function
|
|
512
|
+
function z(t, e) {
|
|
493
513
|
return e === void 0 && (e = !1), t instanceof Error ? e && t.stack ? t.stack : t.toString() : t + "";
|
|
494
514
|
}
|
|
495
|
-
var
|
|
496
|
-
|
|
515
|
+
var rt = function(t) {
|
|
516
|
+
B(e, t);
|
|
497
517
|
function e(r, n) {
|
|
498
518
|
var i = t.call(this, r, n) || this;
|
|
499
519
|
return i.signalInitialization = function() {
|
|
@@ -502,10 +522,10 @@ var nt = function(t) {
|
|
|
502
522
|
i.initialized = !0, o();
|
|
503
523
|
};
|
|
504
524
|
}), i.initialization.then(function() {
|
|
505
|
-
return
|
|
525
|
+
return n.hooks.emit("clientReady", i.getReadyState(n.cache.getInMemory()));
|
|
506
526
|
}), n.maxInitWaitTimeSeconds > 0 && setTimeout(function() {
|
|
507
527
|
return i.signalInitialization();
|
|
508
|
-
}, n.maxInitWaitTimeSeconds * 1e3)) : (i.initialized = !0, i.initialization = Promise.resolve(), n.hooks.emit("clientReady")), n.offline || i.startRefreshWorker(), i;
|
|
528
|
+
}, n.maxInitWaitTimeSeconds * 1e3)) : (i.initialized = !0, i.initialization = Promise.resolve(), n.hooks.emit("clientReady", i.getReadyState(n.cache.getInMemory()))), n.offline || i.startRefreshWorker(), i;
|
|
509
529
|
}
|
|
510
530
|
return e.prototype.waitForInitializationAsync = function() {
|
|
511
531
|
return S(this, void 0, void 0, function() {
|
|
@@ -530,7 +550,7 @@ var nt = function(t) {
|
|
|
530
550
|
});
|
|
531
551
|
});
|
|
532
552
|
}(),
|
|
533
|
-
|
|
553
|
+
tt(this.options.maxInitWaitTimeSeconds * 1e3, function(s) {
|
|
534
554
|
return r = s;
|
|
535
555
|
})
|
|
536
556
|
])];
|
|
@@ -612,19 +632,23 @@ var nt = function(t) {
|
|
|
612
632
|
}
|
|
613
633
|
});
|
|
614
634
|
});
|
|
635
|
+
}, e.prototype.getReadyState = function(r) {
|
|
636
|
+
return r.isEmpty ? L.NoFlagData : r.isExpired(this.pollIntervalMs) ? L.HasCachedFlagDataOnly : L.HasUpToDateFlagData;
|
|
615
637
|
}, e;
|
|
616
|
-
}(
|
|
638
|
+
}(me), nt = function() {
|
|
617
639
|
function t() {
|
|
618
|
-
this.cachedConfig =
|
|
640
|
+
this.cachedConfig = M.empty;
|
|
619
641
|
}
|
|
620
642
|
return t.prototype.set = function(e, r) {
|
|
621
643
|
this.cachedConfig = r;
|
|
622
644
|
}, t.prototype.get = function(e) {
|
|
623
645
|
return this.cachedConfig;
|
|
646
|
+
}, t.prototype.getInMemory = function() {
|
|
647
|
+
return this.cachedConfig;
|
|
624
648
|
}, t;
|
|
625
|
-
}(),
|
|
649
|
+
}(), _e = function() {
|
|
626
650
|
function t(e, r) {
|
|
627
|
-
this.cache = e, this.logger = r, this.cachedConfig =
|
|
651
|
+
this.cache = e, this.logger = r, this.cachedConfig = M.empty;
|
|
628
652
|
}
|
|
629
653
|
return t.prototype.set = function(e, r) {
|
|
630
654
|
return S(this, void 0, void 0, function() {
|
|
@@ -633,7 +657,7 @@ var nt = function(t) {
|
|
|
633
657
|
switch (i.label) {
|
|
634
658
|
case 0:
|
|
635
659
|
if (i.trys.push([0, 2, , 3]), !r.isEmpty)
|
|
636
|
-
this.cachedSerializedConfig =
|
|
660
|
+
this.cachedSerializedConfig = M.serialize(r), this.cachedConfig = r;
|
|
637
661
|
else
|
|
638
662
|
return this.cachedSerializedConfig = void 0, this.cachedConfig = r, [2];
|
|
639
663
|
return [4, this.cache.set(e, this.cachedSerializedConfig)];
|
|
@@ -654,7 +678,7 @@ var nt = function(t) {
|
|
|
654
678
|
case 0:
|
|
655
679
|
return i.trys.push([0, 2, , 3]), [4, this.cache.get(e)];
|
|
656
680
|
case 1:
|
|
657
|
-
return r = i.sent(), r == null || r === this.cachedSerializedConfig ? [2, this.cachedConfig] : (this.cachedConfig =
|
|
681
|
+
return r = i.sent(), r == null || r === this.cachedSerializedConfig ? [2, this.cachedConfig] : (this.cachedConfig = M.deserialize(r), this.cachedSerializedConfig = r, [3, 3]);
|
|
658
682
|
case 2:
|
|
659
683
|
return n = i.sent(), this.logger.configServiceCacheReadError(n), [3, 3];
|
|
660
684
|
case 3:
|
|
@@ -662,12 +686,14 @@ var nt = function(t) {
|
|
|
662
686
|
}
|
|
663
687
|
});
|
|
664
688
|
});
|
|
689
|
+
}, t.prototype.getInMemory = function() {
|
|
690
|
+
return this.cachedConfig;
|
|
665
691
|
}, t;
|
|
666
|
-
}(),
|
|
692
|
+
}(), v;
|
|
667
693
|
(function(t) {
|
|
668
694
|
t[t.Debug = 4] = "Debug", t[t.Info = 3] = "Info", t[t.Warn = 2] = "Warn", t[t.Error = 1] = "Error", t[t.Off = -1] = "Off";
|
|
669
|
-
})(
|
|
670
|
-
var
|
|
695
|
+
})(v || (v = {}));
|
|
696
|
+
var A = function() {
|
|
671
697
|
function t(e, r, n) {
|
|
672
698
|
this.strings = e, this.argNames = r, this.argValues = n;
|
|
673
699
|
}
|
|
@@ -695,14 +721,14 @@ var C = function() {
|
|
|
695
721
|
}), t.prototype.toString = function() {
|
|
696
722
|
return this.defaultFormattedMessage;
|
|
697
723
|
}, t;
|
|
698
|
-
}(),
|
|
724
|
+
}(), it = function() {
|
|
699
725
|
function t(e, r) {
|
|
700
726
|
this.logger = e, this.hooks = r;
|
|
701
727
|
}
|
|
702
728
|
return Object.defineProperty(t.prototype, "level", {
|
|
703
729
|
get: function() {
|
|
704
730
|
var e;
|
|
705
|
-
return (e = this.logger.level) !== null && e !== void 0 ? e :
|
|
731
|
+
return (e = this.logger.level) !== null && e !== void 0 ? e : v.Warn;
|
|
706
732
|
},
|
|
707
733
|
enumerable: !1,
|
|
708
734
|
configurable: !0
|
|
@@ -710,72 +736,72 @@ var C = function() {
|
|
|
710
736
|
return this.level >= e;
|
|
711
737
|
}, t.prototype.log = function(e, r, n, i) {
|
|
712
738
|
var o;
|
|
713
|
-
return this.isLogLevelEnabled(e) && this.logger.log(e, r, n, i), e ===
|
|
739
|
+
return this.isLogLevelEnabled(e) && this.logger.log(e, r, n, i), e === v.Error && ((o = this.hooks) === null || o === void 0 || o.emit("clientError", n.toString(), i)), n;
|
|
714
740
|
}, t.prototype.debug = function(e) {
|
|
715
|
-
this.log(
|
|
741
|
+
this.log(v.Debug, 0, e);
|
|
716
742
|
}, t.prototype.configJsonIsNotPresent = function(e) {
|
|
717
|
-
return this.log(
|
|
743
|
+
return this.log(v.Error, 1e3, A.from("DEFAULT_RETURN_VALUE")(Ce || (Ce = C(["Config JSON is not present. Returning ", "."], ["Config JSON is not present. Returning ", "."])), e));
|
|
718
744
|
}, t.prototype.configJsonIsNotPresentSingle = function(e, r, n) {
|
|
719
|
-
return this.log(
|
|
745
|
+
return this.log(v.Error, 1e3, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(Ae || (Ae = C(["Config JSON is not present when evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Config JSON is not present when evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n));
|
|
720
746
|
}, t.prototype.settingEvaluationFailedDueToMissingKey = function(e, r, n, i) {
|
|
721
|
-
return this.log(
|
|
747
|
+
return this.log(v.Error, 1001, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE", "AVAILABLE_KEYS")(we || (we = C(["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the `", "` parameter that you specified in your application: '", "'. Available keys: [", "]."], ["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the \\`", "\\` parameter that you specified in your application: '", "'. Available keys: [", "]."])), e, r, n, i));
|
|
722
748
|
}, t.prototype.settingEvaluationError = function(e, r, n) {
|
|
723
|
-
return this.log(
|
|
749
|
+
return this.log(v.Error, 1002, A.from("METHOD_NAME", "DEFAULT_RETURN_VALUE")(Te || (Te = C(["Error occurred in the `", "` method. Returning ", "."], ["Error occurred in the \\`", "\\` method. Returning ", "."])), e, r), n);
|
|
724
750
|
}, t.prototype.settingEvaluationErrorSingle = function(e, r, n, i, o) {
|
|
725
|
-
return this.log(
|
|
751
|
+
return this.log(v.Error, 1002, A.from("METHOD_NAME", "KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(Ie || (Ie = C(["Error occurred in the `", "` method while evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Error occurred in the \\`", "\\` method while evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n, i), o);
|
|
726
752
|
}, t.prototype.forceRefreshError = function(e, r) {
|
|
727
|
-
return this.log(
|
|
753
|
+
return this.log(v.Error, 1003, A.from("METHOD_NAME")(Ne || (Ne = C(["Error occurred in the `", "` method."], ["Error occurred in the \\`", "\\` method."])), e), r);
|
|
728
754
|
}, t.prototype.fetchFailedDueToInvalidSdkKey = function() {
|
|
729
|
-
return this.log(
|
|
755
|
+
return this.log(v.Error, 1100, "Your SDK Key seems to be wrong. You can find the valid SDK Key at https://app.configcat.com/sdkkey");
|
|
730
756
|
}, t.prototype.fetchFailedDueToUnexpectedHttpResponse = function(e, r) {
|
|
731
|
-
return this.log(
|
|
757
|
+
return this.log(v.Error, 1101, A.from("STATUS_CODE", "REASON_PHRASE")(Re || (Re = C(["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""], ["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""])), e, r));
|
|
732
758
|
}, t.prototype.fetchFailedDueToRequestTimeout = function(e, r) {
|
|
733
|
-
return this.log(
|
|
759
|
+
return this.log(v.Error, 1102, A.from("TIMEOUT")(Le || (Le = C(["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"], ["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"])), e), r);
|
|
734
760
|
}, t.prototype.fetchFailedDueToUnexpectedError = function(e) {
|
|
735
|
-
return this.log(
|
|
761
|
+
return this.log(v.Error, 1103, "Unexpected error occurred while trying to fetch config JSON.", e);
|
|
736
762
|
}, t.prototype.fetchFailedDueToRedirectLoop = function() {
|
|
737
|
-
return this.log(
|
|
763
|
+
return this.log(v.Error, 1104, "Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/");
|
|
738
764
|
}, t.prototype.fetchReceived200WithInvalidBody = function() {
|
|
739
|
-
return this.log(
|
|
765
|
+
return this.log(v.Error, 1105, "Fetching config JSON was successful but the HTTP response content was invalid.");
|
|
740
766
|
}, t.prototype.fetchReceived304WhenLocalCacheIsEmpty = function(e, r) {
|
|
741
|
-
return this.log(
|
|
767
|
+
return this.log(v.Error, 1106, A.from("STATUS_CODE", "REASON_PHRASE")(De || (De = C(["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""], ["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""])), e, r));
|
|
742
768
|
}, t.prototype.settingForVariationIdIsNotPresent = function(e) {
|
|
743
|
-
return this.log(
|
|
769
|
+
return this.log(v.Error, 2011, A.from("VARIATION_ID")(Fe || (Fe = C(["Could not find the setting for the specified variation ID: '", "'."], ["Could not find the setting for the specified variation ID: '", "'."])), e));
|
|
744
770
|
}, t.prototype.configServiceCacheReadError = function(e) {
|
|
745
|
-
return this.log(
|
|
771
|
+
return this.log(v.Error, 2200, "Error occurred while reading the cache.", e);
|
|
746
772
|
}, t.prototype.configServiceCacheWriteError = function(e) {
|
|
747
|
-
return this.log(
|
|
773
|
+
return this.log(v.Error, 2201, "Error occurred while writing the cache.", e);
|
|
748
774
|
}, t.prototype.clientIsAlreadyCreated = function(e) {
|
|
749
|
-
return this.log(
|
|
775
|
+
return this.log(v.Warn, 3e3, A.from("SDK_KEY")(Pe || (Pe = C(["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."], ["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."])), e));
|
|
750
776
|
}, t.prototype.targetingIsNotPossible = function(e) {
|
|
751
|
-
return this.log(
|
|
777
|
+
return this.log(v.Warn, 3001, A.from("KEY")(Ue || (Ue = C(["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like `getValueAsync()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"], ["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like \\`getValueAsync()\\` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"])), e));
|
|
752
778
|
}, t.prototype.dataGovernanceIsOutOfSync = function() {
|
|
753
|
-
return this.log(
|
|
779
|
+
return this.log(v.Warn, 3002, "The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. Read more: https://configcat.com/docs/advanced/data-governance/");
|
|
754
780
|
}, t.prototype.configServiceCannotInitiateHttpCalls = function() {
|
|
755
|
-
return this.log(
|
|
781
|
+
return this.log(v.Warn, 3200, "Client is in offline mode, it cannot initiate HTTP calls.");
|
|
756
782
|
}, t.prototype.configServiceMethodHasNoEffectDueToDisposedClient = function(e) {
|
|
757
|
-
return this.log(
|
|
783
|
+
return this.log(v.Warn, 3201, A.from("METHOD_NAME")(ke || (ke = C(["The client object is already disposed, thus `", "()` has no effect."], ["The client object is already disposed, thus \\`", "()\\` has no effect."])), e));
|
|
758
784
|
}, t.prototype.configServiceMethodHasNoEffectDueToOverrideBehavior = function(e, r) {
|
|
759
|
-
return this.log(
|
|
785
|
+
return this.log(v.Warn, 3202, A.from("OVERRIDE_BEHAVIOR", "METHOD_NAME")(Me || (Me = C(["Client is configured to use the `", "` override behavior, thus `", "()` has no effect."], ["Client is configured to use the \\`", "\\` override behavior, thus \\`", "()\\` has no effect."])), e, r));
|
|
760
786
|
}, t.prototype.settingEvaluated = function(e) {
|
|
761
|
-
return this.log(
|
|
787
|
+
return this.log(v.Info, 5e3, A.from("EVALUATE_LOG")(Ve || (Ve = C(["", ""], ["", ""])), e));
|
|
762
788
|
}, t.prototype.configServiceStatusChanged = function(e) {
|
|
763
|
-
return this.log(
|
|
789
|
+
return this.log(v.Info, 5200, A.from("MODE")(xe || (xe = C(["Switched to ", " mode."], ["Switched to ", " mode."])), e.toUpperCase()));
|
|
764
790
|
}, t;
|
|
765
|
-
}(),
|
|
791
|
+
}(), Be = function() {
|
|
766
792
|
function t(e) {
|
|
767
|
-
e === void 0 && (e =
|
|
793
|
+
e === void 0 && (e = v.Warn), this.level = e, this.SOURCE = "ConfigCat";
|
|
768
794
|
}
|
|
769
795
|
return t.prototype.log = function(e, r, n, i) {
|
|
770
|
-
var o = e ===
|
|
771
|
-
` +
|
|
772
|
-
s(
|
|
796
|
+
var o = e === v.Debug ? [console.info, "DEBUG"] : e === v.Info ? [console.info, "INFO"] : e === v.Warn ? [console.warn, "WARN"] : e === v.Error ? [console.error, "ERROR"] : [console.log, v[e].toUpperCase()], s = o[0], a = o[1], c = i !== void 0 ? `
|
|
797
|
+
` + z(i, !0) : "";
|
|
798
|
+
s(this.SOURCE + " - " + a + " - [" + r + "] " + n + c);
|
|
773
799
|
}, t;
|
|
774
|
-
}(),
|
|
775
|
-
function
|
|
800
|
+
}(), Ce, Ae, we, Te, Ie, Ne, Re, Le, De, Fe, Pe, Ue, ke, Me, Ve, xe;
|
|
801
|
+
function J(t) {
|
|
776
802
|
return !!t.fn;
|
|
777
803
|
}
|
|
778
|
-
var
|
|
804
|
+
var ot = function() {
|
|
779
805
|
function t() {
|
|
780
806
|
this.events = {}, this.eventCount = 0, this.addListener = this.on, this.off = this.removeListener;
|
|
781
807
|
}
|
|
@@ -783,12 +809,12 @@ var at = function() {
|
|
|
783
809
|
if (typeof r != "function")
|
|
784
810
|
throw new TypeError("Listener must be a function");
|
|
785
811
|
var i = this.events[e], o = { fn: r, once: n };
|
|
786
|
-
return i ?
|
|
812
|
+
return i ? J(i) ? this.events[e] = [i, o] : i.push(o) : (this.events[e] = o, this.eventCount++), this;
|
|
787
813
|
}, t.prototype.removeListenerCore = function(e, r, n) {
|
|
788
814
|
var i = this.events[e];
|
|
789
815
|
if (!i)
|
|
790
816
|
return this;
|
|
791
|
-
if (
|
|
817
|
+
if (J(i))
|
|
792
818
|
n(i, r) && this.removeEvent(e);
|
|
793
819
|
else
|
|
794
820
|
for (var o = i.length - 1; o >= 0; o--)
|
|
@@ -815,14 +841,14 @@ var at = function() {
|
|
|
815
841
|
var r = this.events[e];
|
|
816
842
|
if (!r)
|
|
817
843
|
return [];
|
|
818
|
-
if (
|
|
844
|
+
if (J(r))
|
|
819
845
|
return [r.fn];
|
|
820
846
|
for (var n = r.length, i = new Array(n), o = 0; o < n; o++)
|
|
821
847
|
i[o] = r[o].fn;
|
|
822
848
|
return i;
|
|
823
849
|
}, t.prototype.listenerCount = function(e) {
|
|
824
850
|
var r = this.events[e];
|
|
825
|
-
return r ?
|
|
851
|
+
return r ? J(r) ? 1 : r.length : 0;
|
|
826
852
|
}, t.prototype.eventNames = function() {
|
|
827
853
|
var e = [];
|
|
828
854
|
if (this.eventCount === 0)
|
|
@@ -832,228 +858,200 @@ var at = function() {
|
|
|
832
858
|
Object.prototype.hasOwnProperty.call(r, n) && e.push(n);
|
|
833
859
|
return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(r)) : e;
|
|
834
860
|
}, t.prototype.emit = function(e, r, n, i, o) {
|
|
835
|
-
var s, a,
|
|
836
|
-
if (!
|
|
861
|
+
var s, a, c = this.events[e];
|
|
862
|
+
if (!c)
|
|
837
863
|
return !1;
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
for (var
|
|
841
|
-
switch (
|
|
864
|
+
var u, l;
|
|
865
|
+
J(c) ? (s = [c, 1], u = s[0], l = s[1]) : (c = c.slice(), a = [c[0], c.length], u = a[0], l = a[1]);
|
|
866
|
+
for (var h = arguments.length - 1, p = 0; ; ) {
|
|
867
|
+
switch (u.once && this.removeListenerCore(e, u, function(y, E) {
|
|
842
868
|
return y === E;
|
|
843
|
-
}),
|
|
869
|
+
}), h) {
|
|
844
870
|
case 0:
|
|
845
|
-
|
|
871
|
+
u.fn.call(this);
|
|
846
872
|
break;
|
|
847
873
|
case 1:
|
|
848
|
-
|
|
874
|
+
u.fn.call(this, r);
|
|
849
875
|
break;
|
|
850
876
|
case 2:
|
|
851
|
-
|
|
877
|
+
u.fn.call(this, r, n);
|
|
852
878
|
break;
|
|
853
879
|
case 3:
|
|
854
|
-
|
|
880
|
+
u.fn.call(this, r, n, i);
|
|
855
881
|
break;
|
|
856
882
|
case 4:
|
|
857
|
-
|
|
883
|
+
u.fn.call(this, r, n, i, o);
|
|
858
884
|
break;
|
|
859
885
|
default:
|
|
860
|
-
for (var f = new Array(
|
|
861
|
-
f[
|
|
862
|
-
|
|
886
|
+
for (var f = new Array(h), d = 0; d < h; d++)
|
|
887
|
+
f[d] = arguments[d + 1];
|
|
888
|
+
u.fn.apply(this, f);
|
|
863
889
|
break;
|
|
864
890
|
}
|
|
865
|
-
if (++
|
|
891
|
+
if (++p >= l)
|
|
866
892
|
break;
|
|
867
|
-
|
|
893
|
+
u = c[p];
|
|
868
894
|
}
|
|
869
895
|
return !0;
|
|
870
896
|
}, t;
|
|
871
|
-
}(), ct = function() {
|
|
872
|
-
function t() {
|
|
873
|
-
this.addListener = this.on, this.off = this.removeListener;
|
|
874
|
-
}
|
|
875
|
-
return t.prototype.on = function() {
|
|
876
|
-
return this;
|
|
877
|
-
}, t.prototype.once = function() {
|
|
878
|
-
return this;
|
|
879
|
-
}, t.prototype.removeListener = function() {
|
|
880
|
-
return this;
|
|
881
|
-
}, t.prototype.removeAllListeners = function() {
|
|
882
|
-
return this;
|
|
883
|
-
}, t.prototype.listeners = function() {
|
|
884
|
-
return [];
|
|
885
|
-
}, t.prototype.listenerCount = function() {
|
|
886
|
-
return 0;
|
|
887
|
-
}, t.prototype.eventNames = function() {
|
|
888
|
-
return [];
|
|
889
|
-
}, t.prototype.emit = function() {
|
|
890
|
-
return !1;
|
|
891
|
-
}, t;
|
|
892
|
-
}(), Pe = new ct(), ut = function() {
|
|
893
|
-
function t(e) {
|
|
894
|
-
this.addListener = this.on, this.off = this.removeListener, this.eventEmitter = e;
|
|
895
|
-
}
|
|
896
|
-
return t.prototype.tryDisconnect = function() {
|
|
897
|
-
var e = this.eventEmitter;
|
|
898
|
-
return this.eventEmitter = Pe, e !== Pe;
|
|
899
|
-
}, t.prototype.on = function(e, r) {
|
|
900
|
-
return this.eventEmitter.on(e, r), this;
|
|
901
|
-
}, t.prototype.once = function(e, r) {
|
|
902
|
-
return this.eventEmitter.once(e, r), this;
|
|
903
|
-
}, t.prototype.removeListener = function(e, r) {
|
|
904
|
-
return this.eventEmitter.removeListener(e, r), this;
|
|
905
|
-
}, t.prototype.removeAllListeners = function(e) {
|
|
906
|
-
return this.eventEmitter.removeAllListeners(e), this;
|
|
907
|
-
}, t.prototype.listeners = function(e) {
|
|
908
|
-
return this.eventEmitter.listeners(e);
|
|
909
|
-
}, t.prototype.listenerCount = function(e) {
|
|
910
|
-
return this.eventEmitter.listenerCount(e);
|
|
911
|
-
}, t.prototype.eventNames = function() {
|
|
912
|
-
return this.eventEmitter.eventNames();
|
|
913
|
-
}, t.prototype.emit = function(e) {
|
|
914
|
-
for (var r, n = [], i = 1; i < arguments.length; i++)
|
|
915
|
-
n[i - 1] = arguments[i];
|
|
916
|
-
return (r = this.eventEmitter).emit.apply(r, Xe([e], n, !1));
|
|
917
|
-
}, t;
|
|
918
897
|
}();
|
|
919
|
-
function
|
|
920
|
-
function e(
|
|
921
|
-
var
|
|
922
|
-
return
|
|
898
|
+
function oe(t) {
|
|
899
|
+
function e(V, N) {
|
|
900
|
+
var H = V << N | V >>> 32 - N;
|
|
901
|
+
return H;
|
|
923
902
|
}
|
|
924
|
-
function r(
|
|
925
|
-
for (var N = "",
|
|
926
|
-
|
|
903
|
+
function r(V) {
|
|
904
|
+
for (var N = "", H, R = 7; R >= 0; R--)
|
|
905
|
+
H = V >>> R * 4 & 15, N += H.toString(16);
|
|
927
906
|
return N;
|
|
928
907
|
}
|
|
929
|
-
function n(
|
|
930
|
-
|
|
908
|
+
function n(V) {
|
|
909
|
+
V = V.replace(/\r\n/g, `
|
|
931
910
|
`);
|
|
932
|
-
for (var N = "",
|
|
933
|
-
var
|
|
934
|
-
|
|
911
|
+
for (var N = "", H = 0; H < V.length; H++) {
|
|
912
|
+
var R = V.charCodeAt(H);
|
|
913
|
+
R < 128 ? N += String.fromCharCode(R) : R > 127 && R < 2048 ? (N += String.fromCharCode(R >> 6 | 192), N += String.fromCharCode(R & 63 | 128)) : (N += String.fromCharCode(R >> 12 | 224), N += String.fromCharCode(R >> 6 & 63 | 128), N += String.fromCharCode(R & 63 | 128));
|
|
935
914
|
}
|
|
936
915
|
return N;
|
|
937
916
|
}
|
|
938
|
-
var i, o, s, a = new Array(80),
|
|
917
|
+
var i, o, s, a = new Array(80), c = 1732584193, u = 4023233417, l = 2562383102, h = 271733878, p = 3285377520, f, d, y, E, I, U;
|
|
939
918
|
t = n(t);
|
|
940
|
-
var
|
|
941
|
-
for (o = 0; o <
|
|
942
|
-
s = t.charCodeAt(o) << 24 | t.charCodeAt(o + 1) << 16 | t.charCodeAt(o + 2) << 8 | t.charCodeAt(o + 3),
|
|
943
|
-
switch (
|
|
919
|
+
var D = t.length, F = new Array();
|
|
920
|
+
for (o = 0; o < D - 3; o += 4)
|
|
921
|
+
s = t.charCodeAt(o) << 24 | t.charCodeAt(o + 1) << 16 | t.charCodeAt(o + 2) << 8 | t.charCodeAt(o + 3), F.push(s);
|
|
922
|
+
switch (D % 4) {
|
|
944
923
|
case 0:
|
|
945
924
|
o = 2147483648;
|
|
946
925
|
break;
|
|
947
926
|
case 1:
|
|
948
|
-
o = t.charCodeAt(
|
|
927
|
+
o = t.charCodeAt(D - 1) << 24 | 8388608;
|
|
949
928
|
break;
|
|
950
929
|
case 2:
|
|
951
|
-
o = t.charCodeAt(
|
|
930
|
+
o = t.charCodeAt(D - 2) << 24 | t.charCodeAt(D - 1) << 16 | 32768;
|
|
952
931
|
break;
|
|
953
932
|
case 3:
|
|
954
|
-
o = t.charCodeAt(
|
|
933
|
+
o = t.charCodeAt(D - 3) << 24 | t.charCodeAt(D - 2) << 16 | t.charCodeAt(D - 1) << 8 | 128;
|
|
955
934
|
break;
|
|
956
935
|
}
|
|
957
|
-
for (
|
|
958
|
-
|
|
959
|
-
for (
|
|
936
|
+
for (F.push(o); F.length % 16 != 14; )
|
|
937
|
+
F.push(0);
|
|
938
|
+
for (F.push(D >>> 29), F.push(D << 3 & 4294967295), i = 0; i < F.length; i += 16) {
|
|
960
939
|
for (o = 0; o < 16; o++)
|
|
961
|
-
a[o] =
|
|
940
|
+
a[o] = F[i + o];
|
|
962
941
|
for (o = 16; o <= 79; o++)
|
|
963
942
|
a[o] = e(a[o - 3] ^ a[o - 8] ^ a[o - 14] ^ a[o - 16], 1);
|
|
964
|
-
for (f =
|
|
965
|
-
|
|
943
|
+
for (f = c, d = u, y = l, E = h, I = p, o = 0; o <= 19; o++)
|
|
944
|
+
U = e(f, 5) + (d & y | ~d & E) + I + a[o] + 1518500249 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
|
|
966
945
|
for (o = 20; o <= 39; o++)
|
|
967
|
-
|
|
946
|
+
U = e(f, 5) + (d ^ y ^ E) + I + a[o] + 1859775393 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
|
|
968
947
|
for (o = 40; o <= 59; o++)
|
|
969
|
-
|
|
948
|
+
U = e(f, 5) + (d & y | d & E | y & E) + I + a[o] + 2400959708 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
|
|
970
949
|
for (o = 60; o <= 79; o++)
|
|
971
|
-
|
|
972
|
-
|
|
950
|
+
U = e(f, 5) + (d ^ y ^ E) + I + a[o] + 3395469782 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
|
|
951
|
+
c = c + f & 4294967295, u = u + d & 4294967295, l = l + y & 4294967295, h = h + E & 4294967295, p = p + I & 4294967295;
|
|
973
952
|
}
|
|
974
|
-
return (r(
|
|
953
|
+
return (r(c) + r(u) + r(l) + r(h) + r(p)).toLowerCase();
|
|
975
954
|
}
|
|
976
|
-
var
|
|
955
|
+
var j;
|
|
977
956
|
(function(t) {
|
|
978
957
|
t[t.AutoPoll = 0] = "AutoPoll", t[t.LazyLoad = 1] = "LazyLoad", t[t.ManualPoll = 2] = "ManualPoll";
|
|
979
|
-
})(
|
|
980
|
-
var
|
|
958
|
+
})(j || (j = {}));
|
|
959
|
+
var ue;
|
|
981
960
|
(function(t) {
|
|
982
961
|
t[t.Global = 0] = "Global", t[t.EuOnly = 1] = "EuOnly";
|
|
983
|
-
})(
|
|
984
|
-
var
|
|
962
|
+
})(ue || (ue = {}));
|
|
963
|
+
var Ee = function() {
|
|
985
964
|
function t(e, r, n, i, o) {
|
|
986
|
-
var s, a, u;
|
|
965
|
+
var s = this, a, c, u;
|
|
987
966
|
if (this.requestTimeoutMs = 3e4, this.baseUrlOverriden = !1, this.proxy = "", this.offline = !1, !e)
|
|
988
967
|
throw new Error("Invalid 'apiKey' value");
|
|
989
|
-
switch (this.apiKey = e, this.clientVersion = r, this.dataGovernance = (
|
|
990
|
-
case
|
|
968
|
+
switch (this.apiKey = e, this.clientVersion = r, this.dataGovernance = (a = n == null ? void 0 : n.dataGovernance) !== null && a !== void 0 ? a : ue.Global, this.dataGovernance) {
|
|
969
|
+
case ue.EuOnly:
|
|
991
970
|
this.baseUrl = "https://cdn-eu.configcat.com";
|
|
992
971
|
break;
|
|
993
972
|
default:
|
|
994
973
|
this.baseUrl = "https://cdn-global.configcat.com";
|
|
995
974
|
break;
|
|
996
975
|
}
|
|
997
|
-
var
|
|
998
|
-
this.hooks = new
|
|
999
|
-
|
|
976
|
+
var l = (c = o == null ? void 0 : o()) !== null && c !== void 0 ? c : new ot();
|
|
977
|
+
this.hooks = new et(l), this.readyPromise = new Promise(function(f) {
|
|
978
|
+
return s.hooks.once("clientReady", f);
|
|
979
|
+
});
|
|
980
|
+
var h, p;
|
|
1000
981
|
if (n) {
|
|
1001
|
-
if (
|
|
982
|
+
if (h = n.logger, p = n.cache, n.requestTimeoutMs) {
|
|
1002
983
|
if (n.requestTimeoutMs < 0)
|
|
1003
984
|
throw new Error("Invalid 'requestTimeoutMs' value");
|
|
1004
985
|
this.requestTimeoutMs = n.requestTimeoutMs;
|
|
1005
986
|
}
|
|
1006
987
|
n.baseUrl && (this.baseUrl = n.baseUrl, this.baseUrlOverriden = !0), n.proxy && (this.proxy = n.proxy), n.flagOverrides && (this.flagOverrides = n.flagOverrides), n.defaultUser && (this.defaultUser = n.defaultUser), n.offline && (this.offline = n.offline), (u = n.setupHooks) === null || u === void 0 || u.call(n, this.hooks);
|
|
1007
988
|
}
|
|
1008
|
-
this.logger = new
|
|
989
|
+
this.logger = new it(h ?? new Be(), this.hooks), this.cache = p ? new _e(p, this.logger) : i ? i(this) : new nt();
|
|
1009
990
|
}
|
|
1010
991
|
return t.prototype.getUrl = function() {
|
|
1011
992
|
return this.baseUrl + "/configuration-files/" + this.apiKey + "/" + t.configFileName + "?sdk=" + this.clientVersion;
|
|
1012
993
|
}, t.prototype.getCacheKey = function() {
|
|
1013
|
-
return
|
|
994
|
+
return oe(this.apiKey + "_" + t.configFileName + "_" + M.serializationFormatVersion);
|
|
1014
995
|
}, t.configFileName = "config_v5.json", t;
|
|
1015
|
-
}(),
|
|
1016
|
-
|
|
996
|
+
}(), He = function(t) {
|
|
997
|
+
B(e, t);
|
|
1017
998
|
function e(r, n, i, o, s, a) {
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
var
|
|
1021
|
-
if (!(typeof
|
|
999
|
+
var c = t.call(this, r, n + "/a-" + i, o, s, a) || this;
|
|
1000
|
+
c.pollIntervalSeconds = 60, c.maxInitWaitTimeSeconds = 5, o && (o.pollIntervalSeconds !== void 0 && o.pollIntervalSeconds !== null && (c.pollIntervalSeconds = o.pollIntervalSeconds), o.maxInitWaitTimeSeconds !== void 0 && o.maxInitWaitTimeSeconds !== null && (c.maxInitWaitTimeSeconds = o.maxInitWaitTimeSeconds));
|
|
1001
|
+
var u = 2147483;
|
|
1002
|
+
if (!(typeof c.pollIntervalSeconds == "number" && 1 <= c.pollIntervalSeconds && c.pollIntervalSeconds <= u))
|
|
1022
1003
|
throw new Error("Invalid 'pollIntervalSeconds' value");
|
|
1023
|
-
if (!(typeof
|
|
1004
|
+
if (!(typeof c.maxInitWaitTimeSeconds == "number" && c.maxInitWaitTimeSeconds <= u))
|
|
1024
1005
|
throw new Error("Invalid 'maxInitWaitTimeSeconds' value");
|
|
1025
|
-
return
|
|
1006
|
+
return c;
|
|
1026
1007
|
}
|
|
1027
1008
|
return e;
|
|
1028
|
-
}(
|
|
1029
|
-
|
|
1009
|
+
}(Ee), je = function(t) {
|
|
1010
|
+
B(e, t);
|
|
1030
1011
|
function e(r, n, i, o, s, a) {
|
|
1031
1012
|
return t.call(this, r, n + "/m-" + i, o, s, a) || this;
|
|
1032
1013
|
}
|
|
1033
1014
|
return e;
|
|
1034
|
-
}(
|
|
1035
|
-
|
|
1015
|
+
}(Ee), qe = function(t) {
|
|
1016
|
+
B(e, t);
|
|
1036
1017
|
function e(r, n, i, o, s, a) {
|
|
1037
|
-
var
|
|
1038
|
-
if (
|
|
1018
|
+
var c = t.call(this, r, n + "/l-" + i, o, s, a) || this;
|
|
1019
|
+
if (c.cacheTimeToLiveSeconds = 60, o && o.cacheTimeToLiveSeconds !== void 0 && o.cacheTimeToLiveSeconds !== null && (c.cacheTimeToLiveSeconds = o.cacheTimeToLiveSeconds), !(typeof c.cacheTimeToLiveSeconds == "number" && 1 <= c.cacheTimeToLiveSeconds && c.cacheTimeToLiveSeconds <= 2147483647))
|
|
1039
1020
|
throw new Error("Invalid 'cacheTimeToLiveSeconds' value");
|
|
1040
|
-
return
|
|
1021
|
+
return c;
|
|
1041
1022
|
}
|
|
1042
1023
|
return e;
|
|
1043
|
-
}(
|
|
1024
|
+
}(Ee), P;
|
|
1044
1025
|
(function(t) {
|
|
1045
1026
|
t[t.LocalOnly = 0] = "LocalOnly", t[t.LocalOverRemote = 1] = "LocalOverRemote", t[t.RemoteOverLocal = 2] = "RemoteOverLocal";
|
|
1046
|
-
})(
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1027
|
+
})(P || (P = {}));
|
|
1028
|
+
var st = function() {
|
|
1029
|
+
function t(e) {
|
|
1030
|
+
this.map = {}, this.map = Object.fromEntries(Object.entries(e).map(function(r) {
|
|
1031
|
+
var n = r[0], i = r[1];
|
|
1032
|
+
return [n, ze.fromValue(i)];
|
|
1033
|
+
}));
|
|
1034
|
+
}
|
|
1035
|
+
return t.prototype.getOverrides = function() {
|
|
1036
|
+
return Promise.resolve(this.map);
|
|
1037
|
+
}, t.prototype.getOverridesSync = function() {
|
|
1038
|
+
return this.map;
|
|
1039
|
+
}, t;
|
|
1040
|
+
}(), at = function() {
|
|
1041
|
+
function t(e, r) {
|
|
1042
|
+
this.dataSource = e, this.behaviour = r;
|
|
1043
|
+
}
|
|
1044
|
+
return t;
|
|
1045
|
+
}(), ut = function(t) {
|
|
1046
|
+
B(e, t);
|
|
1049
1047
|
function e(r, n) {
|
|
1050
1048
|
var i = t.call(this, r, n) || this;
|
|
1051
|
-
return i.cacheTimeToLiveMs = n.cacheTimeToLiveSeconds * 1e3,
|
|
1049
|
+
return i.cacheTimeToLiveMs = n.cacheTimeToLiveSeconds * 1e3, t.prototype.syncUpWithCache.call(i), i;
|
|
1052
1050
|
}
|
|
1053
1051
|
return e.prototype.getConfig = function() {
|
|
1054
1052
|
return S(this, void 0, void 0, function() {
|
|
1055
1053
|
function r(o, s) {
|
|
1056
|
-
s === void 0 && (s = ""), o.debug("LazyLoadConfigService.getConfig(): cache is empty or expired"
|
|
1054
|
+
s === void 0 && (s = ""), o.debug("LazyLoadConfigService.getConfig(): cache is empty or expired" + s + ".");
|
|
1057
1055
|
}
|
|
1058
1056
|
var n, i;
|
|
1059
1057
|
return O(this, function(o) {
|
|
@@ -1075,14 +1073,18 @@ var lt = function(t) {
|
|
|
1075
1073
|
});
|
|
1076
1074
|
}, e.prototype.refreshConfigAsync = function() {
|
|
1077
1075
|
return this.options.logger.debug("LazyLoadConfigService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
|
|
1076
|
+
}, e.prototype.getReadyState = function(r) {
|
|
1077
|
+
return r.isEmpty ? L.NoFlagData : r.isExpired(this.cacheTimeToLiveMs) ? L.HasCachedFlagDataOnly : L.HasUpToDateFlagData;
|
|
1078
1078
|
}, e;
|
|
1079
|
-
}(
|
|
1080
|
-
|
|
1079
|
+
}(me), ct = function(t) {
|
|
1080
|
+
B(e, t);
|
|
1081
1081
|
function e(r, n) {
|
|
1082
1082
|
var i = t.call(this, r, n) || this;
|
|
1083
|
-
return
|
|
1083
|
+
return t.prototype.syncUpWithCache.call(i), i;
|
|
1084
1084
|
}
|
|
1085
|
-
return e.prototype.
|
|
1085
|
+
return e.prototype.getReadyState = function(r) {
|
|
1086
|
+
return r.isEmpty ? L.NoFlagData : L.HasCachedFlagDataOnly;
|
|
1087
|
+
}, e.prototype.getConfig = function() {
|
|
1086
1088
|
return S(this, void 0, void 0, function() {
|
|
1087
1089
|
return O(this, function(r) {
|
|
1088
1090
|
switch (r.label) {
|
|
@@ -1096,25 +1098,25 @@ var lt = function(t) {
|
|
|
1096
1098
|
}, e.prototype.refreshConfigAsync = function() {
|
|
1097
1099
|
return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
|
|
1098
1100
|
}, e;
|
|
1099
|
-
}(
|
|
1100
|
-
function
|
|
1101
|
-
typeof Object.values > "u" && (Object.values =
|
|
1101
|
+
}(me);
|
|
1102
|
+
function lt() {
|
|
1103
|
+
typeof Object.values > "u" && (Object.values = ft), typeof Object.entries > "u" && (Object.entries = ht), typeof Object.fromEntries > "u" && (Object.fromEntries = gt);
|
|
1102
1104
|
}
|
|
1103
|
-
function
|
|
1105
|
+
function ft(t) {
|
|
1104
1106
|
for (var e = [], r = 0, n = Object.keys(t); r < n.length; r++) {
|
|
1105
1107
|
var i = n[r];
|
|
1106
1108
|
e.push(t[i]);
|
|
1107
1109
|
}
|
|
1108
1110
|
return e;
|
|
1109
1111
|
}
|
|
1110
|
-
function
|
|
1112
|
+
function ht(t) {
|
|
1111
1113
|
for (var e = [], r = 0, n = Object.keys(t); r < n.length; r++) {
|
|
1112
1114
|
var i = n[r];
|
|
1113
1115
|
e.push([i, t[i]]);
|
|
1114
1116
|
}
|
|
1115
1117
|
return e;
|
|
1116
1118
|
}
|
|
1117
|
-
function
|
|
1119
|
+
function gt(t) {
|
|
1118
1120
|
var e, r = {};
|
|
1119
1121
|
if (Array.isArray(t))
|
|
1120
1122
|
for (var n = 0, i = t; n < i.length; n++) {
|
|
@@ -1122,15 +1124,15 @@ function vt(t) {
|
|
|
1122
1124
|
r[s] = a;
|
|
1123
1125
|
}
|
|
1124
1126
|
else if (typeof Symbol < "u" && (t == null ? void 0 : t[Symbol.iterator]))
|
|
1125
|
-
for (var
|
|
1126
|
-
var s =
|
|
1127
|
+
for (var c = t[Symbol.iterator](), u = void 0, l = void 0; e = c.next(), u = e.value, l = e.done, !l; ) {
|
|
1128
|
+
var s = u[0], a = u[1];
|
|
1127
1129
|
r[s] = a;
|
|
1128
1130
|
}
|
|
1129
1131
|
else
|
|
1130
1132
|
throw new TypeError("Object.fromEntries() requires a single iterable argument");
|
|
1131
1133
|
return r;
|
|
1132
1134
|
}
|
|
1133
|
-
function
|
|
1135
|
+
function pt() {
|
|
1134
1136
|
var t = function(e) {
|
|
1135
1137
|
this.target = e;
|
|
1136
1138
|
};
|
|
@@ -1138,31 +1140,31 @@ function dt() {
|
|
|
1138
1140
|
return this.target;
|
|
1139
1141
|
}, t.isFallback = !0, t;
|
|
1140
1142
|
}
|
|
1141
|
-
var
|
|
1143
|
+
var dt = function() {
|
|
1142
1144
|
return typeof WeakRef == "function";
|
|
1143
|
-
},
|
|
1144
|
-
var r =
|
|
1145
|
+
}, We = /^[0-9]+$/, $ = function(t, e) {
|
|
1146
|
+
var r = We.test(t), n = We.test(e);
|
|
1145
1147
|
return r && n && (t = +t, e = +e), t === e ? 0 : r && !n ? -1 : n && !r ? 1 : t < e ? -1 : 1;
|
|
1146
|
-
},
|
|
1147
|
-
var r =
|
|
1148
|
-
m[t] = r, b[r] = e,
|
|
1148
|
+
}, ve = 256, te = Number.MAX_SAFE_INTEGER || 9007199254740991, Z = [], b = [], m = {}, vt = 0, w = function(t, e) {
|
|
1149
|
+
var r = vt++;
|
|
1150
|
+
m[t] = r, b[r] = e, Z[r] = new RegExp(e);
|
|
1149
1151
|
};
|
|
1150
1152
|
w("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
1151
1153
|
w("NUMERICIDENTIFIERLOOSE", "[0-9]+");
|
|
1152
1154
|
w("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
|
|
1153
|
-
w("MAINVERSION", "("
|
|
1154
|
-
w("MAINVERSIONLOOSE", "("
|
|
1155
|
-
w("PRERELEASEIDENTIFIER", "(?:"
|
|
1156
|
-
w("PRERELEASEIDENTIFIERLOOSE", "(?:"
|
|
1157
|
-
w("PRERELEASE", "(?:-("
|
|
1158
|
-
w("PRERELEASELOOSE", "(?:-?("
|
|
1155
|
+
w("MAINVERSION", "(" + b[m.NUMERICIDENTIFIER] + ")\\." + ("(" + b[m.NUMERICIDENTIFIER] + ")\\.") + ("(" + b[m.NUMERICIDENTIFIER] + ")"));
|
|
1156
|
+
w("MAINVERSIONLOOSE", "(" + b[m.NUMERICIDENTIFIERLOOSE] + ")\\." + ("(" + b[m.NUMERICIDENTIFIERLOOSE] + ")\\.") + ("(" + b[m.NUMERICIDENTIFIERLOOSE] + ")"));
|
|
1157
|
+
w("PRERELEASEIDENTIFIER", "(?:" + b[m.NUMERICIDENTIFIER] + "|" + b[m.NONNUMERICIDENTIFIER] + ")");
|
|
1158
|
+
w("PRERELEASEIDENTIFIERLOOSE", "(?:" + b[m.NUMERICIDENTIFIERLOOSE] + "|" + b[m.NONNUMERICIDENTIFIER] + ")");
|
|
1159
|
+
w("PRERELEASE", "(?:-(" + b[m.PRERELEASEIDENTIFIER] + "(?:\\." + b[m.PRERELEASEIDENTIFIER] + ")*))");
|
|
1160
|
+
w("PRERELEASELOOSE", "(?:-?(" + b[m.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + b[m.PRERELEASEIDENTIFIERLOOSE] + ")*))");
|
|
1159
1161
|
w("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
|
|
1160
|
-
w("BUILD", "(?:\\+("
|
|
1161
|
-
w("FULLPLAIN", "v?"
|
|
1162
|
-
w("FULL", "^"
|
|
1163
|
-
w("LOOSEPLAIN", "[v=\\s]*"
|
|
1164
|
-
w("LOOSE", "^"
|
|
1165
|
-
var
|
|
1162
|
+
w("BUILD", "(?:\\+(" + b[m.BUILDIDENTIFIER] + "(?:\\." + b[m.BUILDIDENTIFIER] + ")*))");
|
|
1163
|
+
w("FULLPLAIN", "v?" + b[m.MAINVERSION] + b[m.PRERELEASE] + "?" + b[m.BUILD] + "?");
|
|
1164
|
+
w("FULL", "^" + b[m.FULLPLAIN] + "$");
|
|
1165
|
+
w("LOOSEPLAIN", "[v=\\s]*" + b[m.MAINVERSIONLOOSE] + b[m.PRERELEASELOOSE] + "?" + b[m.BUILD] + "?");
|
|
1166
|
+
w("LOOSE", "^" + b[m.LOOSEPLAIN] + "$");
|
|
1167
|
+
var ce = function() {
|
|
1166
1168
|
function t(e, r) {
|
|
1167
1169
|
if ((!r || typeof r != "object") && (r = {
|
|
1168
1170
|
loose: !!r,
|
|
@@ -1172,30 +1174,30 @@ var oe = function() {
|
|
|
1172
1174
|
return e;
|
|
1173
1175
|
e = e.version;
|
|
1174
1176
|
} else if (typeof e != "string")
|
|
1175
|
-
throw new TypeError("Invalid Version: "
|
|
1176
|
-
if (e.length >
|
|
1177
|
-
throw new TypeError("version is longer than "
|
|
1177
|
+
throw new TypeError("Invalid Version: " + e);
|
|
1178
|
+
if (e.length > ve)
|
|
1179
|
+
throw new TypeError("version is longer than " + ve + " characters");
|
|
1178
1180
|
this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease;
|
|
1179
|
-
var n = e.trim().match(r.loose ?
|
|
1181
|
+
var n = e.trim().match(r.loose ? Z[m.LOOSE] : Z[m.FULL]);
|
|
1180
1182
|
if (!n)
|
|
1181
|
-
throw new TypeError("Invalid Version: "
|
|
1182
|
-
if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major >
|
|
1183
|
+
throw new TypeError("Invalid Version: " + e);
|
|
1184
|
+
if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > te || this.major < 0)
|
|
1183
1185
|
throw new TypeError("Invalid major version");
|
|
1184
|
-
if (this.minor >
|
|
1186
|
+
if (this.minor > te || this.minor < 0)
|
|
1185
1187
|
throw new TypeError("Invalid minor version");
|
|
1186
|
-
if (this.patch >
|
|
1188
|
+
if (this.patch > te || this.patch < 0)
|
|
1187
1189
|
throw new TypeError("Invalid patch version");
|
|
1188
1190
|
n[4] ? this.prerelease = n[4].split(".").map(function(i) {
|
|
1189
1191
|
if (/^[0-9]+$/.test(i)) {
|
|
1190
1192
|
var o = +i;
|
|
1191
|
-
if (o >= 0 && o <
|
|
1193
|
+
if (o >= 0 && o < te)
|
|
1192
1194
|
return o;
|
|
1193
1195
|
}
|
|
1194
1196
|
return i;
|
|
1195
1197
|
}) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
|
|
1196
1198
|
}
|
|
1197
1199
|
return t.prototype.format = function() {
|
|
1198
|
-
return this.version =
|
|
1200
|
+
return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
|
|
1199
1201
|
}, t.prototype.toString = function() {
|
|
1200
1202
|
return this.version;
|
|
1201
1203
|
}, t.prototype.compare = function(e) {
|
|
@@ -1206,7 +1208,7 @@ var oe = function() {
|
|
|
1206
1208
|
}
|
|
1207
1209
|
return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
|
|
1208
1210
|
}, t.prototype.compareMain = function(e) {
|
|
1209
|
-
return e instanceof t || (e = new t(e, this.options)),
|
|
1211
|
+
return e instanceof t || (e = new t(e, this.options)), $(this.major, e.major) || $(this.minor, e.minor) || $(this.patch, e.patch);
|
|
1210
1212
|
}, t.prototype.comparePre = function(e) {
|
|
1211
1213
|
if (e instanceof t || (e = new t(e, this.options)), this.prerelease.length && !e.prerelease.length)
|
|
1212
1214
|
return -1;
|
|
@@ -1225,7 +1227,7 @@ var oe = function() {
|
|
|
1225
1227
|
return -1;
|
|
1226
1228
|
if (n === i)
|
|
1227
1229
|
continue;
|
|
1228
|
-
return
|
|
1230
|
+
return $(n, i);
|
|
1229
1231
|
} while (++r);
|
|
1230
1232
|
}, t.prototype.compareBuild = function(e) {
|
|
1231
1233
|
e instanceof t || (e = new t(e, this.options));
|
|
@@ -1240,7 +1242,7 @@ var oe = function() {
|
|
|
1240
1242
|
return -1;
|
|
1241
1243
|
if (n === i)
|
|
1242
1244
|
continue;
|
|
1243
|
-
return
|
|
1245
|
+
return $(n, i);
|
|
1244
1246
|
} while (++r);
|
|
1245
1247
|
}, t.prototype.inc = function(e, r) {
|
|
1246
1248
|
switch (e) {
|
|
@@ -1276,51 +1278,56 @@ var oe = function() {
|
|
|
1276
1278
|
r && (this.prerelease[0] === r ? isNaN(this.prerelease[1]) && (this.prerelease = [r, 0]) : this.prerelease = [r, 0]);
|
|
1277
1279
|
break;
|
|
1278
1280
|
default:
|
|
1279
|
-
throw new Error("invalid increment argument: "
|
|
1281
|
+
throw new Error("invalid increment argument: " + e);
|
|
1280
1282
|
}
|
|
1281
1283
|
return this.format(), this.raw = this.version, this;
|
|
1282
1284
|
}, t;
|
|
1283
|
-
}(),
|
|
1285
|
+
}(), yt = function(t, e) {
|
|
1284
1286
|
if ((!e || typeof e != "object") && (e = {
|
|
1285
1287
|
loose: !!e,
|
|
1286
1288
|
includePrerelease: !1
|
|
1287
|
-
}), t instanceof
|
|
1289
|
+
}), t instanceof ce)
|
|
1288
1290
|
return t;
|
|
1289
|
-
if (typeof t != "string" || t.length >
|
|
1291
|
+
if (typeof t != "string" || t.length > ve)
|
|
1290
1292
|
return null;
|
|
1291
|
-
var r = e.loose ?
|
|
1293
|
+
var r = e.loose ? Z[m.LOOSE] : Z[m.FULL];
|
|
1292
1294
|
if (!r.test(t))
|
|
1293
1295
|
return null;
|
|
1294
1296
|
try {
|
|
1295
|
-
return new
|
|
1297
|
+
return new ce(t, e);
|
|
1296
1298
|
} catch {
|
|
1297
1299
|
return null;
|
|
1298
1300
|
}
|
|
1299
|
-
},
|
|
1300
|
-
return new
|
|
1301
|
-
},
|
|
1302
|
-
var e =
|
|
1301
|
+
}, G = function(t, e, r) {
|
|
1302
|
+
return new ce(t, r).compare(new ce(e, r));
|
|
1303
|
+
}, W = function(t) {
|
|
1304
|
+
var e = yt(t, !1);
|
|
1303
1305
|
return e ? e.version : null;
|
|
1306
|
+
}, mt = function(t, e) {
|
|
1307
|
+
return G(t, e, !0) === 0;
|
|
1308
|
+
}, Et = function(t, e) {
|
|
1309
|
+
return G(t, e, !1) === 0;
|
|
1304
1310
|
}, bt = function(t, e) {
|
|
1305
|
-
return
|
|
1311
|
+
return G(t, e, !1) < 0;
|
|
1306
1312
|
}, St = function(t, e) {
|
|
1307
|
-
return
|
|
1313
|
+
return G(t, e, !1) <= 0;
|
|
1308
1314
|
}, Ot = function(t, e) {
|
|
1309
|
-
return
|
|
1310
|
-
}, At = function(t, e) {
|
|
1311
|
-
return H(t, e, !1) <= 0;
|
|
1315
|
+
return G(t, e, !1) > 0;
|
|
1312
1316
|
}, Ct = function(t, e) {
|
|
1313
|
-
return
|
|
1314
|
-
},
|
|
1315
|
-
|
|
1316
|
-
},
|
|
1317
|
+
return G(t, e, !1) >= 0;
|
|
1318
|
+
}, jt = function() {
|
|
1319
|
+
function t(e, r, n, i) {
|
|
1320
|
+
this.custom = {}, this.identifier = e, this.email = r, this.country = n, this.custom = i || {};
|
|
1321
|
+
}
|
|
1322
|
+
return t;
|
|
1323
|
+
}(), At = function() {
|
|
1317
1324
|
function t(e) {
|
|
1318
1325
|
this.logger = e;
|
|
1319
1326
|
}
|
|
1320
1327
|
return t.prototype.evaluate = function(e, r, n, i, o) {
|
|
1321
|
-
if (this.logger.debug("RolloutEvaluator.Evaluate() called."), e.type < 0 && !
|
|
1322
|
-
throw new TypeError(e.value === null ? "Setting value is null." : e.value === void 0 ? "Setting value is undefined." : "Setting value '"
|
|
1323
|
-
var s = new
|
|
1328
|
+
if (this.logger.debug("RolloutEvaluator.Evaluate() called."), e.type < 0 && !Je(e.value))
|
|
1329
|
+
throw new TypeError(e.value === null ? "Setting value is null." : e.value === void 0 ? "Setting value is undefined." : "Setting value '" + e.value + "' is of an unsupported type (" + typeof e.value + ").");
|
|
1330
|
+
var s = new wt();
|
|
1324
1331
|
s.user = i, s.keyName = r, s.returnValue = n;
|
|
1325
1332
|
var a;
|
|
1326
1333
|
try {
|
|
@@ -1338,72 +1345,72 @@ var oe = function() {
|
|
|
1338
1345
|
}
|
|
1339
1346
|
}, t.prototype.evaluateRules = function(e, r, n) {
|
|
1340
1347
|
if (this.logger.debug("RolloutEvaluator.EvaluateRules() called."), e && e.length > 0)
|
|
1341
|
-
for (var i = function(
|
|
1342
|
-
var
|
|
1348
|
+
for (var i = function(c) {
|
|
1349
|
+
var u = e[c], l = o.getUserAttribute(r, u.comparisonAttribute), h = u.comparator, p = u.comparisonValue, f = "Evaluating rule: '" + l + "' " + o.ruleToString(h) + " '" + p + "' => ";
|
|
1343
1350
|
if (!l)
|
|
1344
1351
|
return f += "NO MATCH (Attribute is not defined on the user object)", n.opAppendLine(f), "continue";
|
|
1345
|
-
var
|
|
1346
|
-
value:
|
|
1347
|
-
variationId:
|
|
1348
|
-
matchedTargetingRule:
|
|
1352
|
+
var d = {
|
|
1353
|
+
value: u.value,
|
|
1354
|
+
variationId: u.variationId,
|
|
1355
|
+
matchedTargetingRule: u
|
|
1349
1356
|
};
|
|
1350
|
-
switch (
|
|
1351
|
-
case
|
|
1352
|
-
for (var y =
|
|
1357
|
+
switch (h) {
|
|
1358
|
+
case g.In:
|
|
1359
|
+
for (var y = p.split(","), E = 0; E < y.length; E++)
|
|
1353
1360
|
if (y[E].trim() === l)
|
|
1354
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1361
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1355
1362
|
f += "no match";
|
|
1356
1363
|
break;
|
|
1357
|
-
case
|
|
1358
|
-
if (!
|
|
1359
|
-
return
|
|
1364
|
+
case g.NotIn:
|
|
1365
|
+
if (!p.split(",").some(function(F) {
|
|
1366
|
+
return F.trim() === l;
|
|
1360
1367
|
}))
|
|
1361
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1368
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1362
1369
|
f += "no match";
|
|
1363
1370
|
break;
|
|
1364
|
-
case
|
|
1365
|
-
if (l.indexOf(
|
|
1366
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1371
|
+
case g.Contains:
|
|
1372
|
+
if (l.indexOf(p) !== -1)
|
|
1373
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1367
1374
|
f += "no match";
|
|
1368
1375
|
break;
|
|
1369
|
-
case
|
|
1370
|
-
if (l.indexOf(
|
|
1371
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1376
|
+
case g.NotContains:
|
|
1377
|
+
if (l.indexOf(p) === -1)
|
|
1378
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1372
1379
|
f += "no match";
|
|
1373
1380
|
break;
|
|
1374
|
-
case
|
|
1375
|
-
case
|
|
1376
|
-
case
|
|
1377
|
-
case
|
|
1378
|
-
case
|
|
1379
|
-
case
|
|
1380
|
-
if (o.evaluateSemver(l,
|
|
1381
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1381
|
+
case g.SemVerIn:
|
|
1382
|
+
case g.SemVerNotIn:
|
|
1383
|
+
case g.SemVerLessThan:
|
|
1384
|
+
case g.SemVerLessThanEqual:
|
|
1385
|
+
case g.SemVerGreaterThan:
|
|
1386
|
+
case g.SemVerGreaterThanEqual:
|
|
1387
|
+
if (o.evaluateSemver(l, p, h))
|
|
1388
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1382
1389
|
f += "no match";
|
|
1383
1390
|
break;
|
|
1384
|
-
case
|
|
1385
|
-
case
|
|
1386
|
-
case
|
|
1387
|
-
case
|
|
1388
|
-
case
|
|
1389
|
-
case
|
|
1390
|
-
if (o.evaluateNumber(l,
|
|
1391
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1391
|
+
case g.NumberEqual:
|
|
1392
|
+
case g.NumberNotEqual:
|
|
1393
|
+
case g.NumberLessThan:
|
|
1394
|
+
case g.NumberLessThanEqual:
|
|
1395
|
+
case g.NumberGreaterThan:
|
|
1396
|
+
case g.NumberGreaterThanEqual:
|
|
1397
|
+
if (o.evaluateNumber(l, p, h))
|
|
1398
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1392
1399
|
f += "no match";
|
|
1393
1400
|
break;
|
|
1394
|
-
case
|
|
1395
|
-
for (var
|
|
1396
|
-
if (
|
|
1397
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1401
|
+
case g.SensitiveOneOf: {
|
|
1402
|
+
for (var I = p.split(","), U = oe(l), E = 0; E < I.length; E++)
|
|
1403
|
+
if (I[E].trim() === U)
|
|
1404
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1398
1405
|
f += "no match";
|
|
1399
1406
|
break;
|
|
1400
1407
|
}
|
|
1401
|
-
case
|
|
1402
|
-
var
|
|
1403
|
-
if (!
|
|
1404
|
-
return
|
|
1408
|
+
case g.SensitiveNotOneOf: {
|
|
1409
|
+
var D = oe(l);
|
|
1410
|
+
if (!p.split(",").some(function(F) {
|
|
1411
|
+
return F.trim() === D;
|
|
1405
1412
|
}))
|
|
1406
|
-
return f += "MATCH", n.opAppendLine(f), { value:
|
|
1413
|
+
return f += "MATCH", n.opAppendLine(f), { value: d };
|
|
1407
1414
|
f += "no match";
|
|
1408
1415
|
break;
|
|
1409
1416
|
}
|
|
@@ -1417,13 +1424,13 @@ var oe = function() {
|
|
|
1417
1424
|
return null;
|
|
1418
1425
|
}, t.prototype.evaluatePercentageRules = function(e, r, n) {
|
|
1419
1426
|
if (this.logger.debug("RolloutEvaluator.EvaluateVariations() called."), e && e.length > 0)
|
|
1420
|
-
for (var i = r + (n.identifier === null || n.identifier === void 0 ? "" : n.identifier), o =
|
|
1421
|
-
var
|
|
1422
|
-
if (a += +
|
|
1427
|
+
for (var i = r + (n.identifier === null || n.identifier === void 0 ? "" : n.identifier), o = oe(i).substring(0, 7), s = parseInt(o, 16) % 100, a = 0, c = 0; c < e.length; c++) {
|
|
1428
|
+
var u = e[c];
|
|
1429
|
+
if (a += +u.percentage, s < a)
|
|
1423
1430
|
return {
|
|
1424
|
-
value:
|
|
1425
|
-
variationId:
|
|
1426
|
-
matchedPercentageOption:
|
|
1431
|
+
value: u.value,
|
|
1432
|
+
variationId: u.variationId,
|
|
1433
|
+
matchedPercentageOption: u
|
|
1427
1434
|
};
|
|
1428
1435
|
}
|
|
1429
1436
|
return null;
|
|
@@ -1439,44 +1446,44 @@ var oe = function() {
|
|
|
1439
1446
|
else
|
|
1440
1447
|
return !1;
|
|
1441
1448
|
switch (n) {
|
|
1442
|
-
case
|
|
1449
|
+
case g.NumberEqual:
|
|
1443
1450
|
return i === o;
|
|
1444
|
-
case
|
|
1451
|
+
case g.NumberNotEqual:
|
|
1445
1452
|
return i !== o;
|
|
1446
|
-
case
|
|
1453
|
+
case g.NumberLessThan:
|
|
1447
1454
|
return i < o;
|
|
1448
|
-
case
|
|
1455
|
+
case g.NumberLessThanEqual:
|
|
1449
1456
|
return i <= o;
|
|
1450
|
-
case
|
|
1457
|
+
case g.NumberGreaterThan:
|
|
1451
1458
|
return i > o;
|
|
1452
|
-
case
|
|
1459
|
+
case g.NumberGreaterThanEqual:
|
|
1453
1460
|
return i >= o;
|
|
1454
1461
|
}
|
|
1455
1462
|
return !1;
|
|
1456
1463
|
}, t.prototype.evaluateSemver = function(e, r, n) {
|
|
1457
|
-
if (this.logger.debug("RolloutEvaluator.EvaluateSemver() called."),
|
|
1464
|
+
if (this.logger.debug("RolloutEvaluator.EvaluateSemver() called."), W(e) == null || r === void 0)
|
|
1458
1465
|
return !1;
|
|
1459
1466
|
switch (r = r.trim(), n) {
|
|
1460
|
-
case
|
|
1467
|
+
case g.SemVerIn:
|
|
1461
1468
|
for (var i = r.split(","), o = !1, s = 0; s < i.length; s++)
|
|
1462
1469
|
if (!(!i[s] || i[s].trim() === "")) {
|
|
1463
|
-
if (
|
|
1470
|
+
if (W(i[s].trim()) == null)
|
|
1464
1471
|
return !1;
|
|
1465
|
-
o || (o =
|
|
1472
|
+
o || (o = mt(e, i[s].trim()));
|
|
1466
1473
|
}
|
|
1467
1474
|
return o;
|
|
1468
|
-
case
|
|
1475
|
+
case g.SemVerNotIn:
|
|
1469
1476
|
return !r.split(",").some(function(a) {
|
|
1470
|
-
return !a || a.trim() === "" || (a =
|
|
1477
|
+
return !a || a.trim() === "" || (a = W(a.trim()), a == null) ? !1 : Et(e, a);
|
|
1471
1478
|
});
|
|
1472
|
-
case
|
|
1473
|
-
return
|
|
1474
|
-
case
|
|
1475
|
-
return
|
|
1476
|
-
case
|
|
1477
|
-
return
|
|
1478
|
-
case
|
|
1479
|
-
return
|
|
1479
|
+
case g.SemVerLessThan:
|
|
1480
|
+
return W(r) == null ? !1 : bt(e, r);
|
|
1481
|
+
case g.SemVerLessThanEqual:
|
|
1482
|
+
return W(r) == null ? !1 : St(e, r);
|
|
1483
|
+
case g.SemVerGreaterThan:
|
|
1484
|
+
return W(r) == null ? !1 : Ot(e, r);
|
|
1485
|
+
case g.SemVerGreaterThanEqual:
|
|
1486
|
+
return W(r) == null ? !1 : Ct(e, r);
|
|
1480
1487
|
}
|
|
1481
1488
|
return !1;
|
|
1482
1489
|
}, t.prototype.getUserAttribute = function(e, r) {
|
|
@@ -1492,47 +1499,47 @@ var oe = function() {
|
|
|
1492
1499
|
}
|
|
1493
1500
|
}, t.prototype.ruleToString = function(e) {
|
|
1494
1501
|
switch (e) {
|
|
1495
|
-
case
|
|
1502
|
+
case g.In:
|
|
1496
1503
|
return "IS ONE OF";
|
|
1497
|
-
case
|
|
1504
|
+
case g.NotIn:
|
|
1498
1505
|
return "IS NOT ONE OF";
|
|
1499
|
-
case
|
|
1506
|
+
case g.Contains:
|
|
1500
1507
|
return "CONTAINS";
|
|
1501
|
-
case
|
|
1508
|
+
case g.NotContains:
|
|
1502
1509
|
return "DOES NOT CONTAIN";
|
|
1503
|
-
case
|
|
1510
|
+
case g.SemVerIn:
|
|
1504
1511
|
return "IS ONE OF (SemVer)";
|
|
1505
|
-
case
|
|
1512
|
+
case g.SemVerNotIn:
|
|
1506
1513
|
return "IS NOT ONE OF (SemVer)";
|
|
1507
|
-
case
|
|
1514
|
+
case g.SemVerLessThan:
|
|
1508
1515
|
return "< (SemVer)";
|
|
1509
|
-
case
|
|
1516
|
+
case g.SemVerLessThanEqual:
|
|
1510
1517
|
return "<= (SemVer)";
|
|
1511
|
-
case
|
|
1518
|
+
case g.SemVerGreaterThan:
|
|
1512
1519
|
return "> (SemVer)";
|
|
1513
|
-
case
|
|
1520
|
+
case g.SemVerGreaterThanEqual:
|
|
1514
1521
|
return ">= (SemVer)";
|
|
1515
|
-
case
|
|
1522
|
+
case g.NumberEqual:
|
|
1516
1523
|
return "= (Number)";
|
|
1517
|
-
case
|
|
1524
|
+
case g.NumberNotEqual:
|
|
1518
1525
|
return "!= (Number)";
|
|
1519
|
-
case
|
|
1526
|
+
case g.NumberLessThan:
|
|
1520
1527
|
return "< (Number)";
|
|
1521
|
-
case
|
|
1528
|
+
case g.NumberLessThanEqual:
|
|
1522
1529
|
return "<= (Number)";
|
|
1523
|
-
case
|
|
1530
|
+
case g.NumberGreaterThan:
|
|
1524
1531
|
return "> (Number)";
|
|
1525
|
-
case
|
|
1532
|
+
case g.NumberGreaterThanEqual:
|
|
1526
1533
|
return ">= (Number)";
|
|
1527
|
-
case
|
|
1534
|
+
case g.SensitiveOneOf:
|
|
1528
1535
|
return "IS ONE OF (Sensitive)";
|
|
1529
|
-
case
|
|
1536
|
+
case g.SensitiveNotOneOf:
|
|
1530
1537
|
return "IS NOT ONE OF (Sensitive)";
|
|
1531
1538
|
default:
|
|
1532
1539
|
return e + "";
|
|
1533
1540
|
}
|
|
1534
1541
|
}, t;
|
|
1535
|
-
}(),
|
|
1542
|
+
}(), wt = function() {
|
|
1536
1543
|
function t() {
|
|
1537
1544
|
this.operations = "";
|
|
1538
1545
|
}
|
|
@@ -1545,7 +1552,7 @@ var oe = function() {
|
|
|
1545
1552
|
` + this.operations + " Returning value : " + this.returnValue;
|
|
1546
1553
|
}, t;
|
|
1547
1554
|
}();
|
|
1548
|
-
function
|
|
1555
|
+
function Ge(t, e, r, n) {
|
|
1549
1556
|
return {
|
|
1550
1557
|
key: t,
|
|
1551
1558
|
value: e.value,
|
|
@@ -1557,7 +1564,7 @@ function He(t, e, r, n) {
|
|
|
1557
1564
|
matchedEvaluationPercentageRule: e.matchedPercentageOption
|
|
1558
1565
|
};
|
|
1559
1566
|
}
|
|
1560
|
-
function
|
|
1567
|
+
function _(t, e, r, n, i, o) {
|
|
1561
1568
|
return {
|
|
1562
1569
|
key: t,
|
|
1563
1570
|
value: e,
|
|
@@ -1568,51 +1575,51 @@ function X(t, e, r, n, i, o) {
|
|
|
1568
1575
|
errorException: o
|
|
1569
1576
|
};
|
|
1570
1577
|
}
|
|
1571
|
-
function
|
|
1578
|
+
function le(t, e, r, n, i, o, s) {
|
|
1572
1579
|
var a;
|
|
1573
1580
|
if (!e)
|
|
1574
|
-
return a = s.configJsonIsNotPresentSingle(r, "defaultValue", n).toString(),
|
|
1575
|
-
var
|
|
1576
|
-
if (!
|
|
1577
|
-
return a = s.settingEvaluationFailedDueToMissingKey(r, "defaultValue", n,
|
|
1578
|
-
var
|
|
1579
|
-
if (n != null && typeof n != typeof
|
|
1581
|
+
return a = s.configJsonIsNotPresentSingle(r, "defaultValue", n).toString(), _(r, n, x(o), i, a);
|
|
1582
|
+
var c = e[r];
|
|
1583
|
+
if (!c)
|
|
1584
|
+
return a = s.settingEvaluationFailedDueToMissingKey(r, "defaultValue", n, Tt(e)).toString(), _(r, n, x(o), i, a);
|
|
1585
|
+
var u = t.evaluate(c, r, n, i, o);
|
|
1586
|
+
if (n != null && typeof n != typeof u.value)
|
|
1580
1587
|
throw new TypeError(`The type of a setting must match the type of the given default value.
|
|
1581
|
-
The setting's type was
|
|
1582
|
-
Please pass a corresponding default value type.`)
|
|
1583
|
-
return
|
|
1588
|
+
The setting's type was ` + typeof n + ", the given default value's type was " + typeof u.value + `.
|
|
1589
|
+
Please pass a corresponding default value type.`);
|
|
1590
|
+
return Ge(r, u, x(o), i);
|
|
1584
1591
|
}
|
|
1585
1592
|
function Ke(t, e, r, n, i, o) {
|
|
1586
1593
|
var s;
|
|
1587
|
-
if (!
|
|
1594
|
+
if (!ye(e, i, o))
|
|
1588
1595
|
return [[], s];
|
|
1589
|
-
for (var a = [],
|
|
1590
|
-
var l = c
|
|
1596
|
+
for (var a = [], c = 0, u = Object.entries(e); c < u.length; c++) {
|
|
1597
|
+
var l = u[c], h = l[0], p = l[1], f = void 0;
|
|
1591
1598
|
try {
|
|
1592
|
-
var
|
|
1593
|
-
f =
|
|
1599
|
+
var d = t.evaluate(p, h, null, r, n);
|
|
1600
|
+
f = Ge(h, d, x(n), r);
|
|
1594
1601
|
} catch (y) {
|
|
1595
|
-
s ?? (s = []), s.push(y), f =
|
|
1602
|
+
s ?? (s = []), s.push(y), f = _(h, null, x(n), r, z(y), y);
|
|
1596
1603
|
}
|
|
1597
1604
|
a.push(f);
|
|
1598
1605
|
}
|
|
1599
1606
|
return [a, s];
|
|
1600
1607
|
}
|
|
1601
|
-
function
|
|
1608
|
+
function ye(t, e, r) {
|
|
1602
1609
|
return t ? !0 : (e.configJsonIsNotPresent(r), !1);
|
|
1603
1610
|
}
|
|
1604
|
-
function
|
|
1611
|
+
function Je(t) {
|
|
1605
1612
|
return t == null || typeof t == "boolean" || typeof t == "number" || typeof t == "string";
|
|
1606
1613
|
}
|
|
1607
|
-
function
|
|
1614
|
+
function x(t) {
|
|
1608
1615
|
return t ? new Date(t.timestamp) : void 0;
|
|
1609
1616
|
}
|
|
1610
|
-
function
|
|
1617
|
+
function Tt(t) {
|
|
1611
1618
|
return Object.keys(t).map(function(e) {
|
|
1612
|
-
return "'"
|
|
1619
|
+
return "'" + e + "'";
|
|
1613
1620
|
}).join(", ");
|
|
1614
1621
|
}
|
|
1615
|
-
var
|
|
1622
|
+
var It = function() {
|
|
1616
1623
|
function t() {
|
|
1617
1624
|
this.instances = {};
|
|
1618
1625
|
}
|
|
@@ -1624,8 +1631,8 @@ var Lt = function() {
|
|
|
1624
1631
|
return [n, !0];
|
|
1625
1632
|
}
|
|
1626
1633
|
var s = {};
|
|
1627
|
-
n = new
|
|
1628
|
-
var a =
|
|
1634
|
+
n = new be(e, r, s);
|
|
1635
|
+
var a = dt() ? WeakRef : pt();
|
|
1629
1636
|
return this.instances[e.apiKey] = [new a(n), s], [n, !1];
|
|
1630
1637
|
}, t.prototype.remove = function(e, r) {
|
|
1631
1638
|
var n = this.instances[e];
|
|
@@ -1642,7 +1649,7 @@ var Lt = function() {
|
|
|
1642
1649
|
}
|
|
1643
1650
|
return e;
|
|
1644
1651
|
}, t;
|
|
1645
|
-
}(),
|
|
1652
|
+
}(), Y = new It(), be = function() {
|
|
1646
1653
|
function t(e, r, n) {
|
|
1647
1654
|
var i;
|
|
1648
1655
|
if (this.cacheToken = n, this.addListener = this.on, this.off = this.removeListener, !e)
|
|
@@ -1651,38 +1658,33 @@ var Lt = function() {
|
|
|
1651
1658
|
throw new Error("Invalid 'configCatKernel' value");
|
|
1652
1659
|
if (!r.configFetcher)
|
|
1653
1660
|
throw new Error("Invalid 'configCatKernel.configFetcher' value");
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
}();
|
|
1658
|
-
this.configService = new o(r.configFetcher, e);
|
|
1659
|
-
} else
|
|
1660
|
-
this.options.hooks.emit("clientReady");
|
|
1661
|
-
this.suppressFinalize = re(this, { sdkKey: e.apiKey, cacheToken: n, configService: this.configService, logger: e.logger });
|
|
1661
|
+
e.defaultUser && this.setDefaultUser(e.defaultUser), this.evaluator = new At(e.logger), ((i = e.flagOverrides) === null || i === void 0 ? void 0 : i.behaviour) !== P.LocalOnly ? this.configService = e instanceof He ? new rt(r.configFetcher, e) : e instanceof je ? new ct(r.configFetcher, e) : e instanceof qe ? new ut(r.configFetcher, e) : function() {
|
|
1662
|
+
throw new Error("Invalid 'options' value");
|
|
1663
|
+
}() : this.options.hooks.emit("clientReady", L.HasLocalOverrideFlagDataOnly), this.suppressFinalize = se(this, { sdkKey: e.apiKey, cacheToken: n, configService: this.configService, logger: e.logger });
|
|
1662
1664
|
}
|
|
1663
1665
|
return Object.defineProperty(t, "instanceCache", {
|
|
1664
1666
|
get: function() {
|
|
1665
|
-
return
|
|
1667
|
+
return Y;
|
|
1666
1668
|
},
|
|
1667
1669
|
enumerable: !1,
|
|
1668
1670
|
configurable: !0
|
|
1669
1671
|
}), t.get = function(e, r, n, i) {
|
|
1670
1672
|
if (!e)
|
|
1671
1673
|
throw new Error("Invalid 'sdkKey' value");
|
|
1672
|
-
var o = r ===
|
|
1674
|
+
var o = r === j.AutoPoll ? He : r === j.ManualPoll ? je : r === j.LazyLoad ? qe : function() {
|
|
1673
1675
|
throw new Error("Invalid 'pollingMode' value");
|
|
1674
|
-
}(), s = new o(e, i.sdkType, i.sdkVersion, n, i.defaultCacheFactory, i.eventEmitterFactory), a =
|
|
1675
|
-
return
|
|
1676
|
+
}(), s = new o(e, i.sdkType, i.sdkVersion, n, i.defaultCacheFactory, i.eventEmitterFactory), a = Y.getOrCreate(s, i), c = a[0], u = a[1];
|
|
1677
|
+
return u && n && s.logger.clientIsAlreadyCreated(e), c;
|
|
1676
1678
|
}, t.finalize = function(e) {
|
|
1677
1679
|
var r;
|
|
1678
|
-
(r = e.logger) === null || r === void 0 || r.debug("finalize() called"), e.cacheToken &&
|
|
1680
|
+
(r = e.logger) === null || r === void 0 || r.debug("finalize() called"), e.cacheToken && Y.remove(e.sdkKey, e.cacheToken), t.close(e.configService, e.logger);
|
|
1679
1681
|
}, t.close = function(e, r, n) {
|
|
1680
1682
|
r == null || r.debug("close() called"), n == null || n.tryDisconnect(), e == null || e.dispose();
|
|
1681
1683
|
}, t.prototype.dispose = function() {
|
|
1682
1684
|
var e = this.options;
|
|
1683
|
-
e.logger.debug("dispose() called"), this.cacheToken &&
|
|
1685
|
+
e.logger.debug("dispose() called"), this.cacheToken && Y.remove(e.apiKey, this.cacheToken), t.close(this.configService, e.logger, e.hooks), this.suppressFinalize();
|
|
1684
1686
|
}, t.disposeAll = function() {
|
|
1685
|
-
for (var e =
|
|
1687
|
+
for (var e = Y.clear(), r, n = 0, i = e; n < i.length; n++) {
|
|
1686
1688
|
var o = i[n];
|
|
1687
1689
|
try {
|
|
1688
1690
|
t.close(o.configService, o.options.logger, o.options.hooks), o.suppressFinalize();
|
|
@@ -1694,17 +1696,17 @@ var Lt = function() {
|
|
|
1694
1696
|
throw typeof AggregateError < "u" ? new AggregateError(r) : r.pop();
|
|
1695
1697
|
}, t.prototype.getValueAsync = function(e, r, n) {
|
|
1696
1698
|
return S(this, void 0, void 0, function() {
|
|
1697
|
-
var i, o, s, a,
|
|
1699
|
+
var i, o, s, a, c, u;
|
|
1698
1700
|
return O(this, function(l) {
|
|
1699
1701
|
switch (l.label) {
|
|
1700
1702
|
case 0:
|
|
1701
|
-
this.options.logger.debug("getValueAsync() called."),
|
|
1703
|
+
this.options.logger.debug("getValueAsync() called."), fe(e), he(r), s = null, n ?? (n = this.defaultUser), l.label = 1;
|
|
1702
1704
|
case 1:
|
|
1703
1705
|
return l.trys.push([1, 3, , 4]), a = void 0, [4, this.getSettingsAsync()];
|
|
1704
1706
|
case 2:
|
|
1705
|
-
return
|
|
1707
|
+
return u = l.sent(), a = u[0], s = u[1], o = le(this.evaluator, a, e, r, n, s, this.options.logger), i = o.value, [3, 4];
|
|
1706
1708
|
case 3:
|
|
1707
|
-
return
|
|
1709
|
+
return c = l.sent(), this.options.logger.settingEvaluationErrorSingle("getValueAsync", e, "defaultValue", r, c), o = _(e, r, x(s), n, z(c), c), i = r, [3, 4];
|
|
1708
1710
|
case 4:
|
|
1709
1711
|
return this.options.hooks.emit("flagEvaluated", o), [2, i];
|
|
1710
1712
|
}
|
|
@@ -1712,17 +1714,17 @@ var Lt = function() {
|
|
|
1712
1714
|
});
|
|
1713
1715
|
}, t.prototype.getValueDetailsAsync = function(e, r, n) {
|
|
1714
1716
|
return S(this, void 0, void 0, function() {
|
|
1715
|
-
var i, o, s, a,
|
|
1716
|
-
return O(this, function(
|
|
1717
|
-
switch (
|
|
1717
|
+
var i, o, s, a, c;
|
|
1718
|
+
return O(this, function(u) {
|
|
1719
|
+
switch (u.label) {
|
|
1718
1720
|
case 0:
|
|
1719
|
-
this.options.logger.debug("getValueDetailsAsync() called."),
|
|
1721
|
+
this.options.logger.debug("getValueDetailsAsync() called."), fe(e), he(r), o = null, n ?? (n = this.defaultUser), u.label = 1;
|
|
1720
1722
|
case 1:
|
|
1721
|
-
return
|
|
1723
|
+
return u.trys.push([1, 3, , 4]), s = void 0, [4, this.getSettingsAsync()];
|
|
1722
1724
|
case 2:
|
|
1723
|
-
return
|
|
1725
|
+
return c = u.sent(), s = c[0], o = c[1], i = le(this.evaluator, s, e, r, n, o, this.options.logger), [3, 4];
|
|
1724
1726
|
case 3:
|
|
1725
|
-
return a =
|
|
1727
|
+
return a = u.sent(), this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync", e, "defaultValue", r, a), i = _(e, r, x(o), n, z(a), a), [3, 4];
|
|
1726
1728
|
case 4:
|
|
1727
1729
|
return this.options.hooks.emit("flagEvaluated", i), [2, i];
|
|
1728
1730
|
}
|
|
@@ -1738,7 +1740,7 @@ var Lt = function() {
|
|
|
1738
1740
|
case 1:
|
|
1739
1741
|
return i.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
|
|
1740
1742
|
case 2:
|
|
1741
|
-
return r = i.sent()[0],
|
|
1743
|
+
return r = i.sent()[0], ye(r, this.options.logger, e) ? [2, Object.keys(r)] : [2, []];
|
|
1742
1744
|
case 3:
|
|
1743
1745
|
return n = i.sent(), this.options.logger.settingEvaluationError("getAllKeysAsync", e, n), [2, []];
|
|
1744
1746
|
case 4:
|
|
@@ -1748,31 +1750,29 @@ var Lt = function() {
|
|
|
1748
1750
|
});
|
|
1749
1751
|
}, t.prototype.getAllValuesAsync = function(e) {
|
|
1750
1752
|
return S(this, void 0, void 0, function() {
|
|
1751
|
-
var r, n, i, o, s, a,
|
|
1752
|
-
return O(this, function(
|
|
1753
|
-
switch (
|
|
1753
|
+
var r, n, i, o, s, a, c, u, l, h, p, f;
|
|
1754
|
+
return O(this, function(d) {
|
|
1755
|
+
switch (d.label) {
|
|
1754
1756
|
case 0:
|
|
1755
|
-
this.options.logger.debug("getAllValuesAsync() called."), r = "empty array", e ?? (e = this.defaultUser),
|
|
1757
|
+
this.options.logger.debug("getAllValuesAsync() called."), r = "empty array", e ?? (e = this.defaultUser), d.label = 1;
|
|
1756
1758
|
case 1:
|
|
1757
|
-
return
|
|
1759
|
+
return d.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
|
|
1758
1760
|
case 2:
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1761
|
+
return s = d.sent(), a = s[0], c = s[1], f = Ke(this.evaluator, a, e, c, this.options.logger, r), i = f[0], o = f[1], n = i.map(function(y) {
|
|
1762
|
+
return new ne(y.key, y.value);
|
|
1763
|
+
}), [3, 4];
|
|
1762
1764
|
case 3:
|
|
1763
|
-
return u =
|
|
1765
|
+
return u = d.sent(), this.options.logger.settingEvaluationError("getAllValuesAsync", r, u), [2, []];
|
|
1764
1766
|
case 4:
|
|
1765
|
-
for (
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
v = g[l], this.options.hooks.emit("flagEvaluated", v);
|
|
1769
|
-
return [2, c];
|
|
1767
|
+
for (o != null && o.length && this.options.logger.settingEvaluationError("getAllValuesAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(o) : o.pop()), l = 0, h = i; l < h.length; l++)
|
|
1768
|
+
p = h[l], this.options.hooks.emit("flagEvaluated", p);
|
|
1769
|
+
return [2, n];
|
|
1770
1770
|
}
|
|
1771
1771
|
});
|
|
1772
1772
|
});
|
|
1773
1773
|
}, t.prototype.getAllValueDetailsAsync = function(e) {
|
|
1774
1774
|
return S(this, void 0, void 0, function() {
|
|
1775
|
-
var r, n, i, o, s, a,
|
|
1775
|
+
var r, n, i, o, s, a, c, u, l, h, p;
|
|
1776
1776
|
return O(this, function(f) {
|
|
1777
1777
|
switch (f.label) {
|
|
1778
1778
|
case 0:
|
|
@@ -1780,21 +1780,19 @@ var Lt = function() {
|
|
|
1780
1780
|
case 1:
|
|
1781
1781
|
return f.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
|
|
1782
1782
|
case 2:
|
|
1783
|
-
|
|
1784
|
-
throw typeof AggregateError < "u" ? new AggregateError(a) : a.pop();
|
|
1785
|
-
return [3, 4];
|
|
1783
|
+
return o = f.sent(), s = o[0], a = o[1], p = Ke(this.evaluator, s, e, a, this.options.logger, r), n = p[0], i = p[1], [3, 4];
|
|
1786
1784
|
case 3:
|
|
1787
|
-
return
|
|
1785
|
+
return c = f.sent(), this.options.logger.settingEvaluationError("getAllValueDetailsAsync", r, c), [2, []];
|
|
1788
1786
|
case 4:
|
|
1789
|
-
for (
|
|
1790
|
-
|
|
1787
|
+
for (i != null && i.length && this.options.logger.settingEvaluationError("getAllValueDetailsAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(i) : i.pop()), u = 0, l = n; u < l.length; u++)
|
|
1788
|
+
h = l[u], this.options.hooks.emit("flagEvaluated", h);
|
|
1791
1789
|
return [2, n];
|
|
1792
1790
|
}
|
|
1793
1791
|
});
|
|
1794
1792
|
});
|
|
1795
1793
|
}, t.prototype.getKeyAndValueAsync = function(e) {
|
|
1796
1794
|
return S(this, void 0, void 0, function() {
|
|
1797
|
-
var r, n, i, o, s, a,
|
|
1795
|
+
var r, n, i, o, s, a, c, u, p, l, h, p, f, d;
|
|
1798
1796
|
return O(this, function(y) {
|
|
1799
1797
|
switch (y.label) {
|
|
1800
1798
|
case 0:
|
|
@@ -1802,25 +1800,25 @@ var Lt = function() {
|
|
|
1802
1800
|
case 1:
|
|
1803
1801
|
return y.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
|
|
1804
1802
|
case 2:
|
|
1805
|
-
if (n = y.sent()[0], !
|
|
1803
|
+
if (n = y.sent()[0], !ye(n, this.options.logger, r))
|
|
1806
1804
|
return [2, null];
|
|
1807
1805
|
for (i = 0, o = Object.entries(n); i < o.length; i++) {
|
|
1808
|
-
if (s = o[i], a = s[0],
|
|
1809
|
-
return [2, new
|
|
1810
|
-
if (
|
|
1811
|
-
for (
|
|
1812
|
-
if (l =
|
|
1813
|
-
return [2, new
|
|
1806
|
+
if (s = o[i], a = s[0], c = s[1], e === c.variationId)
|
|
1807
|
+
return [2, new ne(a, c.value)];
|
|
1808
|
+
if (u = n[a].targetingRules, u && u.length > 0) {
|
|
1809
|
+
for (p = 0; p < u.length; p++)
|
|
1810
|
+
if (l = u[p], e === l.variationId)
|
|
1811
|
+
return [2, new ne(a, l.value)];
|
|
1814
1812
|
}
|
|
1815
|
-
if (
|
|
1816
|
-
for (
|
|
1817
|
-
if (f =
|
|
1818
|
-
return [2, new
|
|
1813
|
+
if (h = n[a].percentageOptions, h && h.length > 0) {
|
|
1814
|
+
for (p = 0; p < h.length; p++)
|
|
1815
|
+
if (f = h[p], e === f.variationId)
|
|
1816
|
+
return [2, new ne(a, f.value)];
|
|
1819
1817
|
}
|
|
1820
1818
|
}
|
|
1821
1819
|
return this.options.logger.settingForVariationIdIsNotPresent(e), [3, 4];
|
|
1822
1820
|
case 3:
|
|
1823
|
-
return
|
|
1821
|
+
return d = y.sent(), this.options.logger.settingEvaluationError("getKeyAndValueAsync", r, d), [3, 4];
|
|
1824
1822
|
case 4:
|
|
1825
1823
|
return [2, null];
|
|
1826
1824
|
}
|
|
@@ -1840,11 +1838,11 @@ var Lt = function() {
|
|
|
1840
1838
|
case 2:
|
|
1841
1839
|
return e = n.sent()[0], [2, e];
|
|
1842
1840
|
case 3:
|
|
1843
|
-
return r = n.sent(), this.options.logger.forceRefreshError("forceRefreshAsync", r), [2,
|
|
1841
|
+
return r = n.sent(), this.options.logger.forceRefreshError("forceRefreshAsync", r), [2, ae.failure(z(r), r)];
|
|
1844
1842
|
case 4:
|
|
1845
1843
|
return [3, 6];
|
|
1846
1844
|
case 5:
|
|
1847
|
-
return [2,
|
|
1845
|
+
return [2, ae.failure("Client is configured to use the LocalOnly override behavior, which prevents making HTTP requests.")];
|
|
1848
1846
|
case 6:
|
|
1849
1847
|
return [2];
|
|
1850
1848
|
}
|
|
@@ -1862,37 +1860,56 @@ var Lt = function() {
|
|
|
1862
1860
|
enumerable: !1,
|
|
1863
1861
|
configurable: !0
|
|
1864
1862
|
}), t.prototype.setOnline = function() {
|
|
1865
|
-
this.configService ? this.configService.setOnline() : this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(
|
|
1863
|
+
this.configService ? this.configService.setOnline() : this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(P[P.LocalOnly], "setOnline");
|
|
1866
1864
|
}, t.prototype.setOffline = function() {
|
|
1867
1865
|
var e;
|
|
1868
1866
|
(e = this.configService) === null || e === void 0 || e.setOffline();
|
|
1867
|
+
}, t.prototype.waitForReady = function() {
|
|
1868
|
+
return this.options.readyPromise;
|
|
1869
|
+
}, t.prototype.snapshot = function() {
|
|
1870
|
+
var e, r, n, i = this, o, s = function() {
|
|
1871
|
+
var h = i.options.cache.getInMemory(), p = h.isEmpty ? null : h.config.settings;
|
|
1872
|
+
return [p, h];
|
|
1873
|
+
}, a, c, u = (o = this.options) === null || o === void 0 ? void 0 : o.flagOverrides;
|
|
1874
|
+
if (u) {
|
|
1875
|
+
var l = u.dataSource.getOverridesSync();
|
|
1876
|
+
switch (u.behaviour) {
|
|
1877
|
+
case P.LocalOnly:
|
|
1878
|
+
return new re(l, null, this);
|
|
1879
|
+
case P.LocalOverRemote:
|
|
1880
|
+
return e = s(), a = e[0], c = e[1], new re(k(k({}, a ?? {}), l), c, this);
|
|
1881
|
+
case P.RemoteOverLocal:
|
|
1882
|
+
return r = s(), a = r[0], c = r[1], new re(k(k({}, l), a ?? {}), c, this);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
return n = s(), a = n[0], c = n[1], new re(a, c, this);
|
|
1869
1886
|
}, t.prototype.getSettingsAsync = function() {
|
|
1870
1887
|
var e;
|
|
1871
1888
|
return S(this, void 0, void 0, function() {
|
|
1872
|
-
var r, n, i, o, s, a,
|
|
1873
|
-
return O(this, function(
|
|
1874
|
-
switch (
|
|
1889
|
+
var r, n, i, o, s, a, c, u, l = this;
|
|
1890
|
+
return O(this, function(h) {
|
|
1891
|
+
switch (h.label) {
|
|
1875
1892
|
case 0:
|
|
1876
1893
|
return this.options.logger.debug("getSettingsAsync() called."), r = function() {
|
|
1877
1894
|
return S(l, void 0, void 0, function() {
|
|
1878
|
-
var
|
|
1879
|
-
return O(this, function(
|
|
1880
|
-
switch (
|
|
1895
|
+
var p, f;
|
|
1896
|
+
return O(this, function(d) {
|
|
1897
|
+
switch (d.label) {
|
|
1881
1898
|
case 0:
|
|
1882
1899
|
return [4, this.configService.getConfig()];
|
|
1883
1900
|
case 1:
|
|
1884
|
-
return
|
|
1901
|
+
return p = d.sent(), f = p.isEmpty ? null : p.config.settings, [2, [f, p]];
|
|
1885
1902
|
}
|
|
1886
1903
|
});
|
|
1887
1904
|
});
|
|
1888
1905
|
}, n = (e = this.options) === null || e === void 0 ? void 0 : e.flagOverrides, n ? (i = void 0, o = void 0, [4, n.dataSource.getOverrides()]) : [3, 7];
|
|
1889
1906
|
case 1:
|
|
1890
|
-
switch (s =
|
|
1891
|
-
case
|
|
1907
|
+
switch (s = h.sent(), a = n.behaviour, a) {
|
|
1908
|
+
case P.LocalOnly:
|
|
1892
1909
|
return [3, 2];
|
|
1893
|
-
case
|
|
1910
|
+
case P.LocalOverRemote:
|
|
1894
1911
|
return [3, 3];
|
|
1895
|
-
case
|
|
1912
|
+
case P.RemoteOverLocal:
|
|
1896
1913
|
return [3, 5];
|
|
1897
1914
|
}
|
|
1898
1915
|
return [3, 7];
|
|
@@ -1901,15 +1918,15 @@ var Lt = function() {
|
|
|
1901
1918
|
case 3:
|
|
1902
1919
|
return [4, r()];
|
|
1903
1920
|
case 4:
|
|
1904
|
-
return
|
|
1921
|
+
return c = h.sent(), i = c[0], o = c[1], [2, [k(k({}, i ?? {}), s), o]];
|
|
1905
1922
|
case 5:
|
|
1906
1923
|
return [4, r()];
|
|
1907
1924
|
case 6:
|
|
1908
|
-
return
|
|
1925
|
+
return u = h.sent(), i = u[0], o = u[1], [2, [k(k({}, s), i ?? {}), o]];
|
|
1909
1926
|
case 7:
|
|
1910
1927
|
return [4, r()];
|
|
1911
1928
|
case 8:
|
|
1912
|
-
return [2,
|
|
1929
|
+
return [2, h.sent()];
|
|
1913
1930
|
}
|
|
1914
1931
|
});
|
|
1915
1932
|
});
|
|
@@ -1928,126 +1945,227 @@ var Lt = function() {
|
|
|
1928
1945
|
}, t.prototype.eventNames = function() {
|
|
1929
1946
|
return this.options.hooks.eventNames();
|
|
1930
1947
|
}, t;
|
|
1931
|
-
}(),
|
|
1948
|
+
}(), re = function() {
|
|
1949
|
+
function t(e, r, n) {
|
|
1950
|
+
this.mergedSettings = e, this.remoteConfig = r, this.defaultUser = n.defaultUser, this.evaluator = n.evaluator, this.options = n.options;
|
|
1951
|
+
}
|
|
1952
|
+
return Object.defineProperty(t.prototype, "fetchedConfig", {
|
|
1953
|
+
get: function() {
|
|
1954
|
+
var e = this.remoteConfig;
|
|
1955
|
+
return e && !e.isEmpty ? e.config : null;
|
|
1956
|
+
},
|
|
1957
|
+
enumerable: !1,
|
|
1958
|
+
configurable: !0
|
|
1959
|
+
}), t.prototype.getAllKeys = function() {
|
|
1960
|
+
return this.mergedSettings ? Object.keys(this.mergedSettings) : [];
|
|
1961
|
+
}, t.prototype.getValue = function(e, r, n) {
|
|
1962
|
+
this.options.logger.debug("Snapshot.getValue() called."), fe(e), he(r);
|
|
1963
|
+
var i, o;
|
|
1964
|
+
n ?? (n = this.defaultUser);
|
|
1965
|
+
try {
|
|
1966
|
+
o = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger), i = o.value;
|
|
1967
|
+
} catch (s) {
|
|
1968
|
+
this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue", e, "defaultValue", r, s), o = _(e, r, x(this.remoteConfig), n, z(s), s), i = r;
|
|
1969
|
+
}
|
|
1970
|
+
return this.options.hooks.emit("flagEvaluated", o), i;
|
|
1971
|
+
}, t.prototype.getValueDetails = function(e, r, n) {
|
|
1972
|
+
this.options.logger.debug("Snapshot.getValueDetails() called."), fe(e), he(r);
|
|
1973
|
+
var i;
|
|
1974
|
+
n ?? (n = this.defaultUser);
|
|
1975
|
+
try {
|
|
1976
|
+
i = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger);
|
|
1977
|
+
} catch (o) {
|
|
1978
|
+
this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails", e, "defaultValue", r, o), i = _(e, r, x(this.remoteConfig), n, z(o), o);
|
|
1979
|
+
}
|
|
1980
|
+
return this.options.hooks.emit("flagEvaluated", i), i;
|
|
1981
|
+
}, t;
|
|
1982
|
+
}(), ne = function() {
|
|
1932
1983
|
function t(e, r) {
|
|
1933
1984
|
this.settingKey = e, this.settingValue = r;
|
|
1934
1985
|
}
|
|
1935
1986
|
return t;
|
|
1936
1987
|
}();
|
|
1937
|
-
function
|
|
1988
|
+
function fe(t) {
|
|
1938
1989
|
if (!t)
|
|
1939
1990
|
throw new Error("Invalid 'key' value");
|
|
1940
1991
|
}
|
|
1941
|
-
function
|
|
1942
|
-
if (!
|
|
1992
|
+
function he(t) {
|
|
1993
|
+
if (!Je(t))
|
|
1943
1994
|
throw new TypeError("The default value must be boolean, number, string, null or undefined.");
|
|
1944
1995
|
}
|
|
1945
|
-
var
|
|
1996
|
+
var se = function(t, e) {
|
|
1946
1997
|
if (typeof FinalizationRegistry < "u") {
|
|
1947
1998
|
var r = new FinalizationRegistry(function(n) {
|
|
1948
|
-
return
|
|
1999
|
+
return be.finalize(n);
|
|
1949
2000
|
});
|
|
1950
|
-
|
|
2001
|
+
se = function(n, i) {
|
|
1951
2002
|
var o = {};
|
|
1952
2003
|
return r.register(n, i, o), function() {
|
|
1953
2004
|
return r.unregister(o);
|
|
1954
2005
|
};
|
|
1955
2006
|
};
|
|
1956
2007
|
} else
|
|
1957
|
-
|
|
2008
|
+
se = function() {
|
|
1958
2009
|
return function() {
|
|
1959
2010
|
};
|
|
1960
2011
|
};
|
|
1961
|
-
return
|
|
2012
|
+
return se(t, e);
|
|
1962
2013
|
};
|
|
1963
|
-
|
|
1964
|
-
function
|
|
1965
|
-
return
|
|
2014
|
+
lt();
|
|
2015
|
+
function Nt(t, e, r, n) {
|
|
2016
|
+
return be.get(t, e, r, n);
|
|
1966
2017
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2018
|
+
function Rt(t) {
|
|
2019
|
+
return new Be(t);
|
|
2020
|
+
}
|
|
2021
|
+
const Lt = (t, e) => {
|
|
2022
|
+
const r = t.__vccOpts || t;
|
|
2023
|
+
for (const [n, i] of e)
|
|
2024
|
+
r[n] = i;
|
|
2025
|
+
return r;
|
|
2026
|
+
}, Dt = {
|
|
2027
|
+
emits: ["flagValueChanged"],
|
|
2028
|
+
props: {
|
|
2029
|
+
featureKey: {
|
|
2030
|
+
type: String,
|
|
2031
|
+
required: !0
|
|
2032
|
+
},
|
|
2033
|
+
userObject: {
|
|
2034
|
+
type: Object,
|
|
2035
|
+
required: !1,
|
|
2036
|
+
default: {}
|
|
1981
2037
|
}
|
|
1982
|
-
},
|
|
1983
|
-
|
|
1984
|
-
|
|
2038
|
+
},
|
|
2039
|
+
data() {
|
|
2040
|
+
return {
|
|
2041
|
+
isFeatureFlagEnabled: null
|
|
2042
|
+
};
|
|
2043
|
+
},
|
|
2044
|
+
beforeMount() {
|
|
2045
|
+
this.configChangedHandler = () => {
|
|
2046
|
+
const r = this.$configCat.client.snapshot().getValue(this.featureKey, !1, this.userObject);
|
|
2047
|
+
this.isFeatureFlagEnabled !== r && (this.isFeatureFlagEnabled = r, this.$emit("flagValueChanged", r));
|
|
2048
|
+
};
|
|
2049
|
+
const t = this.$configCat.clientReadyState;
|
|
2050
|
+
if (t == L.HasUpToDateFlagData || t == L.HasLocalOverrideFlagDataOnly) {
|
|
2051
|
+
const e = this.$configCat.client.snapshot();
|
|
2052
|
+
this.isFeatureFlagEnabled = e.getValue(this.featureKey, !1, this.userObject), this.$configCat.client.on("configChanged", this.configChangedHandler);
|
|
2053
|
+
} else
|
|
2054
|
+
this.$configCat.client.getValueAsync(this.featureKey, !1, this.userObject).then((e) => {
|
|
2055
|
+
const r = this.configChangedHandler;
|
|
2056
|
+
!r || (this.isFeatureFlagEnabled = e, this.$configCat.client.on("configChanged", r));
|
|
2057
|
+
});
|
|
2058
|
+
},
|
|
2059
|
+
unmounted() {
|
|
2060
|
+
const t = this.configChangedHandler;
|
|
2061
|
+
delete this.configChangedHandler, this.$configCat.client.off("configChanged", t);
|
|
1985
2062
|
}
|
|
1986
|
-
|
|
1987
|
-
|
|
2063
|
+
}, Ft = { key: 0 }, Pt = { key: 1 }, Ut = { key: 2 };
|
|
2064
|
+
function kt(t, e, r, n, i, o) {
|
|
2065
|
+
return Q(), ee("div", null, [
|
|
2066
|
+
i.isFeatureFlagEnabled === !0 ? (Q(), ee("div", Ft, [
|
|
2067
|
+
ge(t.$slots, "default")
|
|
2068
|
+
])) : i.isFeatureFlagEnabled === !1 ? (Q(), ee("div", Pt, [
|
|
2069
|
+
ge(t.$slots, "else")
|
|
2070
|
+
])) : (Q(), ee("div", Ut, [
|
|
2071
|
+
ge(t.$slots, "loading")
|
|
2072
|
+
]))
|
|
2073
|
+
]);
|
|
2074
|
+
}
|
|
2075
|
+
const qt = /* @__PURE__ */ Lt(Dt, [["render", kt]]);
|
|
2076
|
+
class Mt {
|
|
2077
|
+
handleStateChange(e, r, n) {
|
|
1988
2078
|
try {
|
|
1989
2079
|
if (e.readyState === 4) {
|
|
1990
|
-
|
|
1991
|
-
if (
|
|
1992
|
-
|
|
1993
|
-
r({ statusCode:
|
|
2080
|
+
const { status: i, statusText: o } = e;
|
|
2081
|
+
if (i === 200) {
|
|
2082
|
+
const s = e.getResponseHeader("ETag") ?? void 0;
|
|
2083
|
+
r({ statusCode: i, reasonPhrase: o, eTag: s, body: e.responseText });
|
|
1994
2084
|
} else
|
|
1995
|
-
|
|
2085
|
+
i && r({ statusCode: i, reasonPhrase: o });
|
|
1996
2086
|
}
|
|
1997
|
-
} catch (
|
|
1998
|
-
n(
|
|
2087
|
+
} catch (i) {
|
|
2088
|
+
n(i);
|
|
1999
2089
|
}
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
return new Promise(
|
|
2090
|
+
}
|
|
2091
|
+
fetchLogic(e) {
|
|
2092
|
+
return new Promise((r, n) => {
|
|
2003
2093
|
try {
|
|
2004
2094
|
e.logger.debug("HttpConfigFetcher.fetchLogic() called.");
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
return o(new ee("timeout", e.requestTimeoutMs));
|
|
2010
|
-
}, s.onabort = function() {
|
|
2011
|
-
return o(new ee("abort"));
|
|
2012
|
-
}, s.onerror = function() {
|
|
2013
|
-
return o(new ee("failure"));
|
|
2014
|
-
}, s.open("GET", e.getUrl(), !0), s.timeout = e.requestTimeoutMs, s.send(null);
|
|
2015
|
-
} catch (a) {
|
|
2016
|
-
o(a);
|
|
2095
|
+
const i = new XMLHttpRequest();
|
|
2096
|
+
i.onreadystatechange = () => this.handleStateChange(i, r, n), i.ontimeout = () => n(new ie("timeout", e.requestTimeoutMs)), i.onabort = () => n(new ie("abort")), i.onerror = () => n(new ie("failure")), i.open("GET", e.getUrl(), !0), i.timeout = e.requestTimeoutMs, i.send(null);
|
|
2097
|
+
} catch (i) {
|
|
2098
|
+
n(i);
|
|
2017
2099
|
}
|
|
2018
2100
|
});
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
sdkVersion: kt,
|
|
2027
|
-
defaultCacheFactory: function(n) {
|
|
2028
|
-
return new qe(new Dt(), n.logger);
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
class Vt {
|
|
2104
|
+
set(e, r) {
|
|
2105
|
+
try {
|
|
2106
|
+
localStorage.setItem(e, btoa(r));
|
|
2107
|
+
} catch {
|
|
2029
2108
|
}
|
|
2030
|
-
}
|
|
2109
|
+
}
|
|
2110
|
+
get(e) {
|
|
2111
|
+
try {
|
|
2112
|
+
const r = localStorage.getItem(e);
|
|
2113
|
+
if (r)
|
|
2114
|
+
return atob(r);
|
|
2115
|
+
} catch {
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2031
2118
|
}
|
|
2032
|
-
const
|
|
2119
|
+
const xt = "1.3.0", Wt = {
|
|
2033
2120
|
install: (t, e) => {
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
)
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2121
|
+
var a;
|
|
2122
|
+
const r = {
|
|
2123
|
+
client: void 0,
|
|
2124
|
+
clientReadyState: void 0
|
|
2125
|
+
}, n = (a = e.clientOptions) == null ? void 0 : a.setupHooks, i = {
|
|
2126
|
+
...e.clientOptions,
|
|
2127
|
+
setupHooks: (c) => {
|
|
2128
|
+
c.once("clientReady", (u) => r.clientReadyState = u), n == null || n(c);
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
let o = e.pollingMode === "manual" ? j.ManualPoll : e.pollingMode === "lazy" ? j.LazyLoad : j.AutoPoll;
|
|
2132
|
+
r.client = Nt(
|
|
2044
2133
|
e.SDKKey,
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2134
|
+
o,
|
|
2135
|
+
i,
|
|
2136
|
+
{
|
|
2137
|
+
sdkType: "ConfigCat-Vue",
|
|
2138
|
+
sdkVersion: xt,
|
|
2139
|
+
configFetcher: new Mt(),
|
|
2140
|
+
defaultCacheFactory: (c) => new _e(new Vt(), c.logger)
|
|
2141
|
+
}
|
|
2142
|
+
), t.config.globalProperties.$configCat = r;
|
|
2143
|
+
const s = t.unmount;
|
|
2144
|
+
t.unmount = function() {
|
|
2145
|
+
s.apply(this, arguments), configCatClient.close();
|
|
2146
|
+
};
|
|
2048
2147
|
}
|
|
2049
2148
|
};
|
|
2149
|
+
function Kt(t) {
|
|
2150
|
+
return Rt(t);
|
|
2151
|
+
}
|
|
2152
|
+
function zt(t, e) {
|
|
2153
|
+
return new at(new st(t), e);
|
|
2154
|
+
}
|
|
2050
2155
|
export {
|
|
2051
|
-
|
|
2052
|
-
|
|
2156
|
+
L as ClientReadyState,
|
|
2157
|
+
g as Comparator,
|
|
2158
|
+
Wt as ConfigCatPlugin,
|
|
2159
|
+
ue as DataGovernance,
|
|
2160
|
+
qt as FeatureWrapper,
|
|
2161
|
+
A as FormattableLogMessage,
|
|
2162
|
+
v as LogLevel,
|
|
2163
|
+
P as OverrideBehaviour,
|
|
2164
|
+
j as PollingMode,
|
|
2165
|
+
ae as RefreshResult,
|
|
2166
|
+
ne as SettingKeyValue,
|
|
2167
|
+
Se as SettingType,
|
|
2168
|
+
jt as User,
|
|
2169
|
+
Kt as createConsoleLogger,
|
|
2170
|
+
zt as createFlagOverridesFromMap
|
|
2053
2171
|
};
|