@konfeature/ap-email-guessr 0.1.6 → 0.1.8
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/package.json +1 -1
- package/src/lib/actions/find-email.d.ts +2 -0
- package/src/lib/actions/find-email.d.ts.map +1 -1
- package/src/lib/actions/find-email.js +22 -0
- package/src/lib/actions/find-email.js.map +1 -1
- package/src/lib/common/domain-cache.d.ts +60 -0
- package/src/lib/common/domain-cache.d.ts.map +1 -0
- package/src/lib/common/domain-cache.js +57 -0
- package/src/lib/common/domain-cache.js.map +1 -0
- package/src/lib/common/find-person.d.ts +3 -0
- package/src/lib/common/find-person.d.ts.map +1 -1
- package/src/lib/common/find-person.js +106 -24
- package/src/lib/common/find-person.js.map +1 -1
- package/src/lib/common/patterns.d.ts +33 -0
- package/src/lib/common/patterns.d.ts.map +1 -1
- package/src/lib/common/patterns.js +167 -43
- package/src/lib/common/patterns.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konfeature/ap-email-guessr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Activepieces piece that finds a person's email from their name and company domain — free Microsoft 365 account checks plus no2bounce verification, with early-stop to minimize credits.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -6,5 +6,7 @@ export declare const findEmailAction: import("@activepieces/pieces-framework").I
|
|
|
6
6
|
maxChecks: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
7
|
useO365: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
8
8
|
timeout: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
+
useCache: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
cacheTtlDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
11
|
}>;
|
|
10
12
|
//# sourceMappingURL=find-email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-email.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-email.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;EA4H1B,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findEmailAction = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const auth_1 = require("../common/auth");
|
|
6
|
+
const domain_cache_1 = require("../common/domain-cache");
|
|
6
7
|
const find_person_1 = require("../common/find-person");
|
|
7
8
|
const no2bounce_verifier_1 = require("../common/verifiers/no2bounce-verifier");
|
|
8
9
|
exports.findEmailAction = (0, pieces_framework_1.createAction)({
|
|
@@ -54,12 +55,32 @@ exports.findEmailAction = (0, pieces_framework_1.createAction)({
|
|
|
54
55
|
required: false,
|
|
55
56
|
defaultValue: 15,
|
|
56
57
|
}),
|
|
58
|
+
useCache: pieces_framework_1.Property.Checkbox({
|
|
59
|
+
displayName: "Use Domain Cache",
|
|
60
|
+
description: "Remember per-domain learnings across runs (dead/catch-all domains and the winning naming pattern) to cut redundant no2bounce credits. Stored in the project store.",
|
|
61
|
+
required: false,
|
|
62
|
+
defaultValue: true,
|
|
63
|
+
}),
|
|
64
|
+
cacheTtlDays: pieces_framework_1.Property.Number({
|
|
65
|
+
displayName: "Cache TTL (days)",
|
|
66
|
+
description: "How long a domain's cached learnings stay valid before they are refreshed. 0 disables expiry. Default 30.",
|
|
67
|
+
required: false,
|
|
68
|
+
defaultValue: 30,
|
|
69
|
+
}),
|
|
57
70
|
},
|
|
58
71
|
async run(context) {
|
|
59
72
|
const { firstName, lastName, domain, patternSet, maxChecks, useO365 } = context.propsValue;
|
|
60
73
|
const timeoutSeconds = context.propsValue.timeout ?? 15;
|
|
61
74
|
const timeoutMs = Math.min(Math.max(Number(timeoutSeconds) || 15, 1), 120) * 1000;
|
|
62
75
|
const token = (0, auth_1.readSecretText)(context.auth);
|
|
76
|
+
const useCache = context.propsValue.useCache ?? true;
|
|
77
|
+
const ttlDays = context.propsValue.cacheTtlDays;
|
|
78
|
+
const ttlMs = ttlDays != null && Number(ttlDays) >= 0
|
|
79
|
+
? Number(ttlDays) * 24 * 60 * 60 * 1000
|
|
80
|
+
: domain_cache_1.DEFAULT_CACHE_TTL_MS;
|
|
81
|
+
const cache = useCache
|
|
82
|
+
? (0, domain_cache_1.createStoreDomainCache)(context.store, ttlMs)
|
|
83
|
+
: undefined;
|
|
63
84
|
const result = await (0, find_person_1.findPersonEmail)(firstName, lastName, domain, {
|
|
64
85
|
patternSet: patternSet ?? "common",
|
|
65
86
|
maxChecks: maxChecks != null ? Math.max(1, Number(maxChecks)) : undefined,
|
|
@@ -67,6 +88,7 @@ exports.findEmailAction = (0, pieces_framework_1.createAction)({
|
|
|
67
88
|
timeoutMs,
|
|
68
89
|
useO365: useO365 ?? true,
|
|
69
90
|
no2bounceToken: token,
|
|
91
|
+
cache,
|
|
70
92
|
}).catch((error) => {
|
|
71
93
|
if (error instanceof no2bounce_verifier_1.No2BounceAuthError) {
|
|
72
94
|
throw new Error(`no2bounce rejected the API token — check the connection's API key (it may be invalid, expired, or have trailing whitespace). ${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/find-email.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,yCAAgD;AAChD,uDAAwD;AAExD,+EAA4E;AAE/D,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EACP,ySAAyS;IAC7S,KAAK,EAAE;QACH,SAAS,EAAE,2BAAQ,CAAC,SAAS,CA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* Verification cost is dominated by no2bounce credits (1/email, no refund).
|
|
5
|
+
* Most of that spend is redundant across people on the *same* domain: the
|
|
6
|
+
* domain's mail routing never changes between two lookups, the domain is either
|
|
7
|
+
* accept-all for everyone or no one, and a company almost always uses a single
|
|
8
|
+
* naming convention. So once we learn those facts for a domain we can reuse
|
|
9
|
+
* them and stop paying to rediscover them:
|
|
10
|
+
*
|
|
11
|
+
* - `dead` → null/no MX. Future lookups short-circuit to `invalid` with no
|
|
12
|
+
* DNS round-trip and zero credits.
|
|
13
|
+
* - `catchAll` → the domain accepts everything. No mailbox can be confirmed, so
|
|
14
|
+
* future lookups return `catch_all` immediately for zero credits
|
|
15
|
+
* instead of spending one to rediscover the accept-all signal.
|
|
16
|
+
* - `routing` → the resolved provider / O365 namespace / chosen verifier, so
|
|
17
|
+
* we skip the MX + getuserrealm round-trips (latency + throttle).
|
|
18
|
+
* - `patternId`→ the naming convention that produced a real hit (e.g.
|
|
19
|
+
* `first.last`, `flast`). The next person on that domain has that
|
|
20
|
+
* exact pattern moved to the front, so the single first probe is
|
|
21
|
+
* the likely hit: one credit instead of a whole round.
|
|
22
|
+
*
|
|
23
|
+
* The interface is deliberately storage-agnostic (a plain get/set keyed by
|
|
24
|
+
* domain) so the search logic stays pure and unit-testable; the Activepieces
|
|
25
|
+
* `Store` adapter lives at the bottom of this file.
|
|
26
|
+
*/
|
|
27
|
+
import { Store } from "@activepieces/pieces-framework";
|
|
28
|
+
import type { O365Namespace } from "./providers/o365";
|
|
29
|
+
export interface DomainRouting {
|
|
30
|
+
providerId: string;
|
|
31
|
+
microsoftBacked: boolean;
|
|
32
|
+
namespace: O365Namespace;
|
|
33
|
+
verifierUsed: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DomainMemory {
|
|
36
|
+
/** null/no MX — the domain cannot receive mail. */
|
|
37
|
+
dead?: boolean;
|
|
38
|
+
/** Reason string carried over to the short-circuited result. */
|
|
39
|
+
deadReason?: string;
|
|
40
|
+
/** The domain accepts everything; no individual mailbox is confirmable. */
|
|
41
|
+
catchAll?: boolean;
|
|
42
|
+
/** Resolved routing, so DNS + realm lookups can be skipped. */
|
|
43
|
+
routing?: DomainRouting;
|
|
44
|
+
/** Learned winning pattern id (primary patterns only). */
|
|
45
|
+
patternId?: string;
|
|
46
|
+
/** Epoch ms of the last write, used for TTL expiry. */
|
|
47
|
+
updatedAt: number;
|
|
48
|
+
}
|
|
49
|
+
export interface DomainCache {
|
|
50
|
+
get(domain: string): Promise<DomainMemory | null>;
|
|
51
|
+
set(domain: string, memory: DomainMemory): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
/** 30 days. Routing and naming conventions drift rarely; refresh occasionally. */
|
|
54
|
+
export declare const DEFAULT_CACHE_TTL_MS: number;
|
|
55
|
+
/**
|
|
56
|
+
* Back the domain cache with the Activepieces project store, so learnings are
|
|
57
|
+
* shared across every flow run in the project. A `ttlMs` of 0 disables expiry.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createStoreDomainCache(store: Store, ttlMs?: number): DomainCache;
|
|
60
|
+
//# sourceMappingURL=domain-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-cache.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/domain-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,KAAK,EAAc,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IACzB,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAClD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,KAAK,EACZ,KAAK,GAAE,MAA6B,GACrC,WAAW,CAoBb"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Per-domain memory — the credit-saving cache.
|
|
4
|
+
*
|
|
5
|
+
* Verification cost is dominated by no2bounce credits (1/email, no refund).
|
|
6
|
+
* Most of that spend is redundant across people on the *same* domain: the
|
|
7
|
+
* domain's mail routing never changes between two lookups, the domain is either
|
|
8
|
+
* accept-all for everyone or no one, and a company almost always uses a single
|
|
9
|
+
* naming convention. So once we learn those facts for a domain we can reuse
|
|
10
|
+
* them and stop paying to rediscover them:
|
|
11
|
+
*
|
|
12
|
+
* - `dead` → null/no MX. Future lookups short-circuit to `invalid` with no
|
|
13
|
+
* DNS round-trip and zero credits.
|
|
14
|
+
* - `catchAll` → the domain accepts everything. No mailbox can be confirmed, so
|
|
15
|
+
* future lookups return `catch_all` immediately for zero credits
|
|
16
|
+
* instead of spending one to rediscover the accept-all signal.
|
|
17
|
+
* - `routing` → the resolved provider / O365 namespace / chosen verifier, so
|
|
18
|
+
* we skip the MX + getuserrealm round-trips (latency + throttle).
|
|
19
|
+
* - `patternId`→ the naming convention that produced a real hit (e.g.
|
|
20
|
+
* `first.last`, `flast`). The next person on that domain has that
|
|
21
|
+
* exact pattern moved to the front, so the single first probe is
|
|
22
|
+
* the likely hit: one credit instead of a whole round.
|
|
23
|
+
*
|
|
24
|
+
* The interface is deliberately storage-agnostic (a plain get/set keyed by
|
|
25
|
+
* domain) so the search logic stays pure and unit-testable; the Activepieces
|
|
26
|
+
* `Store` adapter lives at the bottom of this file.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DEFAULT_CACHE_TTL_MS = void 0;
|
|
30
|
+
exports.createStoreDomainCache = createStoreDomainCache;
|
|
31
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
32
|
+
/** 30 days. Routing and naming conventions drift rarely; refresh occasionally. */
|
|
33
|
+
exports.DEFAULT_CACHE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
34
|
+
const KEY_PREFIX = "domain-memory:";
|
|
35
|
+
/**
|
|
36
|
+
* Back the domain cache with the Activepieces project store, so learnings are
|
|
37
|
+
* shared across every flow run in the project. A `ttlMs` of 0 disables expiry.
|
|
38
|
+
*/
|
|
39
|
+
function createStoreDomainCache(store, ttlMs = exports.DEFAULT_CACHE_TTL_MS) {
|
|
40
|
+
const key = (domain) => `${KEY_PREFIX}${domain}`;
|
|
41
|
+
return {
|
|
42
|
+
async get(domain) {
|
|
43
|
+
const memory = await store.get(key(domain), pieces_framework_1.StoreScope.PROJECT);
|
|
44
|
+
if (!memory) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (ttlMs > 0 && Date.now() - (memory.updatedAt ?? 0) > ttlMs) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return memory;
|
|
51
|
+
},
|
|
52
|
+
async set(domain, memory) {
|
|
53
|
+
await store.put(key(domain), memory, pieces_framework_1.StoreScope.PROJECT);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=domain-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-cache.js","sourceRoot":"","sources":["../../../../src/lib/common/domain-cache.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAyCH,wDAuBC;AA9DD,qEAAmE;AA8BnE,kFAAkF;AACrE,QAAA,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC;;;GAGG;AACH,SAAgB,sBAAsB,CAClC,KAAY,EACZ,QAAgB,4BAAoB;IAEpC,MAAM,GAAG,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,MAAM,EAAE,CAAC;IACjE,OAAO;QACH,KAAK,CAAC,GAAG,CAAC,MAAM;YACZ,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAC1B,GAAG,CAAC,MAAM,CAAC,EACX,6BAAU,CAAC,OAAO,CACrB,CAAC;YACF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;gBAC5D,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM;YACpB,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,6BAAU,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* "Managed realm but Google/Zoho MX" exclusion is the louyetu.fr false-negative
|
|
9
9
|
* fix: a leftover Azure AD tenant must not be trusted as Microsoft mail.
|
|
10
10
|
*/
|
|
11
|
+
import type { DomainCache } from "./domain-cache";
|
|
11
12
|
import { type FindEmailResult } from "./find-email";
|
|
12
13
|
import { type PatternSet } from "./patterns";
|
|
13
14
|
export interface FindPersonOptions {
|
|
@@ -19,6 +20,8 @@ export interface FindPersonOptions {
|
|
|
19
20
|
timeoutMs: number;
|
|
20
21
|
useO365: boolean;
|
|
21
22
|
no2bounceToken?: string;
|
|
23
|
+
/** Optional per-domain memory; skips redundant work and credits. */
|
|
24
|
+
cache?: DomainCache;
|
|
22
25
|
}
|
|
23
26
|
export interface FindPersonResult extends FindEmailResult {
|
|
24
27
|
reason: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-person.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/find-person.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"find-person.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/find-person.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA+B,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/D,OAAO,EAEH,KAAK,UAAU,EAIlB,MAAM,YAAY,CAAC;AAOpB,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAChC;AA2BD,wBAAsB,eAAe,CACjC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAmH3B"}
|
|
@@ -37,42 +37,57 @@ function earlyExit(candidatesConsidered, domain, mxProvider, verdict, confidence
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
async function findPersonEmail(firstName, lastName, domain, options) {
|
|
40
|
-
const
|
|
40
|
+
const cleanDomain = (0, patterns_1.normalizeDomain)(domain);
|
|
41
|
+
const cache = options.cache;
|
|
42
|
+
const memory = cache ? await cache.get(cleanDomain) : null;
|
|
43
|
+
const candidateMeta = (0, patterns_1.generateCandidates)({
|
|
41
44
|
firstName,
|
|
42
45
|
lastName,
|
|
43
46
|
domain,
|
|
44
47
|
patternSet: options.patternSet,
|
|
45
48
|
maxVariants: options.maxVariants,
|
|
49
|
+
// Reuse the domain's learned naming convention so the first probe hits.
|
|
50
|
+
preferPatternId: memory?.patternId,
|
|
46
51
|
});
|
|
47
|
-
const
|
|
52
|
+
const candidates = candidateMeta.map((c) => c.email);
|
|
48
53
|
if (candidates.length === 0) {
|
|
49
54
|
return earlyExit(0, cleanDomain, "none", "invalid", 0.03, "no_candidates");
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return earlyExit(candidates.length, cleanDomain, provider.id, "invalid", 0.02, "null_mx");
|
|
56
|
+
// Cache hit: the domain can't receive mail. No DNS, no credits.
|
|
57
|
+
if (memory?.dead) {
|
|
58
|
+
return earlyExit(candidates.length, cleanDomain, memory.routing?.providerId ?? "none", "invalid", 0.02, `cached_${memory.deadReason ?? "dead"}`);
|
|
55
59
|
}
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
// Cache hit: the domain is accept-all. No mailbox is confirmable, so don't
|
|
61
|
+
// spend a credit rediscovering that — return catch_all straight away.
|
|
62
|
+
if (memory?.catchAll) {
|
|
63
|
+
return {
|
|
64
|
+
found: false,
|
|
65
|
+
email: null,
|
|
66
|
+
verdict: "catch_all",
|
|
67
|
+
confidence: 0.5,
|
|
68
|
+
catchAll: true,
|
|
69
|
+
candidatesChecked: 0,
|
|
70
|
+
creditsUsed: 0,
|
|
71
|
+
attempts: [],
|
|
72
|
+
reason: "cached_catch_all",
|
|
73
|
+
domain: cleanDomain,
|
|
74
|
+
mxProvider: memory.routing?.providerId ?? "unknown",
|
|
75
|
+
verifierUsed: "cache",
|
|
76
|
+
candidatesConsidered: candidates.length,
|
|
77
|
+
};
|
|
58
78
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
!(0, mx_fingerprint_1.hostsNonMicrosoftMailboxes)(provider)) {
|
|
67
|
-
namespace = await (0, o365_1.getUserRealm)(cleanDomain, options.timeoutMs);
|
|
68
|
-
if (namespace === "Managed") {
|
|
69
|
-
microsoftBacked = true;
|
|
70
|
-
}
|
|
79
|
+
const routing = await resolveRouting(cleanDomain, options, memory);
|
|
80
|
+
if (routing.kind === "dead") {
|
|
81
|
+
await persist(cache, cleanDomain, memory, {
|
|
82
|
+
dead: true,
|
|
83
|
+
deadReason: routing.reason,
|
|
84
|
+
});
|
|
85
|
+
return earlyExit(candidates.length, cleanDomain, routing.providerId, "invalid", routing.reason === "null_mx" ? 0.02 : 0.03, routing.reason);
|
|
71
86
|
}
|
|
72
87
|
let verifier;
|
|
73
88
|
let verifierUsed;
|
|
74
|
-
if (options.useO365 && microsoftBacked) {
|
|
75
|
-
verifier = (0, o365_verifier_1.createO365Verifier)(namespace ?? "Managed", true, options.timeoutMs);
|
|
89
|
+
if (options.useO365 && routing.microsoftBacked) {
|
|
90
|
+
verifier = (0, o365_verifier_1.createO365Verifier)(routing.namespace ?? "Managed", true, options.timeoutMs);
|
|
76
91
|
verifierUsed = "o365";
|
|
77
92
|
}
|
|
78
93
|
else if (options.no2bounceToken) {
|
|
@@ -83,20 +98,87 @@ async function findPersonEmail(firstName, lastName, domain, options) {
|
|
|
83
98
|
verifierUsed = "no2bounce";
|
|
84
99
|
}
|
|
85
100
|
else {
|
|
86
|
-
return earlyExit(candidates.length, cleanDomain,
|
|
101
|
+
return earlyExit(candidates.length, cleanDomain, routing.providerId, "unknown", 0.5, "no2bounce_token_required");
|
|
87
102
|
}
|
|
88
103
|
const result = await (0, find_email_1.findEmail)(candidates, verifier, {
|
|
89
104
|
maxChecks: options.maxChecks,
|
|
90
105
|
stopOnFirstHit: options.stopOnFirstHit,
|
|
91
106
|
batchSize: verifierUsed === "no2bounce" ? NO2BOUNCE_BATCH_SIZE : 1,
|
|
92
107
|
});
|
|
108
|
+
await learn(cache, cleanDomain, memory, result, candidateMeta, {
|
|
109
|
+
providerId: routing.providerId,
|
|
110
|
+
microsoftBacked: routing.microsoftBacked,
|
|
111
|
+
namespace: routing.namespace,
|
|
112
|
+
verifierUsed,
|
|
113
|
+
});
|
|
93
114
|
return {
|
|
94
115
|
...result,
|
|
95
116
|
reason: `${verifierUsed}_${result.verdict}`,
|
|
96
117
|
domain: cleanDomain,
|
|
97
|
-
mxProvider:
|
|
118
|
+
mxProvider: routing.providerId,
|
|
98
119
|
verifierUsed,
|
|
99
120
|
candidatesConsidered: candidates.length,
|
|
100
121
|
};
|
|
101
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolve mail routing for a domain, reusing a cached decision when present so
|
|
125
|
+
* the MX + getuserrealm round-trips (and their throttling) are skipped.
|
|
126
|
+
*/
|
|
127
|
+
async function resolveRouting(cleanDomain, options, memory) {
|
|
128
|
+
if (memory?.routing) {
|
|
129
|
+
return {
|
|
130
|
+
kind: "live",
|
|
131
|
+
providerId: memory.routing.providerId,
|
|
132
|
+
microsoftBacked: memory.routing.microsoftBacked,
|
|
133
|
+
namespace: memory.routing.namespace,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const routing = await (0, dns_1.resolveMail)(cleanDomain);
|
|
137
|
+
const provider = (0, mx_fingerprint_1.fingerprintMx)(routing.hosts);
|
|
138
|
+
if (routing.nullMx) {
|
|
139
|
+
return { kind: "dead", providerId: provider.id, reason: "null_mx" };
|
|
140
|
+
}
|
|
141
|
+
if (routing.hosts.length === 0) {
|
|
142
|
+
return { kind: "dead", providerId: provider.id, reason: "no_mx_record" };
|
|
143
|
+
}
|
|
144
|
+
let namespace = null;
|
|
145
|
+
let microsoftBacked = (0, o365_1.isMicrosoftConsumerDomain)(cleanDomain) || provider.microsoftBacked;
|
|
146
|
+
// Only spend a realm lookup on ambiguous MX (not obviously Microsoft, not a
|
|
147
|
+
// known foreign mailbox host) — that's where O365-behind-a-gateway hides.
|
|
148
|
+
if (options.useO365 &&
|
|
149
|
+
!microsoftBacked &&
|
|
150
|
+
!(0, mx_fingerprint_1.hostsNonMicrosoftMailboxes)(provider)) {
|
|
151
|
+
namespace = await (0, o365_1.getUserRealm)(cleanDomain, options.timeoutMs);
|
|
152
|
+
if (namespace === "Managed") {
|
|
153
|
+
microsoftBacked = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return { kind: "live", providerId: provider.id, microsoftBacked, namespace };
|
|
157
|
+
}
|
|
158
|
+
async function persist(cache, domain, prior, patch) {
|
|
159
|
+
if (!cache) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
await cache.set(domain, { ...prior, ...patch, updatedAt: Date.now() });
|
|
163
|
+
}
|
|
164
|
+
/** Record what this run taught us about the domain (routing, catch-all, pattern). */
|
|
165
|
+
async function learn(cache, domain, prior, result, candidateMeta, routing) {
|
|
166
|
+
if (!cache) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const patch = { routing };
|
|
170
|
+
if (result.found && result.email) {
|
|
171
|
+
// A real hit pins the domain's naming convention. We keep probing such
|
|
172
|
+
// domains even when the hit is accept-all (it still yields a probable
|
|
173
|
+
// address), so we record the pattern rather than flagging catch_all.
|
|
174
|
+
const hit = candidateMeta.find((c) => c.email === result.email);
|
|
175
|
+
if (hit && (0, patterns_1.isLearnablePatternId)(hit.patternId)) {
|
|
176
|
+
patch.patternId = hit.patternId;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else if (result.verdict === "catch_all") {
|
|
180
|
+
patch.catchAll = true;
|
|
181
|
+
}
|
|
182
|
+
await persist(cache, domain, prior, patch);
|
|
183
|
+
}
|
|
102
184
|
//# sourceMappingURL=find-person.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-person.js","sourceRoot":"","sources":["../../../../src/lib/common/find-person.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;
|
|
1
|
+
{"version":3,"file":"find-person.js","sourceRoot":"","sources":["../../../../src/lib/common/find-person.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAsEH,0CAwHC;AA3LD,+BAAoC;AACpC,6CAA+D;AAC/D,qDAA6E;AAC7E,2CAI0B;AAC1B,yCAMoB;AAEpB,uEAAyE;AACzE,6DAA+D;AAE/D,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAuB/B,SAAS,SAAS,CACd,oBAA4B,EAC5B,MAAc,EACd,UAAkB,EAClB,OAAsB,EACtB,UAAkB,EAClB,MAAc;IAEd,OAAO;QACH,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,IAAI;QACX,OAAO;QACP,UAAU;QACV,QAAQ,EAAE,KAAK;QACf,iBAAiB,EAAE,CAAC;QACpB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,MAAM;QACN,MAAM;QACN,UAAU;QACV,YAAY,EAAE,MAAM;QACpB,oBAAoB;KACv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AAC,GAAG,CAAC,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED,qFAAqF;AACrF,KAAK,UAAU,KAAK,CAChB,KAA8B,EAC9B,MAAc,EACd,KAA0B,EAC1B,MAAuB,EACvB,aAA+B,EAC/B,OAAsB;IAEtB,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO;IACX,CAAC;IAED,MAAM,KAAK,GAA0B,EAAE,OAAO,EAAE,CAAC;IAEjD,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC/B,uEAAuE;QACvE,sEAAsE;QACtE,qEAAqE;QACrE,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC;QAChE,IAAI,GAAG,IAAI,IAAA,+BAAoB,EAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7C,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QACpC,CAAC;IACL,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACxC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
* The order is load-bearing: the verifier checks candidates top-down and stops
|
|
6
6
|
* on the first hit, so the most likely patterns must come first to minimize
|
|
7
7
|
* paid verifications. "common" keeps only the leading high-probability slice.
|
|
8
|
+
*
|
|
9
|
+
* Compound names (hyphens, spaces, particles like "van"/"de") are expanded.
|
|
10
|
+
* The PRIMARY block runs the historical pattern list over the whole joined
|
|
11
|
+
* name — unchanged output for simple names, and the only block "common" (and
|
|
12
|
+
* therefore the early-stop search by default) ever sees, so credit cost is
|
|
13
|
+
* stable. An ALTERNATE block then appends per-token and compound-initial
|
|
14
|
+
* variants that only enrich the "all" set: e.g. "Jean-Pierre Dupont" also
|
|
15
|
+
* yields jean.dupont / jp.dupont, "van der Berg" also yields berg / j.berg,
|
|
16
|
+
* "García López" also yields maria.garcia / maria.lopez.
|
|
8
17
|
*/
|
|
9
18
|
/** Lowercase, strip accents and keep only [a-z0-9]. */
|
|
10
19
|
export declare function normalizeNamePart(value: string): string;
|
|
@@ -19,7 +28,31 @@ export interface GenerateEmailsParams {
|
|
|
19
28
|
patternSet?: PatternSet;
|
|
20
29
|
/** Hard cap on candidates returned, applied after ordering. */
|
|
21
30
|
maxVariants?: number;
|
|
31
|
+
/**
|
|
32
|
+
* A previously-learned winning pattern id for this domain. When supplied,
|
|
33
|
+
* the candidate produced by that pattern is moved to the front so the
|
|
34
|
+
* single first probe is most likely to hit (one credit instead of a round).
|
|
35
|
+
*/
|
|
36
|
+
preferPatternId?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A generated candidate plus the id of the pattern that produced it. */
|
|
39
|
+
export interface EmailCandidate {
|
|
40
|
+
email: string;
|
|
41
|
+
local: string;
|
|
42
|
+
patternId: string;
|
|
22
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* True when a pattern id generalizes across people on the same domain (the
|
|
46
|
+
* primary block). Compound/standalone variants depend on the specific name, so
|
|
47
|
+
* they are not cached as a domain's naming convention.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isLearnablePatternId(id: string | undefined): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Generate de-duplicated candidates (with their pattern ids) ordered by
|
|
52
|
+
* likelihood. Returns an empty array when the domain or both name parts are
|
|
53
|
+
* missing. `generateEmailCandidates` wraps this for the string-only callers.
|
|
54
|
+
*/
|
|
55
|
+
export declare function generateCandidates(params: GenerateEmailsParams): EmailCandidate[];
|
|
23
56
|
/**
|
|
24
57
|
* Generate a de-duplicated list of candidate emails ordered by likelihood.
|
|
25
58
|
* Returns an empty array when the domain or both name parts are missing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/patterns.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAeH,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACrB;AAQD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOpE;AAmGD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,oBAAoB,GAC7B,cAAc,EAAE,CAkGlB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAE9E"}
|
|
@@ -6,10 +6,21 @@
|
|
|
6
6
|
* The order is load-bearing: the verifier checks candidates top-down and stops
|
|
7
7
|
* on the first hit, so the most likely patterns must come first to minimize
|
|
8
8
|
* paid verifications. "common" keeps only the leading high-probability slice.
|
|
9
|
+
*
|
|
10
|
+
* Compound names (hyphens, spaces, particles like "van"/"de") are expanded.
|
|
11
|
+
* The PRIMARY block runs the historical pattern list over the whole joined
|
|
12
|
+
* name — unchanged output for simple names, and the only block "common" (and
|
|
13
|
+
* therefore the early-stop search by default) ever sees, so credit cost is
|
|
14
|
+
* stable. An ALTERNATE block then appends per-token and compound-initial
|
|
15
|
+
* variants that only enrich the "all" set: e.g. "Jean-Pierre Dupont" also
|
|
16
|
+
* yields jean.dupont / jp.dupont, "van der Berg" also yields berg / j.berg,
|
|
17
|
+
* "García López" also yields maria.garcia / maria.lopez.
|
|
9
18
|
*/
|
|
10
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
20
|
exports.normalizeNamePart = normalizeNamePart;
|
|
12
21
|
exports.normalizeDomain = normalizeDomain;
|
|
22
|
+
exports.isLearnablePatternId = isLearnablePatternId;
|
|
23
|
+
exports.generateCandidates = generateCandidates;
|
|
13
24
|
exports.generateEmailCandidates = generateEmailCandidates;
|
|
14
25
|
function stripDiacritics(input) {
|
|
15
26
|
let result = "";
|
|
@@ -39,67 +50,180 @@ function normalizeDomain(value) {
|
|
|
39
50
|
.replace(/\/.*$/, "")
|
|
40
51
|
.replace(/\s+/g, "");
|
|
41
52
|
}
|
|
53
|
+
// Sentinel ids for candidates produced outside the primary block. These are
|
|
54
|
+
// name/compound-specific, so they are never learned or preferred across people.
|
|
55
|
+
const ALT_ID = "alt";
|
|
56
|
+
const SURNAME_ID = "surname";
|
|
57
|
+
const GIVEN_ID = "given";
|
|
58
|
+
/**
|
|
59
|
+
* True when a pattern id generalizes across people on the same domain (the
|
|
60
|
+
* primary block). Compound/standalone variants depend on the specific name, so
|
|
61
|
+
* they are not cached as a domain's naming convention.
|
|
62
|
+
*/
|
|
63
|
+
function isLearnablePatternId(id) {
|
|
64
|
+
return (id !== undefined &&
|
|
65
|
+
id !== ALT_ID &&
|
|
66
|
+
id !== SURNAME_ID &&
|
|
67
|
+
id !== GIVEN_ID);
|
|
68
|
+
}
|
|
42
69
|
const LOCAL_PART_REGEX = /^[a-z0-9]([a-z0-9._-]*[a-z0-9])?$/;
|
|
43
70
|
/** Leading patterns that cover the large majority of real corporate addresses. */
|
|
44
71
|
const COMMON_LIMIT = 10;
|
|
72
|
+
/**
|
|
73
|
+
* Surname prefixes written as separate tokens. Dropped from the front of a
|
|
74
|
+
* surname to find the "core" name that usually drives the email — "van der
|
|
75
|
+
* Berg" → berg, "de la Cruz" → cruz.
|
|
76
|
+
*/
|
|
77
|
+
const SURNAME_PARTICLES = new Set([
|
|
78
|
+
"van", "von", "der", "den", "de", "del", "della", "di", "da", "dos", "das",
|
|
79
|
+
"du", "la", "le", "el", "lo", "ter", "ten", "op", "af", "av", "zu", "y", "e",
|
|
80
|
+
]);
|
|
45
81
|
const join = (a, sep, b) => a && b ? `${a}${sep}${b}` : "";
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
82
|
+
const uniq = (values) => [
|
|
83
|
+
...new Set(values.filter(Boolean)),
|
|
84
|
+
];
|
|
85
|
+
/** Split a name into normalized alphanumeric tokens (spaces, hyphens, dots, _). */
|
|
86
|
+
function tokenize(value) {
|
|
87
|
+
return stripDiacritics(value ?? "")
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.split(/[\s._-]+/)
|
|
90
|
+
.map((token) => token.replace(/[^a-z0-9]/g, ""))
|
|
91
|
+
.filter(Boolean);
|
|
92
|
+
}
|
|
93
|
+
/** Drop leading particle tokens, keeping at least the final token. */
|
|
94
|
+
function coreSurname(tokens) {
|
|
95
|
+
let i = 0;
|
|
96
|
+
while (i < tokens.length - 1 && SURNAME_PARTICLES.has(tokens[i])) {
|
|
97
|
+
i++;
|
|
98
|
+
}
|
|
99
|
+
return tokens.slice(i);
|
|
100
|
+
}
|
|
50
101
|
const PATTERNS = [
|
|
51
|
-
(p) => join(p.first, ".", p.last),
|
|
52
|
-
(p) => join(p.fi, "", p.last),
|
|
53
|
-
(p) => p.first,
|
|
54
|
-
(p) => join(p.first, "", p.last),
|
|
55
|
-
(p) => join(p.first, "_", p.last),
|
|
56
|
-
(p) => join(p.fi, ".", p.last),
|
|
57
|
-
(p) => join(p.first, "-", p.last),
|
|
58
|
-
(p) => p.last,
|
|
59
|
-
(p) => join(p.last, ".", p.first),
|
|
60
|
-
(p) => join(p.first, "", p.li),
|
|
61
|
-
(p) => join(p.fi, "", p.li),
|
|
62
|
-
(p) => join(p.last, "", p.first),
|
|
63
|
-
(p) => join(p.last, "_", p.first),
|
|
64
|
-
(p) => join(p.last, "-", p.first),
|
|
65
|
-
(p) => join(p.fi, "_", p.last),
|
|
66
|
-
(p) => join(p.fi, "-", p.last),
|
|
67
|
-
(p) => join(p.last, "", p.fi),
|
|
68
|
-
(p) => join(p.last, ".", p.fi),
|
|
69
|
-
(p) => join(p.li, "", p.fi),
|
|
70
|
-
(p) => join(p.first, ".", p.li),
|
|
102
|
+
{ id: "first.last", build: (p) => join(p.first, ".", p.last) },
|
|
103
|
+
{ id: "flast", build: (p) => join(p.fi, "", p.last) },
|
|
104
|
+
{ id: "first", build: (p) => p.first },
|
|
105
|
+
{ id: "firstlast", build: (p) => join(p.first, "", p.last) },
|
|
106
|
+
{ id: "first_last", build: (p) => join(p.first, "_", p.last) },
|
|
107
|
+
{ id: "f.last", build: (p) => join(p.fi, ".", p.last) },
|
|
108
|
+
{ id: "first-last", build: (p) => join(p.first, "-", p.last) },
|
|
109
|
+
{ id: "last", build: (p) => p.last },
|
|
110
|
+
{ id: "last.first", build: (p) => join(p.last, ".", p.first) },
|
|
111
|
+
{ id: "firstl", build: (p) => join(p.first, "", p.li) },
|
|
112
|
+
{ id: "fl", build: (p) => join(p.fi, "", p.li) },
|
|
113
|
+
{ id: "lastfirst", build: (p) => join(p.last, "", p.first) },
|
|
114
|
+
{ id: "last_first", build: (p) => join(p.last, "_", p.first) },
|
|
115
|
+
{ id: "last-first", build: (p) => join(p.last, "-", p.first) },
|
|
116
|
+
{ id: "f_last", build: (p) => join(p.fi, "_", p.last) },
|
|
117
|
+
{ id: "f-last", build: (p) => join(p.fi, "-", p.last) },
|
|
118
|
+
{ id: "lastf", build: (p) => join(p.last, "", p.fi) },
|
|
119
|
+
{ id: "last.f", build: (p) => join(p.last, ".", p.fi) },
|
|
120
|
+
{ id: "lf", build: (p) => join(p.li, "", p.fi) },
|
|
121
|
+
{ id: "first.l", build: (p) => join(p.first, ".", p.li) },
|
|
122
|
+
];
|
|
123
|
+
// Applied to every alternate (first-form, last-form) combination to widen the
|
|
124
|
+
// "all" set. Kept to the formats that actually appear in the wild so compound
|
|
125
|
+
// names don't explode into noise.
|
|
126
|
+
const ALT_PATTERNS = [
|
|
127
|
+
(f, l) => join(f, ".", l), // first.last
|
|
128
|
+
(f, l) => join(f.charAt(0), "", l), // flast
|
|
129
|
+
(f, l) => join(f, "", l), // firstlast
|
|
130
|
+
(f, l) => join(f, "_", l), // first_last
|
|
131
|
+
(f, l) => join(f, "-", l), // first-last
|
|
132
|
+
(f, l) => join(f, ".", l.charAt(0)), // first.l
|
|
133
|
+
(f, l) => join(l, ".", f), // last.first
|
|
71
134
|
];
|
|
72
135
|
/**
|
|
73
|
-
* Generate
|
|
74
|
-
* Returns an empty array when the domain or both name parts are
|
|
136
|
+
* Generate de-duplicated candidates (with their pattern ids) ordered by
|
|
137
|
+
* likelihood. Returns an empty array when the domain or both name parts are
|
|
138
|
+
* missing. `generateEmailCandidates` wraps this for the string-only callers.
|
|
75
139
|
*/
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
const
|
|
140
|
+
function generateCandidates(params) {
|
|
141
|
+
const firstTokens = tokenize(params.firstName);
|
|
142
|
+
const lastTokens = tokenize(params.lastName);
|
|
79
143
|
const domain = normalizeDomain(params.domain);
|
|
80
|
-
|
|
144
|
+
const firstJoined = firstTokens.join("");
|
|
145
|
+
const lastJoined = lastTokens.join("");
|
|
146
|
+
if (!domain || (!firstJoined && !lastJoined)) {
|
|
81
147
|
return [];
|
|
82
148
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
149
|
+
const lastCore = coreSurname(lastTokens);
|
|
150
|
+
const firstPrimary = firstTokens[0] ?? "";
|
|
151
|
+
const lastMain = lastCore[lastCore.length - 1] ?? "";
|
|
152
|
+
// Distinct first/last spellings to cross in the alternate block, most likely
|
|
153
|
+
// first. Compound-first initials ("jp") only when there is more than one
|
|
154
|
+
// token; otherwise that is just the single initial already covered by f.last.
|
|
155
|
+
const firstForms = uniq([
|
|
156
|
+
firstJoined,
|
|
157
|
+
firstPrimary,
|
|
158
|
+
firstTokens.length > 1 ? firstTokens.map((t) => t.charAt(0)).join("") : "",
|
|
159
|
+
]);
|
|
160
|
+
const lastForms = uniq([
|
|
161
|
+
lastJoined,
|
|
162
|
+
lastCore.join(""),
|
|
163
|
+
lastCore[0] ?? "",
|
|
164
|
+
lastMain,
|
|
165
|
+
]);
|
|
166
|
+
const primary = {
|
|
167
|
+
first: firstJoined,
|
|
168
|
+
last: lastJoined,
|
|
169
|
+
fi: (firstPrimary || firstJoined).charAt(0),
|
|
170
|
+
li: (lastMain || lastJoined).charAt(0),
|
|
88
171
|
};
|
|
172
|
+
const raw = [];
|
|
173
|
+
// Primary block — unchanged historical ordering, the slice "common" sees.
|
|
174
|
+
for (const pattern of PATTERNS) {
|
|
175
|
+
raw.push({ local: pattern.build(primary), patternId: pattern.id });
|
|
176
|
+
}
|
|
177
|
+
// Alternate block — compound coverage, grouped by pattern so the dominant
|
|
178
|
+
// first.last spread across name-forms lands ahead of rarer shapes.
|
|
179
|
+
for (const build of ALT_PATTERNS) {
|
|
180
|
+
for (const f of firstForms) {
|
|
181
|
+
for (const l of lastForms) {
|
|
182
|
+
if (f === firstJoined && l === lastJoined) {
|
|
183
|
+
continue; // already produced by the primary block
|
|
184
|
+
}
|
|
185
|
+
raw.push({ local: build(f, l), patternId: ALT_ID });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Standalone surname / given-name tokens (berg@, garcia@, jean@).
|
|
190
|
+
for (const l of lastForms) {
|
|
191
|
+
raw.push({ local: l, patternId: SURNAME_ID });
|
|
192
|
+
}
|
|
193
|
+
for (const f of firstForms) {
|
|
194
|
+
raw.push({ local: f, patternId: GIVEN_ID });
|
|
195
|
+
}
|
|
196
|
+
// A learned winning pattern for this domain jumps to the front (stable
|
|
197
|
+
// otherwise) so it becomes the single first probe.
|
|
198
|
+
const prioritized = params.preferPatternId !== undefined
|
|
199
|
+
? [
|
|
200
|
+
...raw.filter((c) => c.patternId === params.preferPatternId),
|
|
201
|
+
...raw.filter((c) => c.patternId !== params.preferPatternId),
|
|
202
|
+
]
|
|
203
|
+
: raw;
|
|
89
204
|
const seen = new Set();
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
const local =
|
|
205
|
+
const ordered = [];
|
|
206
|
+
for (const candidate of prioritized) {
|
|
207
|
+
const { local } = candidate;
|
|
93
208
|
if (!local || seen.has(local) || !LOCAL_PART_REGEX.test(local)) {
|
|
94
209
|
continue;
|
|
95
210
|
}
|
|
96
211
|
seen.add(local);
|
|
97
|
-
|
|
212
|
+
ordered.push(candidate);
|
|
98
213
|
}
|
|
99
214
|
const limit = params.maxVariants ??
|
|
100
|
-
(params.patternSet === "common" ? COMMON_LIMIT :
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
215
|
+
(params.patternSet === "common" ? COMMON_LIMIT : ordered.length);
|
|
216
|
+
return ordered.slice(0, Math.max(0, limit)).map(({ local, patternId }) => ({
|
|
217
|
+
email: `${local}@${domain}`,
|
|
218
|
+
local,
|
|
219
|
+
patternId,
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Generate a de-duplicated list of candidate emails ordered by likelihood.
|
|
224
|
+
* Returns an empty array when the domain or both name parts are missing.
|
|
225
|
+
*/
|
|
226
|
+
function generateEmailCandidates(params) {
|
|
227
|
+
return generateCandidates(params).map((c) => c.email);
|
|
104
228
|
}
|
|
105
229
|
//# sourceMappingURL=patterns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../../../src/lib/common/patterns.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../../../src/lib/common/patterns.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAgBH,8CAIC;AAGD,0CAQC;AAsCD,oDAOC;AAwGD,gDAoGC;AAMD,0DAEC;AA9RD,SAAS,eAAe,CAAC,KAAa;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACtC,oDAAoD;QACpD,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACnC,SAAS;QACb,CAAC;QACD,MAAM,IAAI,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,uDAAuD;AACvD,SAAgB,iBAAiB,CAAC,KAAa;IAC3C,OAAO,eAAe,CAAC,KAAK,IAAI,EAAE,CAAC;SAC9B,WAAW,EAAE;SACb,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,sEAAsE;AACtE,SAAgB,eAAe,CAAC,KAAa;IACzC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;SACf,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC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