@protontech/autofill 0.0.35059265 → 0.0.35481761

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.
Files changed (44) hide show
  1. package/features/feature.d.ts +13 -2
  2. package/features/feature.js +37 -15
  3. package/features/feature.spec.js +56 -7
  4. package/features/v1/abstract.field.d.ts +8377 -406
  5. package/features/v1/abstract.field.js +24 -24
  6. package/features/v1/abstract.form.d.ts +3428 -14
  7. package/features/v1/abstract.form.js +197 -197
  8. package/features/v1/field.email.d.ts +3421 -0
  9. package/features/v1/field.email.js +7 -7
  10. package/features/v1/field.otp.d.ts +71178 -0
  11. package/features/v1/field.otp.js +42 -42
  12. package/features/v1/field.password.d.ts +99166 -0
  13. package/features/v1/field.password.js +42 -42
  14. package/features/v1/field.username-hidden.d.ts +908 -0
  15. package/features/v1/field.username-hidden.js +7 -7
  16. package/features/v1/field.username.d.ts +42382 -0
  17. package/features/v1/field.username.js +11 -11
  18. package/features/v1/fields.sorted.gen.d.ts +1441 -0
  19. package/features/v1/fields.sorted.gen.js +344 -0
  20. package/features/v1/forms.sorted.gen.d.ts +734 -0
  21. package/features/v1/forms.sorted.gen.js +334 -0
  22. package/features/v1/index.d.ts +5305 -12
  23. package/features/v1/index.js +7 -11
  24. package/features/v1/index.spec.js +34 -20
  25. package/models/perceptron/params/login-model.json +91 -91
  26. package/models/perceptron/params/new-password-model.json +21 -21
  27. package/models/perceptron/params/otp-model.json +29 -29
  28. package/models/perceptron/params/password-change-model.json +72 -72
  29. package/models/perceptron/params/password-model.json +23 -23
  30. package/models/perceptron/params/recovery-model.json +81 -81
  31. package/models/perceptron/params/register-model.json +99 -99
  32. package/models/perceptron/params/username-hidden-model.json +10 -10
  33. package/models/perceptron/params/username-model.json +7 -7
  34. package/models/random_forest/params/otp-model.json +306 -366
  35. package/package.json +3 -3
  36. package/rules/v1/index.js +2 -2
  37. package/scripts/gen-sorted-features.js +125 -29
  38. package/types/index.d.ts +2 -1
  39. package/utils/fathom.d.ts +1 -2
  40. package/utils/fathom.js +2 -2
  41. package/features/registry.d.ts +0 -3
  42. package/features/registry.js +0 -9
  43. package/features/sorted.gen.d.ts +0 -14
  44. package/features/sorted.gen.js +0 -22
@@ -1,18 +1,14 @@
1
- import { getComputerForFeatures } from "@protontech/autofill/features/feature";
2
- import { setFormFeaturesComputer } from "@protontech/autofill/features/registry";
3
- import { emailFeatureNames, fieldFeatureNames, formFeatureNames, otpFeatureNames, passwordFeatureNames, sortedEmailFeatures, sortedFieldFeatures, sortedFormFeatures, sortedOtpFeatures, sortedPasswordFeatures, sortedUsernameFeatures, sortedUsernameHiddenFeatures, usernameFeatureNames, usernameHiddenFeatureNames, } from "@protontech/autofill/features/sorted.gen";
4
- const formFeaturesComputer = getComputerForFeatures(sortedFormFeatures, formFeatureNames);
5
- setFormFeaturesComputer(formFeaturesComputer);
6
- const passwordFeaturesComputer = getComputerForFeatures(sortedPasswordFeatures, passwordFeatureNames);
1
+ import { emailFeaturesComputer, fieldFeaturesComputer, otpFeaturesComputer, passwordFeaturesComputer, usernameFeaturesComputer, usernameHiddenFeaturesComputer } from "@protontech/autofill/features/v1/fields.sorted.gen";
2
+ import { formFeaturesComputer } from "@protontech/autofill/features/v1/forms.sorted.gen";
7
3
  export const featureProvider = {
8
- field: getComputerForFeatures(sortedFieldFeatures, fieldFeatureNames),
4
+ field: fieldFeaturesComputer,
9
5
  form: formFeaturesComputer,
10
- email: getComputerForFeatures(sortedEmailFeatures, emailFeatureNames),
6
+ email: emailFeaturesComputer,
11
7
  "new-password": passwordFeaturesComputer,
12
- otp: getComputerForFeatures(sortedOtpFeatures, otpFeatureNames),
8
+ otp: otpFeaturesComputer,
13
9
  password: passwordFeaturesComputer,
14
- username: getComputerForFeatures(sortedUsernameFeatures, usernameFeatureNames),
15
- "username-hidden": getComputerForFeatures(sortedUsernameHiddenFeatures, usernameHiddenFeatureNames),
10
+ username: usernameFeaturesComputer,
11
+ "username-hidden": usernameHiddenFeaturesComputer,
16
12
  login: formFeaturesComputer,
17
13
  recovery: formFeaturesComputer,
18
14
  register: formFeaturesComputer,
@@ -6,25 +6,39 @@ import { otpFeatures } from "./field.otp";
6
6
  import { passwordFeatures } from "./field.password";
7
7
  import { usernameFeatures } from "./field.username";
8
8
  import { usernameHiddenFeatures } from "./field.username-hidden";
9
- describe("features can be topologically sorted", () => {
10
- const featureSets = {
11
- fieldFeatures,
12
- formFeatures,
13
- emailFeatures,
14
- otpFeatures,
15
- passwordFeatures,
16
- usernameHiddenFeatures,
17
- usernameFeatures,
9
+ const groups = {
10
+ fieldFeatures,
11
+ formFeatures,
12
+ emailFeatures,
13
+ otpFeatures,
14
+ passwordFeatures,
15
+ usernameFeatures,
16
+ usernameHiddenFeatures,
17
+ };
18
+ const walkDAG = (outputs) => {
19
+ const seen = new Set();
20
+ const visit = (f) => {
21
+ if (seen.has(f))
22
+ return;
23
+ seen.add(f);
24
+ Object.values(f.parents).forEach(visit);
18
25
  };
19
- Object.entries(featureSets).forEach(([featureSetName, features]) => test(`${featureSetName} can be topologically sorted`, () => {
20
- try {
21
- topologicalSort(features);
22
- }
23
- catch (error) {
24
- console.log(Object.values(features)
25
- .map((feature) => `${feature.name} -> {${Object.keys(feature.parents).join(", ")}}`)
26
- .join("\n"));
27
- throw error;
28
- }
29
- }));
26
+ Object.values(outputs).forEach(visit);
27
+ return [...seen];
28
+ };
29
+ const findNameCollisions = (features) => {
30
+ var _a;
31
+ var _b;
32
+ const byName = {};
33
+ for (const f of features)
34
+ ((_a = byName[_b = f.name]) !== null && _a !== void 0 ? _a : (byName[_b] = [])).push(f);
35
+ return Object.fromEntries(Object.entries(byName).filter(([, fs]) => fs.length > 1));
36
+ };
37
+ describe.each(Object.entries(groups))("%s", (_name, outputs) => {
38
+ test("topo-sorts without throwing", () => {
39
+ expect(() => topologicalSort(outputs)).not.toThrow();
40
+ });
41
+ test("every Feature object has a unique .name", () => {
42
+ expect(findNameCollisions(walkDAG(outputs))).toEqual({});
43
+ });
30
44
  });
@@ -1,61 +1,61 @@
1
1
  {
2
- "bias": -0.9151386618614197,
2
+ "bias": -0.9151377081871033,
3
3
  "coeffs": [
4
4
  [
5
5
  "login--visibleFieldsCountScaled",
6
- 1.486899733543396
6
+ 1.4869003295898438
7
7
  ],
8
8
  [
9
9
  "login--visibleInputsCountScaled",
10
- 0.7714098691940308
10
+ 0.7714086771011353
11
11
  ],
12
12
  [
13
13
  "login--fieldsetsCountScaled",
14
- -2.2569069862365723
14
+ -2.256906747817993
15
15
  ],
16
16
  [
17
17
  "login--textsCountScaled",
18
- -2.2409515380859375
18
+ -2.2409517765045166
19
19
  ],
20
20
  [
21
21
  "login--textareasCountScaled",
22
- -7.105659008026123
22
+ -7.105658054351807
23
23
  ],
24
24
  [
25
25
  "login--selectsCountScaled",
26
- -6.675673484802246
26
+ -6.6756744384765625
27
27
  ],
28
28
  [
29
29
  "login--disabledCountScaled",
30
- -0.04939925670623779
30
+ -0.04939926415681839
31
31
  ],
32
32
  [
33
33
  "login--radiosCountScaled",
34
- -4.642114639282227
34
+ -4.642115116119385
35
35
  ],
36
36
  [
37
37
  "login--readOnlyCountScaled",
38
- -8.07482624053955
38
+ -8.074828147888184
39
39
  ],
40
40
  [
41
41
  "login--formComplexityScaled",
42
- -2.950302839279175
42
+ -2.950303077697754
43
43
  ],
44
44
  [
45
45
  "login--visibleIdentifiersCountScaled",
46
- -1.8698210716247559
46
+ -1.8698221445083618
47
47
  ],
48
48
  [
49
49
  "login--hiddenIdentifiersCountScaled",
50
- 1.9122282266616821
50
+ 1.9122281074523926
51
51
  ],
52
52
  [
53
53
  "login--usernamesCountScaled",
54
- 0.16324283182621002
54
+ 0.16324256360530853
55
55
  ],
56
56
  [
57
57
  "login--emailsCountScaled",
58
- -3.5715503692626953
58
+ -3.57155179977417
59
59
  ],
60
60
  [
61
61
  "login--hiddenCountScaled",
@@ -63,43 +63,43 @@
63
63
  ],
64
64
  [
65
65
  "login--hiddenPasswordsCountScaled",
66
- 6.7593560218811035
66
+ 6.759355545043945
67
67
  ],
68
68
  [
69
69
  "login--submitsCountScaled",
70
- -4.409569263458252
70
+ -4.409568786621094
71
71
  ],
72
72
  [
73
73
  "login--identitiesCountScaled",
74
- -1.8813520669937134
74
+ -1.881352186203003
75
75
  ],
76
76
  [
77
77
  "login--ccsCountScaled",
78
- -4.634806156158447
78
+ -4.634804725646973
79
79
  ],
80
80
  [
81
81
  "login--hasTels",
82
- -3.3048744201660156
82
+ -3.304875135421753
83
83
  ],
84
84
  [
85
85
  "login--hasOAuth",
86
- 0.9214448928833008
86
+ 0.9214449524879456
87
87
  ],
88
88
  [
89
89
  "login--hasCaptchas",
90
- 2.71230411529541
90
+ 2.7123045921325684
91
91
  ],
92
92
  [
93
93
  "login--hasFiles",
94
- -0.06754617393016815
94
+ -0.06754614412784576
95
95
  ],
96
96
  [
97
97
  "login--hasDate",
98
- -0.3914891481399536
98
+ -0.391489177942276
99
99
  ],
100
100
  [
101
101
  "login--hasNumber",
102
- -5.054873466491699
102
+ -5.054872989654541
103
103
  ],
104
104
  [
105
105
  "login--oneVisibleField",
@@ -107,7 +107,7 @@
107
107
  ],
108
108
  [
109
109
  "login--twoVisibleFields",
110
- 0.22733581066131592
110
+ 0.22733604907989502
111
111
  ],
112
112
  [
113
113
  "login--threeOrMoreVisibleFields",
@@ -115,7 +115,7 @@
115
115
  ],
116
116
  [
117
117
  "login--noPasswords",
118
- -6.263664722442627
118
+ -6.263664245605469
119
119
  ],
120
120
  [
121
121
  "login--onePassword",
@@ -123,23 +123,23 @@
123
123
  ],
124
124
  [
125
125
  "login--twoPasswords",
126
- 1.235830307006836
126
+ 1.2358295917510986
127
127
  ],
128
128
  [
129
129
  "login--threeOrMorePasswords",
130
- -3.5065689086914062
130
+ -3.5065696239471436
131
131
  ],
132
132
  [
133
133
  "login--noIdentifiers",
134
- -1.713320016860962
134
+ -1.7133218050003052
135
135
  ],
136
136
  [
137
137
  "login--oneIdentifier",
138
- 1.0281378030776978
138
+ 1.0281363725662231
139
139
  ],
140
140
  [
141
141
  "login--twoIdentifiers",
142
- 2.534081220626831
142
+ 2.5340805053710938
143
143
  ],
144
144
  [
145
145
  "login--threeOrMoreIdentifiers",
@@ -147,15 +147,15 @@
147
147
  ],
148
148
  [
149
149
  "login--autofocusedIsIdentifier",
150
- 2.8286819458007812
150
+ 2.8286824226379395
151
151
  ],
152
152
  [
153
153
  "login--autofocusedIsPassword",
154
- 4.382067680358887
154
+ 4.3820672035217285
155
155
  ],
156
156
  [
157
157
  "login--visibleRatio",
158
- 0.7667929530143738
158
+ 0.7667933702468872
159
159
  ],
160
160
  [
161
161
  "login--inputRatio",
@@ -163,43 +163,43 @@
163
163
  ],
164
164
  [
165
165
  "login--hiddenRatio",
166
- -1.1496537923812866
166
+ -1.149653434753418
167
167
  ],
168
168
  [
169
169
  "login--identifierRatio",
170
- -1.8468908071517944
170
+ -1.8468906879425049
171
171
  ],
172
172
  [
173
173
  "login--emailRatio",
174
- 11.31178092956543
174
+ 11.311781883239746
175
175
  ],
176
176
  [
177
177
  "login--usernameRatio",
178
- -2.9467499256134033
178
+ -2.946749687194824
179
179
  ],
180
180
  [
181
181
  "login--passwordRatio",
182
- 2.039027452468872
182
+ 2.0390267372131348
183
183
  ],
184
184
  [
185
185
  "login--disabledRatio",
186
- -0.04974718019366264
186
+ -0.04974720627069473
187
187
  ],
188
188
  [
189
189
  "login--requiredRatio",
190
- 0.6291854977607727
190
+ 0.6291857957839966
191
191
  ],
192
192
  [
193
193
  "login--checkboxRatio",
194
- -10.240707397460938
194
+ -10.240706443786621
195
195
  ],
196
196
  [
197
197
  "login--hiddenIdentifierRatio",
198
- 1.3944566249847412
198
+ 1.394457221031189
199
199
  ],
200
200
  [
201
201
  "login--hiddenPasswordRatio",
202
- 7.059210777282715
202
+ 7.059211254119873
203
203
  ],
204
204
  [
205
205
  "login--pageLogin",
@@ -211,27 +211,27 @@
211
211
  ],
212
212
  [
213
213
  "login--formAttrsLogin",
214
- 4.150831699371338
214
+ 4.15083122253418
215
215
  ],
216
216
  [
217
217
  "login--headingsLogin",
218
- 7.620120525360107
218
+ 7.620121002197266
219
219
  ],
220
220
  [
221
221
  "login--layoutLogin",
222
- -0.0794287770986557
222
+ -0.0794287919998169
223
223
  ],
224
224
  [
225
225
  "login--rememberMeCheckbox",
226
- 4.073165416717529
226
+ 4.073164939880371
227
227
  ],
228
228
  [
229
229
  "login--troubleLink",
230
- 4.67028284072876
230
+ 4.670282363891602
231
231
  ],
232
232
  [
233
233
  "login--submitLogin",
234
- 10.19081974029541
234
+ 10.190820693969727
235
235
  ],
236
236
  [
237
237
  "login--pageRegister",
@@ -239,7 +239,7 @@
239
239
  ],
240
240
  [
241
241
  "login--formTextRegister",
242
- -6.417885780334473
242
+ -6.417884826660156
243
243
  ],
244
244
  [
245
245
  "login--formAttrsRegister",
@@ -247,15 +247,15 @@
247
247
  ],
248
248
  [
249
249
  "login--headingsRegister",
250
- -3.8274245262145996
250
+ -3.8274240493774414
251
251
  ],
252
252
  [
253
253
  "login--layoutRegister",
254
- -0.601273775100708
254
+ -0.6012738943099976
255
255
  ],
256
256
  [
257
257
  "login--pwNewRegister",
258
- -12.92492961883545
258
+ -12.924928665161133
259
259
  ],
260
260
  [
261
261
  "login--pwConfirmRegister",
@@ -263,19 +263,19 @@
263
263
  ],
264
264
  [
265
265
  "login--submitRegister",
266
- -12.533027648925781
266
+ -12.533028602600098
267
267
  ],
268
268
  [
269
269
  "login--TOSRef",
270
- -2.4069557189941406
270
+ -2.4069552421569824
271
271
  ],
272
272
  [
273
273
  "login--pagePwReset",
274
- -0.8316850066184998
274
+ -0.831684947013855
275
275
  ],
276
276
  [
277
277
  "login--formTextPwReset",
278
- -0.02110225521028042
278
+ -0.021102268248796463
279
279
  ],
280
280
  [
281
281
  "login--formAttrsPwReset",
@@ -283,15 +283,15 @@
283
283
  ],
284
284
  [
285
285
  "login--headingsPwReset",
286
- -2.0459933280944824
286
+ -2.0459940433502197
287
287
  ],
288
288
  [
289
289
  "login--layoutPwReset",
290
- -1.5053772926330566
290
+ -1.5053781270980835
291
291
  ],
292
292
  [
293
293
  "login--pageRecovery",
294
- -1.6404569149017334
294
+ -1.640457034111023
295
295
  ],
296
296
  [
297
297
  "login--formTextRecovery",
@@ -311,15 +311,15 @@
311
311
  ],
312
312
  [
313
313
  "login--identifierRecovery",
314
- 0.12867282330989838
314
+ 0.1286727488040924
315
315
  ],
316
316
  [
317
317
  "login--submitRecovery",
318
- -4.689121723175049
318
+ -4.689120769500732
319
319
  ],
320
320
  [
321
321
  "login--formTextMFA",
322
- -3.27414870262146
322
+ -3.274149179458618
323
323
  ],
324
324
  [
325
325
  "login--formAttrsMFA",
@@ -327,7 +327,7 @@
327
327
  ],
328
328
  [
329
329
  "login--inputsMFA",
330
- -10.566764831542969
330
+ -10.566763877868652
331
331
  ],
332
332
  [
333
333
  "login--newsletterForm",
@@ -347,31 +347,31 @@
347
347
  ],
348
348
  [
349
349
  "login--multistepForm,multiAuthForm",
350
- 5.559227466583252
350
+ 5.559228420257568
351
351
  ],
352
352
  [
353
353
  "login--visibleRatio,visibleFieldsCountScaled",
354
- -0.5109789967536926
354
+ -0.510978639125824
355
355
  ],
356
356
  [
357
357
  "login--visibleRatio,visibleIdentifiersCountScaled",
358
- -3.2128372192382812
358
+ -3.2128374576568604
359
359
  ],
360
360
  [
361
361
  "login--visibleRatio,visiblePasswordsCountScaled",
362
- 4.3463850021362305
362
+ 4.346386432647705
363
363
  ],
364
364
  [
365
365
  "login--visibleRatio,hiddenIdentifiersCountScaled",
366
- -1.2100872993469238
366
+ -1.2100865840911865
367
367
  ],
368
368
  [
369
369
  "login--visibleRatio,hiddenPasswordsCountScaled",
370
- -1.9768978357315063
370
+ -1.9768973588943481
371
371
  ],
372
372
  [
373
373
  "login--visibleRatio,multiAuthForm",
374
- -3.3510806560516357
374
+ -3.3510820865631104
375
375
  ],
376
376
  [
377
377
  "login--visibleRatio,multistepForm",
@@ -379,15 +379,15 @@
379
379
  ],
380
380
  [
381
381
  "login--identifierRatio,visibleFieldsCountScaled",
382
- -3.057596206665039
382
+ -3.0575954914093018
383
383
  ],
384
384
  [
385
385
  "login--identifierRatio,visibleIdentifiersCountScaled",
386
- -3.552677631378174
386
+ -3.5526788234710693
387
387
  ],
388
388
  [
389
389
  "login--identifierRatio,visiblePasswordsCountScaled",
390
- 2.49371337890625
390
+ 2.493713617324829
391
391
  ],
392
392
  [
393
393
  "login--identifierRatio,hiddenIdentifiersCountScaled",
@@ -395,55 +395,55 @@
395
395
  ],
396
396
  [
397
397
  "login--identifierRatio,hiddenPasswordsCountScaled",
398
- 6.573177814483643
398
+ 6.573176383972168
399
399
  ],
400
400
  [
401
401
  "login--identifierRatio,multiAuthForm",
402
- 8.29233169555664
402
+ 8.292332649230957
403
403
  ],
404
404
  [
405
405
  "login--identifierRatio,multistepForm",
406
- -6.264770984649658
406
+ -6.2647705078125
407
407
  ],
408
408
  [
409
409
  "login--passwordRatio,visibleFieldsCountScaled",
410
- 5.550400733947754
410
+ 5.55040168762207
411
411
  ],
412
412
  [
413
413
  "login--passwordRatio,visibleIdentifiersCountScaled",
414
- 2.661841869354248
414
+ 2.6618411540985107
415
415
  ],
416
416
  [
417
417
  "login--passwordRatio,visiblePasswordsCountScaled",
418
- -0.8242419362068176
418
+ -0.8242422938346863
419
419
  ],
420
420
  [
421
421
  "login--passwordRatio,hiddenIdentifiersCountScaled",
422
- 2.0986239910125732
422
+ 2.0986247062683105
423
423
  ],
424
424
  [
425
425
  "login--passwordRatio,hiddenPasswordsCountScaled",
426
- 3.0585145950317383
426
+ 3.058513879776001
427
427
  ],
428
428
  [
429
429
  "login--passwordRatio,multiAuthForm",
430
- -6.020143032073975
430
+ -6.020142078399658
431
431
  ],
432
432
  [
433
433
  "login--passwordRatio,multistepForm",
434
- -14.701336860656738
434
+ -14.701335906982422
435
435
  ],
436
436
  [
437
437
  "login--requiredRatio,visibleFieldsCountScaled",
438
- 0.287549763917923
438
+ 0.28754952549934387
439
439
  ],
440
440
  [
441
441
  "login--requiredRatio,visibleIdentifiersCountScaled",
442
- -2.505615472793579
442
+ -2.5056159496307373
443
443
  ],
444
444
  [
445
445
  "login--requiredRatio,visiblePasswordsCountScaled",
446
- 1.038008213043213
446
+ 1.0380085706710815
447
447
  ],
448
448
  [
449
449
  "login--requiredRatio,hiddenIdentifiersCountScaled",
@@ -451,11 +451,11 @@
451
451
  ],
452
452
  [
453
453
  "login--requiredRatio,hiddenPasswordsCountScaled",
454
- 1.3033015727996826
454
+ 1.3033009767532349
455
455
  ],
456
456
  [
457
457
  "login--requiredRatio,multiAuthForm",
458
- 2.7696313858032227
458
+ 2.7696309089660645
459
459
  ],
460
460
  [
461
461
  "login--requiredRatio,multistepForm",