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