@protontech/autofill 0.0.22991789 → 0.0.33835493

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 (176) hide show
  1. package/constants/features.d.ts +1 -0
  2. package/constants/features.js +1 -0
  3. package/constants/heuristics.d.ts +5 -4
  4. package/constants/heuristics.js +5 -10
  5. package/constants/selectors.d.ts +13 -7
  6. package/constants/selectors.js +29 -17
  7. package/debug.d.ts +24 -1
  8. package/debug.js +15 -13
  9. package/dictionary/generate.js +30 -21
  10. package/dictionary/generated/dictionary.d.ts +18 -4
  11. package/dictionary/generated/dictionary.js +31 -17
  12. package/dictionary/source/dictionary.d.ts +4 -3
  13. package/dictionary/source/dictionary.js +155 -89
  14. package/dictionary/source/patterns.js +2 -2
  15. package/features/feature.d.ts +18 -0
  16. package/features/feature.js +79 -0
  17. package/features/feature.spec.d.ts +1 -0
  18. package/features/feature.spec.js +55 -0
  19. package/features/v1/abstract.field.d.ts +20401 -0
  20. package/features/v1/abstract.field.js +95 -0
  21. package/features/v1/abstract.form.d.ts +1226 -0
  22. package/features/v1/abstract.form.js +336 -0
  23. package/features/v1/field.email.d.ts +62 -0
  24. package/features/v1/field.email.js +27 -0
  25. package/features/v1/field.otp.d.ts +142 -0
  26. package/features/v1/field.otp.js +105 -0
  27. package/features/v1/field.password.d.ts +162 -0
  28. package/features/v1/field.password.js +81 -0
  29. package/features/v1/field.username-hidden.d.ts +62 -0
  30. package/features/v1/field.username-hidden.js +25 -0
  31. package/features/v1/field.username.d.ts +72 -0
  32. package/features/v1/field.username.js +31 -0
  33. package/features/v1/index.d.ts +4428 -0
  34. package/features/v1/index.js +22 -0
  35. package/features/v1/index.spec.d.ts +1 -0
  36. package/features/v1/index.spec.js +30 -0
  37. package/index.d.ts +7 -2
  38. package/index.js +11 -3
  39. package/models/perceptron/index.d.ts +2 -0
  40. package/models/perceptron/index.js +42 -0
  41. package/models/perceptron/params/email-model.json +53 -0
  42. package/models/perceptron/params/login-model.json +465 -0
  43. package/models/perceptron/params/new-password-model.json +133 -0
  44. package/models/perceptron/params/otp-model.json +117 -0
  45. package/models/perceptron/params/password-change-model.json +465 -0
  46. package/models/perceptron/params/password-model.json +133 -0
  47. package/models/perceptron/params/recovery-model.json +465 -0
  48. package/models/perceptron/params/register-model.json +465 -0
  49. package/models/perceptron/params/username-hidden-model.json +53 -0
  50. package/models/perceptron/params/username-model.json +61 -0
  51. package/models/random_forest/index.d.ts +2 -0
  52. package/models/random_forest/index.js +42 -0
  53. package/models/random_forest/params/email-model.json +1456 -0
  54. package/models/random_forest/params/login-model.json +4194 -0
  55. package/models/random_forest/params/new-password-model.json +1448 -0
  56. package/models/random_forest/params/otp-model.json +2004 -0
  57. package/models/random_forest/params/password-change-model.json +1422 -0
  58. package/models/random_forest/params/password-model.json +1292 -0
  59. package/models/random_forest/params/recovery-model.json +2754 -0
  60. package/models/random_forest/params/register-model.json +3678 -0
  61. package/models/random_forest/params/username-hidden-model.json +1108 -0
  62. package/models/random_forest/params/username-model.json +1052 -0
  63. package/package.json +17 -15
  64. package/rules/v1/index.d.ts +4 -0
  65. package/rules/v1/index.js +66 -0
  66. package/rulesets.d.ts +9 -2
  67. package/rulesets.js +14 -9
  68. package/types/index.d.ts +70 -17
  69. package/types/index.js +34 -1
  70. package/utils/attributes.js +1 -1
  71. package/utils/clustering.js +18 -5
  72. package/utils/credit-card.d.ts +32 -0
  73. package/utils/credit-card.js +259 -0
  74. package/utils/credit-card.samples.spec.d.ts +1 -0
  75. package/utils/credit-card.samples.spec.js +452 -0
  76. package/utils/credit-card.spec.d.ts +1 -0
  77. package/utils/credit-card.spec.js +296 -0
  78. package/utils/dom.d.ts +3 -2
  79. package/utils/dom.js +12 -7
  80. package/utils/exclusion.d.ts +1 -0
  81. package/utils/exclusion.js +22 -10
  82. package/utils/extract.d.ts +1 -0
  83. package/utils/extract.js +26 -7
  84. package/utils/fathom.d.ts +10 -23
  85. package/utils/fathom.js +7 -12
  86. package/utils/field.d.ts +12 -4
  87. package/utils/field.js +25 -14
  88. package/utils/flags.d.ts +9 -3
  89. package/utils/flags.js +27 -9
  90. package/utils/form.d.ts +16 -5
  91. package/utils/form.js +35 -14
  92. package/utils/identity.d.ts +12 -21
  93. package/utils/identity.js +66 -41
  94. package/utils/identity.samples.spec.d.ts +1 -0
  95. package/utils/identity.samples.spec.js +28 -0
  96. package/utils/iframe.d.ts +2 -0
  97. package/utils/iframe.js +22 -0
  98. package/utils/overrides.d.ts +19 -0
  99. package/utils/overrides.js +40 -0
  100. package/utils/prepass.js +6 -4
  101. package/utils/re.d.ts +19 -4
  102. package/utils/re.js +22 -7
  103. package/utils/re.spec.d.ts +1 -0
  104. package/utils/re.spec.js +62 -0
  105. package/utils/shadow-dom.d.ts +8 -0
  106. package/utils/shadow-dom.js +53 -0
  107. package/utils/shadow-dom.spec.d.ts +1 -0
  108. package/utils/shadow-dom.spec.js +215 -0
  109. package/utils/visible.d.ts +3 -2
  110. package/utils/visible.js +42 -22
  111. package/cli.d.ts +0 -2
  112. package/cli.js +0 -128
  113. package/features/abstract.field.d.ts +0 -123
  114. package/features/abstract.field.js +0 -63
  115. package/features/abstract.form.d.ts +0 -98
  116. package/features/abstract.form.js +0 -281
  117. package/features/field.email.d.ts +0 -18
  118. package/features/field.email.js +0 -43
  119. package/features/field.otp.d.ts +0 -36
  120. package/features/field.otp.js +0 -116
  121. package/features/field.password.d.ts +0 -35
  122. package/features/field.password.js +0 -104
  123. package/features/field.username-hidden.d.ts +0 -15
  124. package/features/field.username-hidden.js +0 -40
  125. package/features/field.username.d.ts +0 -16
  126. package/features/field.username.js +0 -41
  127. package/features/form.combined.d.ts +0 -1
  128. package/features/form.combined.js +0 -6
  129. package/trainees/field.email.d.ts +0 -2
  130. package/trainees/field.email.js +0 -16
  131. package/trainees/field.identity.d.ts +0 -2
  132. package/trainees/field.identity.js +0 -9
  133. package/trainees/field.otp.d.ts +0 -2
  134. package/trainees/field.otp.js +0 -16
  135. package/trainees/field.password.current.d.ts +0 -2
  136. package/trainees/field.password.current.js +0 -16
  137. package/trainees/field.password.new.d.ts +0 -2
  138. package/trainees/field.password.new.js +0 -16
  139. package/trainees/field.username-hidden.d.ts +0 -2
  140. package/trainees/field.username-hidden.js +0 -22
  141. package/trainees/field.username.d.ts +0 -2
  142. package/trainees/field.username.js +0 -16
  143. package/trainees/form.login.d.ts +0 -2
  144. package/trainees/form.login.js +0 -16
  145. package/trainees/form.noop.d.ts +0 -1
  146. package/trainees/form.noop.js +0 -7
  147. package/trainees/form.password-change.d.ts +0 -2
  148. package/trainees/form.password-change.js +0 -16
  149. package/trainees/form.recovery.d.ts +0 -2
  150. package/trainees/form.recovery.js +0 -16
  151. package/trainees/form.register.d.ts +0 -2
  152. package/trainees/form.register.js +0 -16
  153. package/trainees/index.d.ts +0 -9
  154. package/trainees/index.js +0 -72
  155. package/trainees/results/result.email.d.ts +0 -2
  156. package/trainees/results/result.email.js +0 -17
  157. package/trainees/results/result.login.d.ts +0 -2
  158. package/trainees/results/result.login.js +0 -110
  159. package/trainees/results/result.new-password.d.ts +0 -2
  160. package/trainees/results/result.new-password.js +0 -36
  161. package/trainees/results/result.otp.d.ts +0 -2
  162. package/trainees/results/result.otp.js +0 -43
  163. package/trainees/results/result.password-change.d.ts +0 -2
  164. package/trainees/results/result.password-change.js +0 -110
  165. package/trainees/results/result.password.d.ts +0 -2
  166. package/trainees/results/result.password.js +0 -36
  167. package/trainees/results/result.recovery.d.ts +0 -2
  168. package/trainees/results/result.recovery.js +0 -110
  169. package/trainees/results/result.register.d.ts +0 -2
  170. package/trainees/results/result.register.js +0 -110
  171. package/trainees/results/result.username-hidden.d.ts +0 -2
  172. package/trainees/results/result.username-hidden.js +0 -15
  173. package/trainees/results/result.username.d.ts +0 -2
  174. package/trainees/results/result.username.js +0 -16
  175. package/utils/memoize.d.ts +0 -5
  176. package/utils/memoize.js +0 -12
@@ -1,40 +0,0 @@
1
- import { any } from "../utils/combinators";
2
- import { boolInt } from "../utils/fathom";
3
- import { matchEmailAttr, matchEmailValue, matchTelValue, matchUsernameAttr, matchUsernameValue } from "../utils/re";
4
- import { isVisible } from "../utils/visible";
5
- const getHiddenUserFieldFeatures = (fnode) => {
6
- const field = fnode.element;
7
- const fieldFeatures = fnode.noteFor("field");
8
- const { fieldAttrs, autocomplete } = fieldFeatures;
9
- const attrUsername = any(matchUsernameAttr)(fieldAttrs);
10
- const attrEmail = any(matchEmailAttr)(fieldAttrs);
11
- const usernameAttr = field.matches('[name="username"],[id="username"]');
12
- const autocompleteUsername = autocomplete === "username";
13
- const visibleReadonly = field.readOnly && isVisible(field, { opacity: true }) && field.type !== "hidden";
14
- const valueEmail = matchEmailValue(fieldFeatures.value);
15
- const valueTel = matchTelValue(fieldFeatures.value);
16
- const valueUsername = matchUsernameValue(fieldFeatures.value);
17
- return {
18
- exotic: boolInt(fieldFeatures.isFormNoop),
19
- attrUsername: boolInt(attrUsername),
20
- attrEmail: boolInt(attrEmail),
21
- usernameAttr: boolInt(usernameAttr),
22
- autocompleteUsername: boolInt(autocompleteUsername),
23
- visibleReadonly: boolInt(visibleReadonly),
24
- hiddenEmailValue: boolInt(valueEmail),
25
- hiddenTelValue: boolInt(valueTel),
26
- hiddenUsernameValue: boolInt(valueUsername),
27
- };
28
- };
29
- export default getHiddenUserFieldFeatures;
30
- export const HIDDEN_USER_FIELD_FEATURES = [
31
- "exotic",
32
- "attrUsername",
33
- "attrEmail",
34
- "usernameAttr",
35
- "autocompleteUsername",
36
- "visibleReadonly",
37
- "hiddenEmailValue",
38
- "hiddenTelValue",
39
- "hiddenUsernameValue",
40
- ];
@@ -1,16 +0,0 @@
1
- import { Fnode } from "@protontech/fathom";
2
- declare const getUsernameFieldFeatures: (fnode: Fnode) => {
3
- autocompleteUsername: number;
4
- autocompleteNickname: number;
5
- autocompleteEmail: number;
6
- autocompleteOff: number;
7
- attrUsername: number;
8
- textUsername: number;
9
- labelUsername: number;
10
- outlierUsername: number;
11
- loginUsername: number;
12
- searchField: number;
13
- };
14
- export default getUsernameFieldFeatures;
15
- export type UsernameFieldFeatures = ReturnType<typeof getUsernameFieldFeatures>;
16
- export declare const USERNAME_FIELD_FEATURES: (keyof UsernameFieldFeatures)[];
@@ -1,41 +0,0 @@
1
- import { any } from "../utils/combinators";
2
- import { boolInt } from "../utils/fathom";
3
- import { matchEmailAttr, matchUsername, matchUsernameAttr, matchUsernameOutlier } from "../utils/re";
4
- const getUsernameFieldFeatures = (fnode) => {
5
- const fieldFeatures = fnode.noteFor("field");
6
- const { fieldAttrs, fieldText, labelText, prevField } = fieldFeatures;
7
- const attrUsername = any(matchUsernameAttr)(fieldAttrs);
8
- const textUsername = matchUsername(fieldText);
9
- const labelUsername = matchUsername(labelText);
10
- const outlierUsername = any(matchUsernameOutlier)(fieldAttrs.concat(fieldText, labelText));
11
- const haystack = fieldAttrs.concat(fieldText).concat(labelText);
12
- const outlier = outlierUsername || any(matchEmailAttr)(haystack);
13
- const loginForm = fieldFeatures.isFormLogin;
14
- const isFirstField = prevField === null;
15
- const loginUsername = loginForm && isFirstField && !outlier;
16
- return {
17
- autocompleteUsername: boolInt(fieldFeatures.autocomplete === "username"),
18
- autocompleteNickname: boolInt(fieldFeatures.autocomplete === "nickname"),
19
- autocompleteEmail: boolInt(fieldFeatures.autocomplete === "email"),
20
- autocompleteOff: boolInt(fieldFeatures.autocomplete === "off"),
21
- attrUsername: boolInt(attrUsername),
22
- textUsername: boolInt(textUsername),
23
- labelUsername: boolInt(labelUsername),
24
- outlierUsername: boolInt(outlier),
25
- loginUsername: boolInt(loginUsername),
26
- searchField: boolInt(fieldFeatures.searchField),
27
- };
28
- };
29
- export default getUsernameFieldFeatures;
30
- export const USERNAME_FIELD_FEATURES = [
31
- "autocompleteUsername",
32
- "autocompleteNickname",
33
- "autocompleteEmail",
34
- "autocompleteOff",
35
- "attrUsername",
36
- "textUsername",
37
- "labelUsername",
38
- "outlierUsername",
39
- "loginUsername",
40
- "searchField",
41
- ];
@@ -1 +0,0 @@
1
- export declare const FORM_COMBINED_FEATURES: ("formMFA" | "formOTPOutlier" | "linkOTPOutlier" | "fieldsCount" | "inputCount" | "fieldsetCount" | "textCount" | "textareaCount" | "selectCount" | "optionsCount" | "checkboxCount" | "radioCount" | "identifierCount" | "hiddenIdentifierCount" | "hiddenCount" | "passwordCount" | "hiddenPasswordCount" | "usernameCount" | "emailCount" | "submitCount" | "hasTels" | "hasOAuth" | "hasCaptchas" | "hasFiles" | "hasDate" | "hasNumber" | "oneVisibleField" | "twoVisibleFields" | "threeOrMoreVisibleFields" | "noPasswords" | "onePassword" | "twoPasswords" | "threeOrMorePasswords" | "noIdentifiers" | "oneIdentifier" | "twoIdentifiers" | "threeOrMoreIdentifiers" | "autofocusedIsIdentifier" | "autofocusedIsPassword" | "visibleInputsCount" | "inputRatio" | "hiddenRatio" | "visibleRatio" | "identifierRatio" | "emailRatio" | "usernameRatio" | "passwordRatio" | "checkboxRatio" | "requiredRatio" | "patternRatio" | "minMaxLengthRatio" | "pageLogin" | "formTextLogin" | "formAttrsLogin" | "headingsLogin" | "layoutLogin" | "rememberMeCheckbox" | "troubleLink" | "submitLogin" | "pageRegister" | "formTextRegister" | "formAttrsRegister" | "headingsRegister" | "layoutRegister" | "pwNewRegister" | "pwConfirmRegister" | "submitRegister" | "TOSRef" | "pagePwReset" | "formTextPwReset" | "formAttrsPwReset" | "headingsPwReset" | "layoutPwReset" | "pageRecovery" | "formTextRecovery" | "formAttrsRecovery" | "headingsRecovery" | "layoutRecovery" | "identifierRecovery" | "submitRecovery" | "formTextMFA" | "formAttrsMFA" | "inputsMFA" | "inputsOTP" | "newsletterForm" | "searchForm" | "multiStepForm" | "multiAuthForm" | "formInputIterator" | ["formMFA" | "formOTPOutlier" | "linkOTPOutlier" | "fieldsCount" | "inputCount" | "fieldsetCount" | "textCount" | "textareaCount" | "selectCount" | "optionsCount" | "checkboxCount" | "radioCount" | "identifierCount" | "hiddenIdentifierCount" | "hiddenCount" | "passwordCount" | "hiddenPasswordCount" | "usernameCount" | "emailCount" | "submitCount" | "hasTels" | "hasOAuth" | "hasCaptchas" | "hasFiles" | "hasDate" | "hasNumber" | "oneVisibleField" | "twoVisibleFields" | "threeOrMoreVisibleFields" | "noPasswords" | "onePassword" | "twoPasswords" | "threeOrMorePasswords" | "noIdentifiers" | "oneIdentifier" | "twoIdentifiers" | "threeOrMoreIdentifiers" | "autofocusedIsIdentifier" | "autofocusedIsPassword" | "visibleInputsCount" | "inputRatio" | "hiddenRatio" | "visibleRatio" | "identifierRatio" | "emailRatio" | "usernameRatio" | "passwordRatio" | "checkboxRatio" | "requiredRatio" | "patternRatio" | "minMaxLengthRatio" | "pageLogin" | "formTextLogin" | "formAttrsLogin" | "headingsLogin" | "layoutLogin" | "rememberMeCheckbox" | "troubleLink" | "submitLogin" | "pageRegister" | "formTextRegister" | "formAttrsRegister" | "headingsRegister" | "layoutRegister" | "pwNewRegister" | "pwConfirmRegister" | "submitRegister" | "TOSRef" | "pagePwReset" | "formTextPwReset" | "formAttrsPwReset" | "headingsPwReset" | "layoutPwReset" | "pageRecovery" | "formTextRecovery" | "formAttrsRecovery" | "headingsRecovery" | "layoutRecovery" | "identifierRecovery" | "submitRecovery" | "formTextMFA" | "formAttrsMFA" | "inputsMFA" | "inputsOTP" | "newsletterForm" | "searchForm" | "multiStepForm" | "multiAuthForm" | "formInputIterator", "formMFA" | "formOTPOutlier" | "linkOTPOutlier" | "fieldsCount" | "inputCount" | "fieldsetCount" | "textCount" | "textareaCount" | "selectCount" | "optionsCount" | "checkboxCount" | "radioCount" | "identifierCount" | "hiddenIdentifierCount" | "hiddenCount" | "passwordCount" | "hiddenPasswordCount" | "usernameCount" | "emailCount" | "submitCount" | "hasTels" | "hasOAuth" | "hasCaptchas" | "hasFiles" | "hasDate" | "hasNumber" | "oneVisibleField" | "twoVisibleFields" | "threeOrMoreVisibleFields" | "noPasswords" | "onePassword" | "twoPasswords" | "threeOrMorePasswords" | "noIdentifiers" | "oneIdentifier" | "twoIdentifiers" | "threeOrMoreIdentifiers" | "autofocusedIsIdentifier" | "autofocusedIsPassword" | "visibleInputsCount" | "inputRatio" | "hiddenRatio" | "visibleRatio" | "identifierRatio" | "emailRatio" | "usernameRatio" | "passwordRatio" | "checkboxRatio" | "requiredRatio" | "patternRatio" | "minMaxLengthRatio" | "pageLogin" | "formTextLogin" | "formAttrsLogin" | "headingsLogin" | "layoutLogin" | "rememberMeCheckbox" | "troubleLink" | "submitLogin" | "pageRegister" | "formTextRegister" | "formAttrsRegister" | "headingsRegister" | "layoutRegister" | "pwNewRegister" | "pwConfirmRegister" | "submitRegister" | "TOSRef" | "pagePwReset" | "formTextPwReset" | "formAttrsPwReset" | "headingsPwReset" | "layoutPwReset" | "pageRecovery" | "formTextRecovery" | "formAttrsRecovery" | "headingsRecovery" | "layoutRecovery" | "identifierRecovery" | "submitRecovery" | "formTextMFA" | "formAttrsMFA" | "inputsMFA" | "inputsOTP" | "newsletterForm" | "searchForm" | "multiStepForm" | "multiAuthForm" | "formInputIterator"])[];
@@ -1,6 +0,0 @@
1
- import { combineFeatures } from "../utils/fathom";
2
- import { FORM_FEATURES } from "./abstract.form";
3
- export const FORM_COMBINED_FEATURES = [
4
- ...FORM_FEATURES,
5
- ...combineFeatures(["visibleRatio", "identifierRatio", "passwordRatio", "requiredRatio"], ["fieldsCount", "identifierCount", "passwordCount", "hiddenIdentifierCount", "hiddenPasswordCount", "multiStepForm"]),
6
- ];
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const email: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { EMAIL_FIELD_FEATURES } from "../features/field.email";
3
- import { FieldType } from "../types";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.email";
6
- export const email = {
7
- name: FieldType.EMAIL,
8
- coeffs: EMAIL_FIELD_FEATURES.map((key) => { var _a, _b; return [`email-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `email-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("email-field"), type(FieldType.EMAIL), {}),
13
- ...EMAIL_FIELD_FEATURES.map((key) => rule(type(FieldType.EMAIL), featureScore("email-field", key), { name: `email-${key}` })),
14
- ...outRuleWithCache("field-candidate", FieldType.EMAIL),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { AnyRule } from "../types";
2
- export declare const identity: AnyRule[];
@@ -1,9 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FieldType } from "../types";
3
- import { outRuleWithCache } from "../utils/fathom";
4
- import { maybeIdentity } from "../utils/identity";
5
- export const identity = [
6
- rule(type("field").when(maybeIdentity), type("identity-field"), {}),
7
- rule(type("identity-field"), type(FieldType.IDENTITY), {}),
8
- ...outRuleWithCache("field-candidate", FieldType.IDENTITY, () => () => true),
9
- ];
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const otp: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { OTP_FIELD_FEATURES } from "../features/field.otp";
3
- import { FieldType } from "../types";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.otp";
6
- export const otp = {
7
- name: FieldType.OTP,
8
- coeffs: OTP_FIELD_FEATURES.map((key) => { var _a, _b; return [`otp-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `otp-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("otp-field"), type(FieldType.OTP), {}),
13
- ...OTP_FIELD_FEATURES.map((key) => rule(type(FieldType.OTP), featureScore("otp-field", key), { name: `otp-${key}` })),
14
- ...outRuleWithCache("field-candidate", FieldType.OTP),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const password: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FieldType } from "../types";
3
- import { PW_FIELD_FEATURES } from "../features/field.password";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.password";
6
- export const password = {
7
- name: FieldType.PASSWORD_CURRENT,
8
- coeffs: PW_FIELD_FEATURES.map((key) => { var _a, _b; return [`pw-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `pw-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("password-field"), type(FieldType.PASSWORD_CURRENT), {}),
13
- ...PW_FIELD_FEATURES.map((key) => rule(type(FieldType.PASSWORD_CURRENT), featureScore("password-field", key), { name: `pw-${key}` })),
14
- ...outRuleWithCache("field-candidate", FieldType.PASSWORD_CURRENT),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const newPassword: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FieldType } from "../types";
3
- import { PW_FIELD_FEATURES } from "../features/field.password";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.new-password";
6
- export const newPassword = {
7
- name: FieldType.PASSWORD_NEW,
8
- coeffs: PW_FIELD_FEATURES.map((key) => { var _a, _b; return [`pw[new]-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `pw[new]-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("password-field"), type(FieldType.PASSWORD_NEW), {}),
13
- ...PW_FIELD_FEATURES.map((key) => rule(type(FieldType.PASSWORD_NEW), featureScore("password-field", key), { name: `pw[new]-${key}` })),
14
- ...outRuleWithCache("field-candidate", FieldType.PASSWORD_NEW),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const usernameHidden: Trainee;
@@ -1,22 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FieldType } from "../types";
3
- import { HIDDEN_USER_FIELD_FEATURES } from "../features/field.username-hidden";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.username-hidden";
6
- export const usernameHidden = {
7
- name: FieldType.USERNAME_HIDDEN,
8
- coeffs: HIDDEN_USER_FIELD_FEATURES.map((key) => {
9
- var _a, _b;
10
- return [
11
- `username[hidden]-${key}`,
12
- (_b = (_a = results.coeffs.find(([feature]) => feature === `username[hidden]-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0,
13
- ];
14
- }),
15
- bias: results.bias,
16
- cutoff: results.cutoff,
17
- getRules: () => [
18
- rule(type("username-hidden-field"), type(FieldType.USERNAME_HIDDEN), {}),
19
- ...HIDDEN_USER_FIELD_FEATURES.map((key) => rule(type(FieldType.USERNAME_HIDDEN), featureScore("username-hidden-field", key), { name: `username[hidden]-${key}` })),
20
- ...outRuleWithCache("field-candidate", FieldType.USERNAME_HIDDEN),
21
- ],
22
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const username: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FieldType } from "../types";
3
- import { USERNAME_FIELD_FEATURES } from "../features/field.username";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.username";
6
- export const username = {
7
- name: FieldType.USERNAME,
8
- coeffs: USERNAME_FIELD_FEATURES.map((key) => { var _a, _b; return [`username-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `username-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("username-field"), type(FieldType.USERNAME), {}),
13
- ...USERNAME_FIELD_FEATURES.map((key) => rule(type(FieldType.USERNAME), featureScore("username-field", key), { name: `username-${key}` })),
14
- ...outRuleWithCache("field-candidate", FieldType.USERNAME),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const login: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FORM_COMBINED_FEATURES } from "../features/form.combined";
3
- import { FormType } from "../types";
4
- import { featureScore, outRuleWithCache } from "../utils/fathom";
5
- import { results } from "./results/result.login";
6
- export const login = {
7
- name: FormType.LOGIN,
8
- coeffs: FORM_COMBINED_FEATURES.map((feat) => { var _a, _b; return [`login-${feat}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `login-${feat}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("form"), type(FormType.LOGIN), {}),
13
- ...FORM_COMBINED_FEATURES.map((feat) => rule(type(FormType.LOGIN), featureScore("form", feat), { name: `login-${feat}` })),
14
- ...outRuleWithCache("form-candidate", FormType.LOGIN),
15
- ],
16
- };
@@ -1 +0,0 @@
1
- export declare const noop: any[];
@@ -1,7 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FormType } from "../types";
3
- import { isNoopForm, outRuleWithCache } from "../utils/fathom";
4
- export const noop = [
5
- rule(type("form").when(isNoopForm), type(FormType.NOOP), {}),
6
- ...outRuleWithCache("form-candidate", FormType.NOOP, () => () => true),
7
- ];
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const passwordChange: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FormType } from "../types";
3
- import { featureScore, outRuleWithCache } from "../utils/fathom";
4
- import { results } from "./results/result.password-change";
5
- import { FORM_COMBINED_FEATURES } from "../features/form.combined";
6
- export const passwordChange = {
7
- name: FormType.PASSWORD_CHANGE,
8
- coeffs: FORM_COMBINED_FEATURES.map((key) => { var _a, _b; return [`pw-change-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `pw-change-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("form"), type(FormType.PASSWORD_CHANGE), {}),
13
- ...FORM_COMBINED_FEATURES.map((key) => rule(type(FormType.PASSWORD_CHANGE), featureScore("form", key), { name: `pw-change-${key}` })),
14
- ...outRuleWithCache("form-candidate", FormType.PASSWORD_CHANGE),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const recovery: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FormType } from "../types";
3
- import { featureScore, outRuleWithCache } from "../utils/fathom";
4
- import { results } from "./results/result.recovery";
5
- import { FORM_COMBINED_FEATURES } from "../features/form.combined";
6
- export const recovery = {
7
- name: FormType.RECOVERY,
8
- coeffs: FORM_COMBINED_FEATURES.map((key) => { var _a, _b; return [`recovery-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `recovery-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("form"), type(FormType.RECOVERY), {}),
13
- ...FORM_COMBINED_FEATURES.map((key) => rule(type(FormType.RECOVERY), featureScore("form", key), { name: `recovery-${key}` })),
14
- ...outRuleWithCache("form-candidate", FormType.RECOVERY),
15
- ],
16
- };
@@ -1,2 +0,0 @@
1
- import { Trainee } from "../types";
2
- export declare const register: Trainee;
@@ -1,16 +0,0 @@
1
- import { rule, type } from "@protontech/fathom";
2
- import { FormType } from "../types";
3
- import { featureScore, outRuleWithCache } from "../utils/fathom";
4
- import { results } from "./results/result.register";
5
- import { FORM_COMBINED_FEATURES } from "../features/form.combined";
6
- export const register = {
7
- name: FormType.REGISTER,
8
- coeffs: FORM_COMBINED_FEATURES.map((key) => { var _a, _b; return [`register-${key}`, (_b = (_a = results.coeffs.find(([feature]) => feature === `register-${key}`)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0]; }),
9
- bias: results.bias,
10
- cutoff: results.cutoff,
11
- getRules: () => [
12
- rule(type("form"), type(FormType.REGISTER), {}),
13
- ...FORM_COMBINED_FEATURES.map((key) => rule(type(FormType.REGISTER), featureScore("form", key), { name: `register-${key}` })),
14
- ...outRuleWithCache("form-candidate", FormType.REGISTER),
15
- ],
16
- };
@@ -1,9 +0,0 @@
1
- import { ruleset } from "@protontech/fathom";
2
- import { Trainee } from "../types";
3
- declare const definitions: Trainee[];
4
- export declare const trainees: {
5
- forms: Record<string, Trainee>;
6
- fields: Record<string, Trainee>;
7
- };
8
- export declare const rulesetMaker: () => ReturnType<typeof ruleset>;
9
- export default definitions;
package/trainees/index.js DELETED
@@ -1,72 +0,0 @@
1
- import { dom, out, rule, ruleset, type } from "@protontech/fathom";
2
- import getFormFeatures from "../features/abstract.form";
3
- import { login } from "./form.login";
4
- import { passwordChange } from "./form.password-change";
5
- import { recovery } from "./form.recovery";
6
- import { register } from "./form.register";
7
- import { email } from "./field.email";
8
- import { identity } from "./field.identity";
9
- import { otp } from "./field.otp";
10
- import { password } from "./field.password.current";
11
- import { newPassword } from "./field.password.new";
12
- import { username } from "./field.username";
13
- import { usernameHidden } from "./field.username-hidden";
14
- import { withFnodeEl } from "../utils/fathom";
15
- import getFieldFeature from "../features/abstract.field";
16
- import getEmailFieldFeatures from "../features/field.email";
17
- import getOTPFieldFeatures from "../features/field.otp";
18
- import getPasswordFieldFeatures from "../features/field.password";
19
- import getUsernameFieldFeatures from "../features/field.username";
20
- import getHiddenUserFieldFeatures from "../features/field.username-hidden";
21
- import { processFieldEffect, processFormEffect } from "../utils/fathom";
22
- import { isClassifiableField, maybeEmail, maybeHiddenUsername, maybeOTP, maybePassword, maybeUsername } from "../utils/field";
23
- import { isVisibleForm } from "../utils/visible";
24
- import { formCandidateSelector } from "../constants/selectors";
25
- import { isClassifiable } from "../utils/flags";
26
- import { noop } from "./form.noop";
27
- const definitions = [login, register, passwordChange, recovery, username, usernameHidden, email, password, newPassword, otp];
28
- export const trainees = {
29
- forms: {
30
- login,
31
- register,
32
- passwordChange,
33
- recovery,
34
- },
35
- fields: {
36
- username,
37
- usernameHidden,
38
- email,
39
- password,
40
- newPassword,
41
- otp,
42
- },
43
- };
44
- export const rulesetMaker = () => {
45
- const aggregation = definitions.reduce((acc, curr) => ({
46
- rules: [...acc.rules, ...curr.getRules()],
47
- coeffs: [...acc.coeffs, ...curr.coeffs],
48
- biases: [...acc.biases, [curr.name, curr.bias]],
49
- }), {
50
- rules: [
51
- rule(dom(formCandidateSelector), type("form-candidate"), {}),
52
- rule(dom("input"), type("field-candidate"), {}),
53
- rule(type("form-candidate").when(withFnodeEl(isClassifiable)), type("form-element"), {}),
54
- rule(type("form-element").when(withFnodeEl(isVisibleForm)), type("form").note(getFormFeatures), {}),
55
- rule(type("form-element"), out("form").through(processFormEffect), {}),
56
- ...noop,
57
- rule(type("field-candidate").when(isClassifiableField), type("field").note(getFieldFeature), {}),
58
- rule(type("field").when(maybeUsername), type("username-field").note(getUsernameFieldFeatures), {}),
59
- rule(type("field").when(maybeHiddenUsername), type("username-hidden-field").note(getHiddenUserFieldFeatures), {}),
60
- rule(type("field").when(maybeEmail), type("email-field").note(getEmailFieldFeatures), {}),
61
- rule(type("field").when(maybePassword), type("password-field").note(getPasswordFieldFeatures), {}),
62
- rule(type("field").when(maybeOTP), type("otp-field").note(getOTPFieldFeatures), {}),
63
- ...identity,
64
- rule(type("field"), out("field").through(processFieldEffect), {}),
65
- ],
66
- coeffs: [],
67
- biases: [],
68
- });
69
- const rules = ruleset(aggregation.rules, aggregation.coeffs, aggregation.biases);
70
- return rules;
71
- };
72
- export default definitions;
@@ -1,2 +0,0 @@
1
- import { TrainingResults } from "../../types";
2
- export declare const results: TrainingResults;
@@ -1,17 +0,0 @@
1
- export const results = {
2
- bias: -11.64561653137207,
3
- coeffs: [
4
- ["email-autocompleteUsername", 0.707680881023407],
5
- ["email-autocompleteNickname", 0.2502567768096924],
6
- ["email-autocompleteEmail", 3.4200122356414795],
7
- ["email-typeEmail", 20.136024475097656],
8
- ["email-exactAttrEmail", 20.156497955322266],
9
- ["email-attrEmail", -0.03418790176510811],
10
- ["email-textEmail", 19.176666259765625],
11
- ["email-labelEmail", 22.481016159057617],
12
- ["email-placeholderEmail", 3.798909902572632],
13
- ["email-searchField", -19.822532653808594],
14
- ["email-identityField", -15.00598430633545],
15
- ],
16
- cutoff: 0.5,
17
- };
@@ -1,2 +0,0 @@
1
- import { TrainingResults } from "../../types";
2
- export declare const results: TrainingResults;
@@ -1,110 +0,0 @@
1
- export const results = {
2
- bias: -14.149651527404785,
3
- coeffs: [
4
- ["login-fieldsCount", 10.391072273254395],
5
- ["login-inputCount", 7.896396160125732],
6
- ["login-fieldsetCount", -68.60009002685547],
7
- ["login-textCount", -14.596487045288086],
8
- ["login-textareaCount", -3.1319539546966553],
9
- ["login-selectCount", -19.348663330078125],
10
- ["login-optionsCount", -8.138714790344238],
11
- ["login-radioCount", -3.002058744430542],
12
- ["login-identifierCount", -1.8425931930541992],
13
- ["login-hiddenIdentifierCount", -11.682873725891113],
14
- ["login-usernameCount", 4.909402370452881],
15
- ["login-emailCount", -16.64372444152832],
16
- ["login-hiddenCount", 3.234445333480835],
17
- ["login-hiddenPasswordCount", 27.490312576293945],
18
- ["login-submitCount", -9.968663215637207],
19
- ["login-hasTels", -20.656455993652344],
20
- ["login-hasOAuth", 29.474502563476562],
21
- ["login-hasCaptchas", 4.442995548248291],
22
- ["login-hasFiles", -3.0809483528137207],
23
- ["login-hasDate", -60.66382598876953],
24
- ["login-hasNumber", -3.270005464553833],
25
- ["login-oneVisibleField", 7.5113630294799805],
26
- ["login-twoVisibleFields", 3.8682427406311035],
27
- ["login-threeOrMoreVisibleFields", -4.249049663543701],
28
- ["login-noPasswords", -24.83741569519043],
29
- ["login-onePassword", 14.349983215332031],
30
- ["login-twoPasswords", -30.01285171508789],
31
- ["login-threeOrMorePasswords", -3.263638734817505],
32
- ["login-noIdentifiers", -25.86756706237793],
33
- ["login-oneIdentifier", -2.0249156951904297],
34
- ["login-twoIdentifiers", -13.93643856048584],
35
- ["login-threeOrMoreIdentifiers", 29.31741714477539],
36
- ["login-autofocusedIsIdentifier", 20.268266677856445],
37
- ["login-autofocusedIsPassword", 8.478031158447266],
38
- ["login-visibleRatio", 18.158212661743164],
39
- ["login-inputRatio", 5.391749858856201],
40
- ["login-hiddenRatio", -5.669593334197998],
41
- ["login-identifierRatio", 9.734586715698242],
42
- ["login-emailRatio", 6.223598957061768],
43
- ["login-usernameRatio", -11.61974048614502],
44
- ["login-passwordRatio", -1.364717960357666],
45
- ["login-requiredRatio", 4.994405746459961],
46
- ["login-checkboxRatio", 11.48732852935791],
47
- ["login-pageLogin", 20.409452438354492],
48
- ["login-formTextLogin", 4.316507816314697],
49
- ["login-formAttrsLogin", 14.0834321975708],
50
- ["login-headingsLogin", 30.295822143554688],
51
- ["login-layoutLogin", 3.863393783569336],
52
- ["login-rememberMeCheckbox", 4.309600353240967],
53
- ["login-troubleLink", 14.665351867675781],
54
- ["login-submitLogin", 19.408567428588867],
55
- ["login-pageRegister", -21.093368530273438],
56
- ["login-formTextRegister", -0.07521277666091919],
57
- ["login-formAttrsRegister", -34.405303955078125],
58
- ["login-headingsRegister", -18.120296478271484],
59
- ["login-layoutRegister", 1.0777455568313599],
60
- ["login-pwNewRegister", -41.26034927368164],
61
- ["login-pwConfirmRegister", -40.572444915771484],
62
- ["login-submitRegister", -17.067047119140625],
63
- ["login-TOSRef", -14.630489349365234],
64
- ["login-pagePwReset", -13.291223526000977],
65
- ["login-formTextPwReset", -3.153836965560913],
66
- ["login-formAttrsPwReset", -19.77623176574707],
67
- ["login-headingsPwReset", -17.230947494506836],
68
- ["login-layoutPwReset", 22.98288345336914],
69
- ["login-pageRecovery", -2.061774492263794],
70
- ["login-formTextRecovery", 0.08132856339216232],
71
- ["login-formAttrsRecovery", -66.31858825683594],
72
- ["login-headingsRecovery", -13.98796272277832],
73
- ["login-layoutRecovery", 12.508500099182129],
74
- ["login-identifierRecovery", 5.113758563995361],
75
- ["login-submitRecovery", -25.719371795654297],
76
- ["login-formTextMFA", -42.03092956542969],
77
- ["login-formAttrsMFA", -24.529211044311523],
78
- ["login-inputsMFA", -35.11868667602539],
79
- ["login-inputsOTP", -12.179057121276855],
80
- ["login-newsletterForm", -4.593125820159912],
81
- ["login-searchForm", -4.092717170715332],
82
- ["login-multiStepForm", 3.4450526237487793],
83
- ["login-multiAuthForm", 20.28468132019043],
84
- ["login-visibleRatio,fieldsCount", -19.09153175354004],
85
- ["login-visibleRatio,identifierCount", -24.61549186706543],
86
- ["login-visibleRatio,passwordCount", 50.66000747680664],
87
- ["login-visibleRatio,hiddenIdentifierCount", -23.864887237548828],
88
- ["login-visibleRatio,hiddenPasswordCount", -44.895076751708984],
89
- ["login-visibleRatio,multiStepForm", -2.745039701461792],
90
- ["login-identifierRatio,fieldsCount", -12.057147979736328],
91
- ["login-identifierRatio,identifierCount", 8.087873458862305],
92
- ["login-identifierRatio,passwordCount", -24.407482147216797],
93
- ["login-identifierRatio,hiddenIdentifierCount", -1.1358821392059326],
94
- ["login-identifierRatio,hiddenPasswordCount", 40.50886917114258],
95
- ["login-identifierRatio,multiStepForm", 19.962892532348633],
96
- ["login-passwordRatio,fieldsCount", 24.11024284362793],
97
- ["login-passwordRatio,identifierCount", -26.295989990234375],
98
- ["login-passwordRatio,passwordCount", -4.2998175621032715],
99
- ["login-passwordRatio,hiddenIdentifierCount", 80.12600708007812],
100
- ["login-passwordRatio,hiddenPasswordCount", 80.48567962646484],
101
- ["login-passwordRatio,multiStepForm", -34.7525634765625],
102
- ["login-requiredRatio,fieldsCount", 24.920564651489258],
103
- ["login-requiredRatio,identifierCount", -29.104509353637695],
104
- ["login-requiredRatio,passwordCount", 55.80110168457031],
105
- ["login-requiredRatio,hiddenIdentifierCount", -23.510656356811523],
106
- ["login-requiredRatio,hiddenPasswordCount", 13.153876304626465],
107
- ["login-requiredRatio,multiStepForm", 22.942983627319336],
108
- ],
109
- cutoff: 0.5,
110
- };
@@ -1,2 +0,0 @@
1
- import { TrainingResults } from "../../types";
2
- export declare const results: TrainingResults;