@statsig/js-on-device-eval-client 0.0.1-beta.10
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/.eslintrc.json +34 -0
- package/README.md +12 -0
- package/jest.config.ts +10 -0
- package/package.json +12 -0
- package/project.json +52 -0
- package/src/Errors.ts +6 -0
- package/src/EvaluationComparison.ts +189 -0
- package/src/EvaluationResult.ts +92 -0
- package/src/Evaluator.ts +493 -0
- package/src/Network.ts +30 -0
- package/src/SpecStore.ts +123 -0
- package/src/StatsigMetadataAdditions.ts +7 -0
- package/src/StatsigOnDeviceEvalClient.ts +197 -0
- package/src/StatsigOptions.ts +29 -0
- package/src/StatsigSpecsDataAdapter.ts +31 -0
- package/src/__tests__/EvaluationCallbacks.test.ts +118 -0
- package/src/__tests__/InitStrategyAwaited.test.ts +49 -0
- package/src/__tests__/InitStrategyBootstrap.test.ts +67 -0
- package/src/__tests__/InitStrategyDelayed.test.ts +65 -0
- package/src/__tests__/MockLocalStorage.ts +38 -0
- package/src/__tests__/dcs_response.json +484 -0
- package/src/index.ts +21 -0
- package/tsconfig.json +14 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +16 -0
- package/webpack.config.js +62 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
{
|
|
2
|
+
"__note": "Sample Response using the SDK Demo project",
|
|
3
|
+
"dynamic_configs": [
|
|
4
|
+
{
|
|
5
|
+
"name": "a_dynamic_config",
|
|
6
|
+
"type": "dynamic_config",
|
|
7
|
+
"salt": "5519338f-1c08-4673-b833-9e06ef7bfe3a",
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"defaultValue": {
|
|
10
|
+
"red": "#FF0000",
|
|
11
|
+
"blue": "#00FF00",
|
|
12
|
+
"green": "#0000FF"
|
|
13
|
+
},
|
|
14
|
+
"rules": [],
|
|
15
|
+
"isDeviceBased": false,
|
|
16
|
+
"idType": "userID",
|
|
17
|
+
"entity": "dynamic_config"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "another_experiment",
|
|
21
|
+
"type": "dynamic_config",
|
|
22
|
+
"salt": "a37c5e3d-f2f1-407e-9f91-5669de5de0fd",
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"defaultValue": {},
|
|
25
|
+
"rules": [
|
|
26
|
+
{
|
|
27
|
+
"name": "layerAssignment",
|
|
28
|
+
"groupName": "Layer Assignment",
|
|
29
|
+
"passPercentage": 100,
|
|
30
|
+
"conditions": [
|
|
31
|
+
{
|
|
32
|
+
"type": "user_bucket",
|
|
33
|
+
"targetValue": [-1],
|
|
34
|
+
"operator": "any",
|
|
35
|
+
"field": null,
|
|
36
|
+
"additionalValues": {
|
|
37
|
+
"salt": "daa8ca46-c742-4869-83be-43e00c59f704"
|
|
38
|
+
},
|
|
39
|
+
"isDeviceBased": false,
|
|
40
|
+
"idType": "userID"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"returnValue": {},
|
|
44
|
+
"id": "layerAssignment",
|
|
45
|
+
"salt": "",
|
|
46
|
+
"isDeviceBased": false,
|
|
47
|
+
"idType": "userID"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "3cOnAalaaO5dOXqAvGjLX9",
|
|
51
|
+
"groupName": "Control",
|
|
52
|
+
"passPercentage": 100,
|
|
53
|
+
"conditions": [
|
|
54
|
+
{
|
|
55
|
+
"type": "user_bucket",
|
|
56
|
+
"targetValue": 500,
|
|
57
|
+
"operator": "lt",
|
|
58
|
+
"field": null,
|
|
59
|
+
"additionalValues": {
|
|
60
|
+
"salt": "a37c5e3d-f2f1-407e-9f91-5669de5de0fd"
|
|
61
|
+
},
|
|
62
|
+
"isDeviceBased": false,
|
|
63
|
+
"idType": "userID"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"returnValue": {
|
|
67
|
+
"a_string": "control",
|
|
68
|
+
"a_bool": false
|
|
69
|
+
},
|
|
70
|
+
"id": "3cOnAalaaO5dOXqAvGjLX9",
|
|
71
|
+
"salt": "3cOnAalaaO5dOXqAvGjLX9",
|
|
72
|
+
"isDeviceBased": false,
|
|
73
|
+
"idType": "userID",
|
|
74
|
+
"isExperimentGroup": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "3cOnAc0cD6eI8mYw6Ofpgb",
|
|
78
|
+
"groupName": "Test",
|
|
79
|
+
"passPercentage": 100,
|
|
80
|
+
"conditions": [
|
|
81
|
+
{
|
|
82
|
+
"type": "user_bucket",
|
|
83
|
+
"targetValue": 1000,
|
|
84
|
+
"operator": "lt",
|
|
85
|
+
"field": null,
|
|
86
|
+
"additionalValues": {
|
|
87
|
+
"salt": "a37c5e3d-f2f1-407e-9f91-5669de5de0fd"
|
|
88
|
+
},
|
|
89
|
+
"isDeviceBased": false,
|
|
90
|
+
"idType": "userID"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"returnValue": {
|
|
94
|
+
"a_string": "test",
|
|
95
|
+
"a_bool": true
|
|
96
|
+
},
|
|
97
|
+
"id": "3cOnAc0cD6eI8mYw6Ofpgb",
|
|
98
|
+
"salt": "3cOnAc0cD6eI8mYw6Ofpgb",
|
|
99
|
+
"isDeviceBased": false,
|
|
100
|
+
"idType": "userID",
|
|
101
|
+
"isExperimentGroup": true
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"isDeviceBased": false,
|
|
105
|
+
"idType": "userID",
|
|
106
|
+
"entity": "experiment",
|
|
107
|
+
"isActive": true,
|
|
108
|
+
"hasSharedParams": false
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "three_groups",
|
|
112
|
+
"type": "dynamic_config",
|
|
113
|
+
"salt": "19ad889d-f4b5-4740-bcb2-72ff1896d438",
|
|
114
|
+
"enabled": true,
|
|
115
|
+
"defaultValue": {},
|
|
116
|
+
"rules": [
|
|
117
|
+
{
|
|
118
|
+
"name": "layerAssignment",
|
|
119
|
+
"groupName": "Layer Assignment",
|
|
120
|
+
"passPercentage": 100,
|
|
121
|
+
"conditions": [
|
|
122
|
+
{
|
|
123
|
+
"type": "user_bucket",
|
|
124
|
+
"targetValue": [-1],
|
|
125
|
+
"operator": "any",
|
|
126
|
+
"field": null,
|
|
127
|
+
"additionalValues": {
|
|
128
|
+
"salt": "87b91fb6-6d25-4f8e-a53c-73e49a72560f"
|
|
129
|
+
},
|
|
130
|
+
"isDeviceBased": false,
|
|
131
|
+
"idType": "userID"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"returnValue": {},
|
|
135
|
+
"id": "layerAssignment",
|
|
136
|
+
"salt": "",
|
|
137
|
+
"isDeviceBased": false,
|
|
138
|
+
"idType": "userID"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "1J6QLlETnyrV1XE2um2XiS",
|
|
142
|
+
"groupName": "Control",
|
|
143
|
+
"passPercentage": 100,
|
|
144
|
+
"conditions": [
|
|
145
|
+
{
|
|
146
|
+
"type": "user_bucket",
|
|
147
|
+
"targetValue": 334,
|
|
148
|
+
"operator": "lt",
|
|
149
|
+
"field": null,
|
|
150
|
+
"additionalValues": {
|
|
151
|
+
"salt": "19ad889d-f4b5-4740-bcb2-72ff1896d438"
|
|
152
|
+
},
|
|
153
|
+
"isDeviceBased": false,
|
|
154
|
+
"idType": "userID"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"returnValue": {
|
|
158
|
+
"a_string": "c"
|
|
159
|
+
},
|
|
160
|
+
"id": "1J6QLlETnyrV1XE2um2XiS",
|
|
161
|
+
"salt": "1J6QLlETnyrV1XE2um2XiS",
|
|
162
|
+
"isDeviceBased": false,
|
|
163
|
+
"idType": "userID",
|
|
164
|
+
"isExperimentGroup": true
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "1J6QLnjVPQBplnbY5tYABU",
|
|
168
|
+
"groupName": "Test",
|
|
169
|
+
"passPercentage": 100,
|
|
170
|
+
"conditions": [
|
|
171
|
+
{
|
|
172
|
+
"type": "user_bucket",
|
|
173
|
+
"targetValue": 667,
|
|
174
|
+
"operator": "lt",
|
|
175
|
+
"field": null,
|
|
176
|
+
"additionalValues": {
|
|
177
|
+
"salt": "19ad889d-f4b5-4740-bcb2-72ff1896d438"
|
|
178
|
+
},
|
|
179
|
+
"isDeviceBased": false,
|
|
180
|
+
"idType": "userID"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"returnValue": {
|
|
184
|
+
"a_string": "t"
|
|
185
|
+
},
|
|
186
|
+
"id": "1J6QLnjVPQBplnbY5tYABU",
|
|
187
|
+
"salt": "1J6QLnjVPQBplnbY5tYABU",
|
|
188
|
+
"isDeviceBased": false,
|
|
189
|
+
"idType": "userID",
|
|
190
|
+
"isExperimentGroup": true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "22NwxasoExmyIpd8Iy3m1o",
|
|
194
|
+
"groupName": "Test #2",
|
|
195
|
+
"passPercentage": 100,
|
|
196
|
+
"conditions": [
|
|
197
|
+
{
|
|
198
|
+
"type": "user_bucket",
|
|
199
|
+
"targetValue": 1000,
|
|
200
|
+
"operator": "lt",
|
|
201
|
+
"field": null,
|
|
202
|
+
"additionalValues": {
|
|
203
|
+
"salt": "19ad889d-f4b5-4740-bcb2-72ff1896d438"
|
|
204
|
+
},
|
|
205
|
+
"isDeviceBased": false,
|
|
206
|
+
"idType": "userID"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"returnValue": {
|
|
210
|
+
"a_string": "t2"
|
|
211
|
+
},
|
|
212
|
+
"id": "22NwxasoExmyIpd8Iy3m1o",
|
|
213
|
+
"salt": "22NwxasoExmyIpd8Iy3m1o",
|
|
214
|
+
"isDeviceBased": false,
|
|
215
|
+
"idType": "userID",
|
|
216
|
+
"isExperimentGroup": true
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"isDeviceBased": false,
|
|
220
|
+
"idType": "userID",
|
|
221
|
+
"entity": "experiment",
|
|
222
|
+
"isActive": true,
|
|
223
|
+
"hasSharedParams": false
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "an_experiment",
|
|
227
|
+
"type": "dynamic_config",
|
|
228
|
+
"salt": "f5c1b26a-6374-4f8b-8b9b-de2292019ecd",
|
|
229
|
+
"enabled": true,
|
|
230
|
+
"defaultValue": {
|
|
231
|
+
"a_string": "Layer Default Value"
|
|
232
|
+
},
|
|
233
|
+
"rules": [
|
|
234
|
+
{
|
|
235
|
+
"name": "layerAssignment",
|
|
236
|
+
"groupName": "Layer Assignment",
|
|
237
|
+
"passPercentage": 100,
|
|
238
|
+
"conditions": [
|
|
239
|
+
{
|
|
240
|
+
"type": "user_bucket",
|
|
241
|
+
"targetValue": [-1],
|
|
242
|
+
"operator": "any",
|
|
243
|
+
"field": null,
|
|
244
|
+
"additionalValues": {
|
|
245
|
+
"salt": "3269e41c-4c15-4da2-a8d3-85d01895b887"
|
|
246
|
+
},
|
|
247
|
+
"isDeviceBased": false,
|
|
248
|
+
"idType": "userID"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"returnValue": {
|
|
252
|
+
"a_string": "Layer Default Value"
|
|
253
|
+
},
|
|
254
|
+
"id": "layerAssignment",
|
|
255
|
+
"salt": "",
|
|
256
|
+
"isDeviceBased": false,
|
|
257
|
+
"idType": "userID"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"name": "49CGlRW56QYlkNSNzhUM2y",
|
|
261
|
+
"groupName": "Control",
|
|
262
|
+
"passPercentage": 100,
|
|
263
|
+
"conditions": [
|
|
264
|
+
{
|
|
265
|
+
"type": "user_bucket",
|
|
266
|
+
"targetValue": 500,
|
|
267
|
+
"operator": "lt",
|
|
268
|
+
"field": null,
|
|
269
|
+
"additionalValues": {
|
|
270
|
+
"salt": "f5c1b26a-6374-4f8b-8b9b-de2292019ecd"
|
|
271
|
+
},
|
|
272
|
+
"isDeviceBased": false,
|
|
273
|
+
"idType": "userID"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"returnValue": {
|
|
277
|
+
"a_string": "Experiment Control Value"
|
|
278
|
+
},
|
|
279
|
+
"id": "49CGlRW56QYlkNSNzhUM2y",
|
|
280
|
+
"salt": "49CGlRW56QYlkNSNzhUM2y",
|
|
281
|
+
"isDeviceBased": false,
|
|
282
|
+
"idType": "userID",
|
|
283
|
+
"isExperimentGroup": true
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "49CGlTB7z97PEdqJapQplA",
|
|
287
|
+
"groupName": "Test",
|
|
288
|
+
"passPercentage": 100,
|
|
289
|
+
"conditions": [
|
|
290
|
+
{
|
|
291
|
+
"type": "user_bucket",
|
|
292
|
+
"targetValue": 1000,
|
|
293
|
+
"operator": "lt",
|
|
294
|
+
"field": null,
|
|
295
|
+
"additionalValues": {
|
|
296
|
+
"salt": "f5c1b26a-6374-4f8b-8b9b-de2292019ecd"
|
|
297
|
+
},
|
|
298
|
+
"isDeviceBased": false,
|
|
299
|
+
"idType": "userID"
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"returnValue": {
|
|
303
|
+
"a_string": "Experiment Test Value"
|
|
304
|
+
},
|
|
305
|
+
"id": "49CGlTB7z97PEdqJapQplA",
|
|
306
|
+
"salt": "49CGlTB7z97PEdqJapQplA",
|
|
307
|
+
"isDeviceBased": false,
|
|
308
|
+
"idType": "userID",
|
|
309
|
+
"isExperimentGroup": true
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"isDeviceBased": false,
|
|
313
|
+
"idType": "userID",
|
|
314
|
+
"entity": "experiment",
|
|
315
|
+
"isActive": true,
|
|
316
|
+
"hasSharedParams": true,
|
|
317
|
+
"explicitParameters": ["a_string"]
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"feature_gates": [
|
|
321
|
+
{
|
|
322
|
+
"name": "third_gate",
|
|
323
|
+
"type": "feature_gate",
|
|
324
|
+
"salt": "f1261590-d48e-44b4-8f87-4eb9988d1174",
|
|
325
|
+
"enabled": true,
|
|
326
|
+
"defaultValue": false,
|
|
327
|
+
"rules": [
|
|
328
|
+
{
|
|
329
|
+
"name": "2XsjGYU4EC4c28B86AMCMx",
|
|
330
|
+
"groupName": "Specific User",
|
|
331
|
+
"passPercentage": 100,
|
|
332
|
+
"conditions": [
|
|
333
|
+
{
|
|
334
|
+
"type": "user_field",
|
|
335
|
+
"targetValue": ["1", "2", "3", "4", "5"],
|
|
336
|
+
"operator": "any",
|
|
337
|
+
"field": "userID",
|
|
338
|
+
"additionalValues": {},
|
|
339
|
+
"isDeviceBased": false,
|
|
340
|
+
"idType": "userID"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"returnValue": true,
|
|
344
|
+
"id": "2XsjGYU4EC4c28B86AMCMx",
|
|
345
|
+
"salt": "593d1d17-e7f5-4a33-ae3c-f7f300617945",
|
|
346
|
+
"isDeviceBased": false,
|
|
347
|
+
"idType": "userID"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"isDeviceBased": false,
|
|
351
|
+
"idType": "userID",
|
|
352
|
+
"entity": "feature_gate"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "partial_gate",
|
|
356
|
+
"type": "feature_gate",
|
|
357
|
+
"salt": "62afcf6d-2879-4a0b-8ffd-7b482d7da05d",
|
|
358
|
+
"enabled": true,
|
|
359
|
+
"defaultValue": false,
|
|
360
|
+
"rules": [
|
|
361
|
+
{
|
|
362
|
+
"name": "59nkHdlmIytrqNG9iT7gkd:50.00:2",
|
|
363
|
+
"groupName": "50/50",
|
|
364
|
+
"passPercentage": 50,
|
|
365
|
+
"conditions": [
|
|
366
|
+
{
|
|
367
|
+
"type": "public",
|
|
368
|
+
"targetValue": null,
|
|
369
|
+
"operator": null,
|
|
370
|
+
"field": null,
|
|
371
|
+
"additionalValues": {},
|
|
372
|
+
"isDeviceBased": false,
|
|
373
|
+
"idType": "userID"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"returnValue": true,
|
|
377
|
+
"id": "59nkHdlmIytrqNG9iT7gkd:50.00:2",
|
|
378
|
+
"salt": "235f34bc-3067-4947-a617-29bbbb1c5f62",
|
|
379
|
+
"isDeviceBased": false,
|
|
380
|
+
"idType": "userID"
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"isDeviceBased": false,
|
|
384
|
+
"idType": "userID",
|
|
385
|
+
"entity": "feature_gate"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "a_gate",
|
|
389
|
+
"type": "feature_gate",
|
|
390
|
+
"salt": "6ca5e892-2dd3-4607-8742-7c48fe92d265",
|
|
391
|
+
"enabled": true,
|
|
392
|
+
"defaultValue": false,
|
|
393
|
+
"rules": [
|
|
394
|
+
{
|
|
395
|
+
"name": "2QWhVkWdUEXR6Q3KYgV73O",
|
|
396
|
+
"groupName": "First gate rule",
|
|
397
|
+
"passPercentage": 100,
|
|
398
|
+
"conditions": [
|
|
399
|
+
{
|
|
400
|
+
"type": "public",
|
|
401
|
+
"targetValue": null,
|
|
402
|
+
"operator": null,
|
|
403
|
+
"field": null,
|
|
404
|
+
"additionalValues": {},
|
|
405
|
+
"isDeviceBased": false,
|
|
406
|
+
"idType": "userID"
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"returnValue": true,
|
|
410
|
+
"id": "2QWhVkWdUEXR6Q3KYgV73O",
|
|
411
|
+
"salt": "df505804-d3a5-48cb-949a-44fa378426d4",
|
|
412
|
+
"isDeviceBased": false,
|
|
413
|
+
"idType": "userID"
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
"isDeviceBased": false,
|
|
417
|
+
"idType": "userID",
|
|
418
|
+
"entity": "feature_gate"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"layers": {
|
|
422
|
+
"a_layer": ["an_experiment"]
|
|
423
|
+
},
|
|
424
|
+
"layer_configs": [
|
|
425
|
+
{
|
|
426
|
+
"name": "a_layer",
|
|
427
|
+
"type": "dynamic_config",
|
|
428
|
+
"salt": "3269e41c-4c15-4da2-a8d3-85d01895b887",
|
|
429
|
+
"enabled": true,
|
|
430
|
+
"defaultValue": {
|
|
431
|
+
"a_string": "Layer Default Value"
|
|
432
|
+
},
|
|
433
|
+
"rules": [
|
|
434
|
+
{
|
|
435
|
+
"name": "experimentAssignment",
|
|
436
|
+
"groupName": "Experiment Assignment",
|
|
437
|
+
"passPercentage": 100,
|
|
438
|
+
"conditions": [
|
|
439
|
+
{
|
|
440
|
+
"type": "public",
|
|
441
|
+
"targetValue": null,
|
|
442
|
+
"operator": null,
|
|
443
|
+
"field": null,
|
|
444
|
+
"additionalValues": {
|
|
445
|
+
"salt": "3269e41c-4c15-4da2-a8d3-85d01895b887"
|
|
446
|
+
},
|
|
447
|
+
"isDeviceBased": false,
|
|
448
|
+
"idType": "userID"
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"returnValue": {
|
|
452
|
+
"a_string": "Layer Default Value"
|
|
453
|
+
},
|
|
454
|
+
"id": "experimentAssignment",
|
|
455
|
+
"salt": "",
|
|
456
|
+
"isDeviceBased": false,
|
|
457
|
+
"idType": "userID",
|
|
458
|
+
"configDelegate": "an_experiment"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"isDeviceBased": false,
|
|
462
|
+
"idType": "userID",
|
|
463
|
+
"entity": "layer"
|
|
464
|
+
}
|
|
465
|
+
],
|
|
466
|
+
"has_updates": true,
|
|
467
|
+
"time": 1705543730484,
|
|
468
|
+
"company_id": "2etz0PtUkhGsJfH0mR6whu",
|
|
469
|
+
"id_lists": {},
|
|
470
|
+
"diagnostics": {
|
|
471
|
+
"initialize": 10000,
|
|
472
|
+
"dcs": 1000,
|
|
473
|
+
"download_config_specs": 1000,
|
|
474
|
+
"idlist": 100,
|
|
475
|
+
"get_id_list": 100,
|
|
476
|
+
"get_id_list_sources": 100,
|
|
477
|
+
"log": 100,
|
|
478
|
+
"log_event": 100,
|
|
479
|
+
"api_call": 100
|
|
480
|
+
},
|
|
481
|
+
"sdk_flags": {
|
|
482
|
+
"stop_log_event_compression": true
|
|
483
|
+
}
|
|
484
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './StatsigMetadataAdditions';
|
|
2
|
+
import StatsigOnDeviceEvalClient from './StatsigOnDeviceEvalClient';
|
|
3
|
+
import type { StatsigOptions } from './StatsigOptions';
|
|
4
|
+
import { StatsigSpecsDataAdapter } from './StatsigSpecsDataAdapter';
|
|
5
|
+
|
|
6
|
+
export type { StatsigOptions };
|
|
7
|
+
export { StatsigOnDeviceEvalClient, StatsigSpecsDataAdapter };
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
StatsigEnvironment,
|
|
11
|
+
StatsigEvent,
|
|
12
|
+
StatsigUser,
|
|
13
|
+
} from '@statsig/client-core';
|
|
14
|
+
|
|
15
|
+
__STATSIG__ = {
|
|
16
|
+
...(__STATSIG__ ?? {}),
|
|
17
|
+
StatsigSpecsDataAdapter,
|
|
18
|
+
StatsigOnDeviceEvalClient,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default __STATSIG__;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node"],
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"esModuleInterop": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"jest.config.ts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const { composePlugins, withNx, withWeb } = require('@nx/webpack');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const minifier = require('../../tools/scripts/webpack-minifier');
|
|
4
|
+
|
|
5
|
+
module.exports = composePlugins(withNx(), withWeb(), () =>
|
|
6
|
+
// config
|
|
7
|
+
{
|
|
8
|
+
return {
|
|
9
|
+
// Uncomment if you want to use webpack-bundle-analyzer
|
|
10
|
+
// plugins: config.plugins.filter(
|
|
11
|
+
// (x) => x.constructor.name === 'StatsJsonPlugin',
|
|
12
|
+
// ),
|
|
13
|
+
stats: {
|
|
14
|
+
assets: true,
|
|
15
|
+
modules: false,
|
|
16
|
+
colors: true,
|
|
17
|
+
},
|
|
18
|
+
entry: ['./dist/packages/js-on-device-eval-client/src/index.js'],
|
|
19
|
+
mode: 'production',
|
|
20
|
+
target: 'web',
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
'@statsig/client-core': path.resolve(
|
|
24
|
+
__dirname,
|
|
25
|
+
'../../dist/packages/client-core',
|
|
26
|
+
),
|
|
27
|
+
'@statsig/sha256': path.resolve(
|
|
28
|
+
__dirname,
|
|
29
|
+
'../../dist/packages/sha256',
|
|
30
|
+
),
|
|
31
|
+
},
|
|
32
|
+
extensions: ['.js'],
|
|
33
|
+
},
|
|
34
|
+
externals: [],
|
|
35
|
+
output: {
|
|
36
|
+
filename: 'statsig-js-on-device-eval-client.min.js',
|
|
37
|
+
library: {
|
|
38
|
+
type: 'umd',
|
|
39
|
+
name: {
|
|
40
|
+
root: 'StatsigOnDeviceEval',
|
|
41
|
+
amd: 'StatsigOnDeviceEval',
|
|
42
|
+
commonjs: 'StatsigOnDeviceEval',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
path: path.resolve(
|
|
46
|
+
__dirname,
|
|
47
|
+
'../../dist/packages/js-on-device-eval-client/build',
|
|
48
|
+
),
|
|
49
|
+
libraryExport: 'default',
|
|
50
|
+
globalObject: 'this',
|
|
51
|
+
},
|
|
52
|
+
performance: {
|
|
53
|
+
maxEntrypointSize: 45000,
|
|
54
|
+
hints: 'error',
|
|
55
|
+
},
|
|
56
|
+
optimization: {
|
|
57
|
+
minimize: true,
|
|
58
|
+
minimizer: [minifier],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
);
|