@budiauktioner/buildi-primitives 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/banking/index.cjs +6491 -0
- package/dist/banking/index.cjs.map +1 -0
- package/dist/banking/index.d.cts +58 -0
- package/dist/banking/index.d.ts +58 -0
- package/dist/banking/index.js +6464 -0
- package/dist/banking/index.js.map +1 -0
- package/dist/contact/index.cjs +6678 -0
- package/dist/contact/index.cjs.map +1 -0
- package/dist/contact/index.d.cts +709 -0
- package/dist/contact/index.d.ts +709 -0
- package/dist/contact/index.js +6586 -0
- package/dist/contact/index.js.map +1 -0
- package/dist/country-BhD51LDL.d.cts +433 -0
- package/dist/country-p0n0EVQ9.d.ts +433 -0
- package/dist/finance/index.cjs +3592 -0
- package/dist/finance/index.cjs.map +1 -0
- package/dist/finance/index.d.cts +83 -0
- package/dist/finance/index.d.ts +83 -0
- package/dist/finance/index.js +3584 -0
- package/dist/finance/index.js.map +1 -0
- package/dist/geography/index.cjs +4227 -0
- package/dist/geography/index.cjs.map +1 -0
- package/dist/geography/index.d.cts +34 -0
- package/dist/geography/index.d.ts +34 -0
- package/dist/geography/index.js +4202 -0
- package/dist/geography/index.js.map +1 -0
- package/dist/index.cjs +14087 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +13868 -0
- package/dist/index.js.map +1 -0
- package/dist/isin-EeVPpNWu.d.ts +39 -0
- package/dist/isin-ZlQLBVm8.d.cts +39 -0
- package/dist/organization/index.cjs +2376 -0
- package/dist/organization/index.cjs.map +1 -0
- package/dist/organization/index.d.cts +117 -0
- package/dist/organization/index.d.ts +117 -0
- package/dist/organization/index.js +2346 -0
- package/dist/organization/index.js.map +1 -0
- package/dist/person/index.cjs +1144 -0
- package/dist/person/index.cjs.map +1 -0
- package/dist/person/index.d.cts +60 -0
- package/dist/person/index.d.ts +60 -0
- package/dist/person/index.js +1125 -0
- package/dist/person/index.js.map +1 -0
- package/dist/person-full-name-Cmc9Ynuc.d.cts +82 -0
- package/dist/person-full-name-D6Hbsab6.d.ts +82 -0
- package/dist/phone-number-C24--ggy.d.ts +139 -0
- package/dist/phone-number-DZ-YxCQQ.d.cts +139 -0
- package/dist/property/index.cjs +487 -0
- package/dist/property/index.cjs.map +1 -0
- package/dist/property/index.d.cts +56 -0
- package/dist/property/index.d.ts +56 -0
- package/dist/property/index.js +480 -0
- package/dist/property/index.js.map +1 -0
- package/dist/sample-data/index.cjs +12310 -0
- package/dist/sample-data/index.cjs.map +1 -0
- package/dist/sample-data/index.d.cts +260 -0
- package/dist/sample-data/index.d.ts +260 -0
- package/dist/sample-data/index.js +12302 -0
- package/dist/sample-data/index.js.map +1 -0
- package/dist/swedish-address-DNC3ftRF.d.cts +297 -0
- package/dist/swedish-address-GMzjqgxb.d.ts +297 -0
- package/dist/swedish-bank-account-holder-name-BFJ8h1aO.d.cts +45 -0
- package/dist/swedish-bank-account-holder-name-CAAru07F.d.ts +45 -0
- package/dist/swedish-municipality-DlUS7g7h.d.cts +87 -0
- package/dist/swedish-municipality-nDRHYRAd.d.ts +87 -0
- package/dist/swedish-organization-name-D7NvERxA.d.cts +33 -0
- package/dist/swedish-organization-name-rR0Q836C.d.ts +33 -0
- package/dist/swedish-organization-number-Bcj7V_lh.d.cts +130 -0
- package/dist/swedish-organization-number-DM8dpXwR.d.ts +130 -0
- package/dist/swedish-organization-type-CZOdETwG.d.cts +29 -0
- package/dist/swedish-organization-type-CZOdETwG.d.ts +29 -0
- package/dist/swedish-personal-identity-number-BiIg4io3.d.ts +149 -0
- package/dist/swedish-personal-identity-number-Cp9Coz55.d.cts +149 -0
- package/dist/swedish-property-designation-BM-gdd9x.d.ts +46 -0
- package/dist/swedish-property-designation-BaHXufqV.d.cts +46 -0
- package/dist/swedish-sni-code-Ccsswpni.d.ts +53 -0
- package/dist/swedish-sni-code-CuJFyM6l.d.cts +53 -0
- package/dist/swedish-swish-number-CL6Gx_h3.d.cts +397 -0
- package/dist/swedish-swish-number-DDG3mNDg.d.ts +397 -0
- package/dist/text-candidate-qg2bD9PY.d.cts +110 -0
- package/dist/text-candidate-qg2bD9PY.d.ts +110 -0
- package/dist/text-scanning/index.cjs +10414 -0
- package/dist/text-scanning/index.cjs.map +1 -0
- package/dist/text-scanning/index.d.cts +153 -0
- package/dist/text-scanning/index.d.ts +153 -0
- package/dist/text-scanning/index.js +10406 -0
- package/dist/text-scanning/index.js.map +1 -0
- package/dist/validation/index.cjs +83 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +63 -0
- package/dist/validation/index.d.ts +63 -0
- package/dist/validation/index.js +79 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/web/index.cjs +3994 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +203 -0
- package/dist/web/index.d.ts +203 -0
- package/dist/web/index.js +3987 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +211 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { P as PrimitiveTypeInfo, T as TextCandidate } from '../text-candidate-qg2bD9PY.cjs';
|
|
2
|
+
import { a as Country } from '../country-BhD51LDL.cjs';
|
|
3
|
+
import { ValidationResult } from '../validation/index.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Identifies the email service behind a domain when it belongs to a well-known
|
|
7
|
+
* public (consumer/free) email provider.
|
|
8
|
+
*/
|
|
9
|
+
declare const PublicEmailProvider: {
|
|
10
|
+
readonly Unknown: "Unknown";
|
|
11
|
+
readonly Gmail: "Gmail";
|
|
12
|
+
readonly Outlook: "Outlook";
|
|
13
|
+
readonly Yahoo: "Yahoo";
|
|
14
|
+
readonly ICloud: "ICloud";
|
|
15
|
+
readonly ProtonMail: "ProtonMail";
|
|
16
|
+
readonly Aol: "Aol";
|
|
17
|
+
readonly Gmx: "Gmx";
|
|
18
|
+
readonly MailCom: "MailCom";
|
|
19
|
+
readonly Yandex: "Yandex";
|
|
20
|
+
readonly Zoho: "Zoho";
|
|
21
|
+
readonly Tuta: "Tuta";
|
|
22
|
+
readonly Hey: "Hey";
|
|
23
|
+
readonly DuckDuckGoEmail: "DuckDuckGoEmail";
|
|
24
|
+
readonly SimpleLogin: "SimpleLogin";
|
|
25
|
+
readonly WebDe: "WebDe";
|
|
26
|
+
readonly MailRu: "MailRu";
|
|
27
|
+
readonly WirtualnaPolska: "WirtualnaPolska";
|
|
28
|
+
readonly Onet: "Onet";
|
|
29
|
+
readonly Interia: "Interia";
|
|
30
|
+
readonly Tlen: "Tlen";
|
|
31
|
+
readonly Seznam: "Seznam";
|
|
32
|
+
readonly Libero: "Libero";
|
|
33
|
+
readonly FreemailHu: "FreemailHu";
|
|
34
|
+
readonly Abv: "Abv";
|
|
35
|
+
readonly InboxLv: "InboxLv";
|
|
36
|
+
readonly UkrNet: "UkrNet";
|
|
37
|
+
readonly Naver: "Naver";
|
|
38
|
+
readonly Telia: "Telia";
|
|
39
|
+
readonly Tele2: "Tele2";
|
|
40
|
+
readonly Comhem: "Comhem";
|
|
41
|
+
readonly Bredbandsbolaget: "Bredbandsbolaget";
|
|
42
|
+
readonly Bredband2: "Bredband2";
|
|
43
|
+
readonly Ownit: "Ownit";
|
|
44
|
+
readonly Spray: "Spray";
|
|
45
|
+
readonly Passagen: "Passagen";
|
|
46
|
+
readonly Bahnhof: "Bahnhof";
|
|
47
|
+
readonly Glocalnet: "Glocalnet";
|
|
48
|
+
readonly OnlineNo: "OnlineNo";
|
|
49
|
+
readonly Kolumbus: "Kolumbus";
|
|
50
|
+
readonly Aland: "Aland";
|
|
51
|
+
};
|
|
52
|
+
type PublicEmailProvider = (typeof PublicEmailProvider)[keyof typeof PublicEmailProvider];
|
|
53
|
+
/**
|
|
54
|
+
* An email address (e-postadress). Normalization trims whitespace and lowercases the entire
|
|
55
|
+
* address — including the local part — as a pragmatic interoperability and deduplication choice.
|
|
56
|
+
*/
|
|
57
|
+
declare class EmailAddress {
|
|
58
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
59
|
+
readonly value: string;
|
|
60
|
+
readonly localPart: string;
|
|
61
|
+
readonly domain: string;
|
|
62
|
+
readonly domainAscii: string;
|
|
63
|
+
readonly topLevelDomain: string;
|
|
64
|
+
readonly country: Country | null;
|
|
65
|
+
readonly provider: PublicEmailProvider | null;
|
|
66
|
+
readonly originalDomain: string | null;
|
|
67
|
+
get isPublicEmailProvider(): boolean;
|
|
68
|
+
get isInternationalizedDomain(): boolean;
|
|
69
|
+
get wasCorrected(): boolean;
|
|
70
|
+
private constructor();
|
|
71
|
+
/**
|
|
72
|
+
* Attempts to parse and normalize an email address.
|
|
73
|
+
*
|
|
74
|
+
* When `tryCorrectTypos` is `true`, common domain misspellings such as
|
|
75
|
+
* `gmail.con`, `gnail.com`, or `hotmil.com` are corrected automatically.
|
|
76
|
+
* The original domain is preserved in `originalDomain`. Typo correction is
|
|
77
|
+
* opt-in and should only be used when silent correction is acceptable.
|
|
78
|
+
*/
|
|
79
|
+
static tryParse(input: string | null | undefined, options?: {
|
|
80
|
+
tryCorrectTypos?: boolean;
|
|
81
|
+
}): EmailAddress | null;
|
|
82
|
+
static parse(input: string, options?: {
|
|
83
|
+
tryCorrectTypos?: boolean;
|
|
84
|
+
}): EmailAddress;
|
|
85
|
+
static isValid(input: string | null | undefined): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Returns a `ValidationResult` describing why the input is invalid,
|
|
88
|
+
* or a valid result when the input is well-formed.
|
|
89
|
+
*/
|
|
90
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the normalized email in lowercase, e.g. `user@example.com`.
|
|
93
|
+
* Returns `null` for invalid or empty input.
|
|
94
|
+
*/
|
|
95
|
+
static format(input: string | null | undefined, options?: {
|
|
96
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
97
|
+
tryCorrectTypos?: boolean;
|
|
98
|
+
}): string | null;
|
|
99
|
+
/** Returns the normalized email, e.g. `user@example.com`, or `null` if invalid. */
|
|
100
|
+
static normalize(input: string | null | undefined, options?: {
|
|
101
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
102
|
+
tryCorrectTypos?: boolean;
|
|
103
|
+
}): string | null;
|
|
104
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
105
|
+
/** Returns the normalized email address, e.g. `user@example.com`. */
|
|
106
|
+
toNormalizedString(): string;
|
|
107
|
+
/** Returns the normalized email address, e.g. `user@example.com`. */
|
|
108
|
+
toString(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the email with the domain in ASCII (Punycode) form, e.g.
|
|
111
|
+
* `user@xn--rneholm-b1a.com`. Same as `toString()` for ASCII domains.
|
|
112
|
+
*/
|
|
113
|
+
toAsciiString(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Scans unstructured text for potential email addresses. Heuristic; may include false positives.
|
|
116
|
+
*/
|
|
117
|
+
static findCandidatesInText(text: string): readonly TextCandidate<EmailAddress>[];
|
|
118
|
+
equals(other: EmailAddress | null | undefined): boolean;
|
|
119
|
+
compareTo(other: EmailAddress | null | undefined): number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Returns a masked email showing the first character of the local part and the full domain,
|
|
123
|
+
* e.g. `peter@example.com` → `p***@example.com`.
|
|
124
|
+
* Set `maskDomain` to `true` to also mask the domain label: `p***@e***.com`.
|
|
125
|
+
*/
|
|
126
|
+
declare function maskEmailAddress(email: EmailAddress, options?: {
|
|
127
|
+
maskDomain?: boolean;
|
|
128
|
+
}): string;
|
|
129
|
+
/** Returns a `mailto:` URI, e.g. `mailto:info@example.com`. */
|
|
130
|
+
declare function toMailtoUri(email: EmailAddress): string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A URL or URI (`webbadress`). Accepts any valid URI scheme — `http`, `https`,
|
|
134
|
+
* `mailto`, `tel`, `ssh`, custom schemes, etc. Bare domains like `example.com`
|
|
135
|
+
* are auto-prefixed with `https://`. Reserved example/test domains per
|
|
136
|
+
* RFC 2606 / RFC 6761 are flagged via `isExampleDomain`.
|
|
137
|
+
*/
|
|
138
|
+
declare class Url {
|
|
139
|
+
#private;
|
|
140
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
141
|
+
/** The normalized URL string, e.g. `https://www.example.com/path`. */
|
|
142
|
+
readonly value: string;
|
|
143
|
+
/** The URI scheme without `://`, e.g. `https`. */
|
|
144
|
+
readonly scheme: string;
|
|
145
|
+
/** The full hostname, e.g. `www.example.com`. Empty for non-hierarchical URIs. */
|
|
146
|
+
readonly host: string;
|
|
147
|
+
/** Explicit port, or `null` when the default port for the scheme is used. */
|
|
148
|
+
readonly port: number | null;
|
|
149
|
+
/** The path component, e.g. `/path/to/page`. Root paths are `/`. */
|
|
150
|
+
readonly path: string;
|
|
151
|
+
/** Query string without `?`, or `null` when absent. */
|
|
152
|
+
readonly query: string | null;
|
|
153
|
+
/** Fragment without `#`, or `null` when absent. */
|
|
154
|
+
readonly fragment: string | null;
|
|
155
|
+
/** Top-level domain without the dot, e.g. `com`, `se`. */
|
|
156
|
+
readonly topLevelDomain: string;
|
|
157
|
+
/** Country associated with a country-code TLD, or `null` for generic TLDs. */
|
|
158
|
+
readonly country: Country | null;
|
|
159
|
+
/** True when the scheme is `https`. */
|
|
160
|
+
readonly isSecure: boolean;
|
|
161
|
+
/** True when the host is a reserved example/test domain (RFC 2606 / RFC 6761). */
|
|
162
|
+
readonly isExampleDomain: boolean;
|
|
163
|
+
/** True when the host is an IP address. */
|
|
164
|
+
readonly isIpAddress: boolean;
|
|
165
|
+
private constructor();
|
|
166
|
+
static tryParse(input: string | null | undefined): Url | null;
|
|
167
|
+
static parse(input: string): Url;
|
|
168
|
+
/**
|
|
169
|
+
* The standard `URL` view of this value, for interop with `fetch` and other
|
|
170
|
+
* web APIs. The .NET port exposes the same thing as `ToUri()`.
|
|
171
|
+
*/
|
|
172
|
+
toUrl(): URL;
|
|
173
|
+
/** Creates a {@link Url} from a standard `URL`. Throws when it cannot be represented. */
|
|
174
|
+
static fromUrl(url: URL): Url;
|
|
175
|
+
static isValid(input: string | null | undefined): boolean;
|
|
176
|
+
static format(input: string | null | undefined, options?: {
|
|
177
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
178
|
+
}): string | null;
|
|
179
|
+
static normalize(input: string | null | undefined, options?: {
|
|
180
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
181
|
+
}): string | null;
|
|
182
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
183
|
+
/** Returns the normalized URL, e.g. `https://www.example.com/path`. */
|
|
184
|
+
toNormalizedString(): string;
|
|
185
|
+
/** Returns the normalized URL, e.g. `https://www.example.com/path`. */
|
|
186
|
+
toString(): string;
|
|
187
|
+
/**
|
|
188
|
+
* Scans unstructured text for potential URLs. Heuristic — may include false positives.
|
|
189
|
+
*/
|
|
190
|
+
static findCandidatesInText(text: string): readonly TextCandidate<Url>[];
|
|
191
|
+
equals(other: Url | null | undefined): boolean;
|
|
192
|
+
compareTo(other: Url | null | undefined): number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns a masked URL showing the scheme and host but obscuring the path,
|
|
196
|
+
* query, and fragment, e.g.
|
|
197
|
+
* `https://www.example.com/my/secret/page?key=val` →
|
|
198
|
+
* `https://www.example.com/***?***`.
|
|
199
|
+
* For non-hierarchical URIs (mailto:, tel:), returns `scheme:***`.
|
|
200
|
+
*/
|
|
201
|
+
declare function maskUrl(url: Url): string;
|
|
202
|
+
|
|
203
|
+
export { EmailAddress, PublicEmailProvider, Url, maskEmailAddress, maskUrl, toMailtoUri };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { P as PrimitiveTypeInfo, T as TextCandidate } from '../text-candidate-qg2bD9PY.js';
|
|
2
|
+
import { a as Country } from '../country-p0n0EVQ9.js';
|
|
3
|
+
import { ValidationResult } from '../validation/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Identifies the email service behind a domain when it belongs to a well-known
|
|
7
|
+
* public (consumer/free) email provider.
|
|
8
|
+
*/
|
|
9
|
+
declare const PublicEmailProvider: {
|
|
10
|
+
readonly Unknown: "Unknown";
|
|
11
|
+
readonly Gmail: "Gmail";
|
|
12
|
+
readonly Outlook: "Outlook";
|
|
13
|
+
readonly Yahoo: "Yahoo";
|
|
14
|
+
readonly ICloud: "ICloud";
|
|
15
|
+
readonly ProtonMail: "ProtonMail";
|
|
16
|
+
readonly Aol: "Aol";
|
|
17
|
+
readonly Gmx: "Gmx";
|
|
18
|
+
readonly MailCom: "MailCom";
|
|
19
|
+
readonly Yandex: "Yandex";
|
|
20
|
+
readonly Zoho: "Zoho";
|
|
21
|
+
readonly Tuta: "Tuta";
|
|
22
|
+
readonly Hey: "Hey";
|
|
23
|
+
readonly DuckDuckGoEmail: "DuckDuckGoEmail";
|
|
24
|
+
readonly SimpleLogin: "SimpleLogin";
|
|
25
|
+
readonly WebDe: "WebDe";
|
|
26
|
+
readonly MailRu: "MailRu";
|
|
27
|
+
readonly WirtualnaPolska: "WirtualnaPolska";
|
|
28
|
+
readonly Onet: "Onet";
|
|
29
|
+
readonly Interia: "Interia";
|
|
30
|
+
readonly Tlen: "Tlen";
|
|
31
|
+
readonly Seznam: "Seznam";
|
|
32
|
+
readonly Libero: "Libero";
|
|
33
|
+
readonly FreemailHu: "FreemailHu";
|
|
34
|
+
readonly Abv: "Abv";
|
|
35
|
+
readonly InboxLv: "InboxLv";
|
|
36
|
+
readonly UkrNet: "UkrNet";
|
|
37
|
+
readonly Naver: "Naver";
|
|
38
|
+
readonly Telia: "Telia";
|
|
39
|
+
readonly Tele2: "Tele2";
|
|
40
|
+
readonly Comhem: "Comhem";
|
|
41
|
+
readonly Bredbandsbolaget: "Bredbandsbolaget";
|
|
42
|
+
readonly Bredband2: "Bredband2";
|
|
43
|
+
readonly Ownit: "Ownit";
|
|
44
|
+
readonly Spray: "Spray";
|
|
45
|
+
readonly Passagen: "Passagen";
|
|
46
|
+
readonly Bahnhof: "Bahnhof";
|
|
47
|
+
readonly Glocalnet: "Glocalnet";
|
|
48
|
+
readonly OnlineNo: "OnlineNo";
|
|
49
|
+
readonly Kolumbus: "Kolumbus";
|
|
50
|
+
readonly Aland: "Aland";
|
|
51
|
+
};
|
|
52
|
+
type PublicEmailProvider = (typeof PublicEmailProvider)[keyof typeof PublicEmailProvider];
|
|
53
|
+
/**
|
|
54
|
+
* An email address (e-postadress). Normalization trims whitespace and lowercases the entire
|
|
55
|
+
* address — including the local part — as a pragmatic interoperability and deduplication choice.
|
|
56
|
+
*/
|
|
57
|
+
declare class EmailAddress {
|
|
58
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
59
|
+
readonly value: string;
|
|
60
|
+
readonly localPart: string;
|
|
61
|
+
readonly domain: string;
|
|
62
|
+
readonly domainAscii: string;
|
|
63
|
+
readonly topLevelDomain: string;
|
|
64
|
+
readonly country: Country | null;
|
|
65
|
+
readonly provider: PublicEmailProvider | null;
|
|
66
|
+
readonly originalDomain: string | null;
|
|
67
|
+
get isPublicEmailProvider(): boolean;
|
|
68
|
+
get isInternationalizedDomain(): boolean;
|
|
69
|
+
get wasCorrected(): boolean;
|
|
70
|
+
private constructor();
|
|
71
|
+
/**
|
|
72
|
+
* Attempts to parse and normalize an email address.
|
|
73
|
+
*
|
|
74
|
+
* When `tryCorrectTypos` is `true`, common domain misspellings such as
|
|
75
|
+
* `gmail.con`, `gnail.com`, or `hotmil.com` are corrected automatically.
|
|
76
|
+
* The original domain is preserved in `originalDomain`. Typo correction is
|
|
77
|
+
* opt-in and should only be used when silent correction is acceptable.
|
|
78
|
+
*/
|
|
79
|
+
static tryParse(input: string | null | undefined, options?: {
|
|
80
|
+
tryCorrectTypos?: boolean;
|
|
81
|
+
}): EmailAddress | null;
|
|
82
|
+
static parse(input: string, options?: {
|
|
83
|
+
tryCorrectTypos?: boolean;
|
|
84
|
+
}): EmailAddress;
|
|
85
|
+
static isValid(input: string | null | undefined): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Returns a `ValidationResult` describing why the input is invalid,
|
|
88
|
+
* or a valid result when the input is well-formed.
|
|
89
|
+
*/
|
|
90
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the normalized email in lowercase, e.g. `user@example.com`.
|
|
93
|
+
* Returns `null` for invalid or empty input.
|
|
94
|
+
*/
|
|
95
|
+
static format(input: string | null | undefined, options?: {
|
|
96
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
97
|
+
tryCorrectTypos?: boolean;
|
|
98
|
+
}): string | null;
|
|
99
|
+
/** Returns the normalized email, e.g. `user@example.com`, or `null` if invalid. */
|
|
100
|
+
static normalize(input: string | null | undefined, options?: {
|
|
101
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
102
|
+
tryCorrectTypos?: boolean;
|
|
103
|
+
}): string | null;
|
|
104
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
105
|
+
/** Returns the normalized email address, e.g. `user@example.com`. */
|
|
106
|
+
toNormalizedString(): string;
|
|
107
|
+
/** Returns the normalized email address, e.g. `user@example.com`. */
|
|
108
|
+
toString(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the email with the domain in ASCII (Punycode) form, e.g.
|
|
111
|
+
* `user@xn--rneholm-b1a.com`. Same as `toString()` for ASCII domains.
|
|
112
|
+
*/
|
|
113
|
+
toAsciiString(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Scans unstructured text for potential email addresses. Heuristic; may include false positives.
|
|
116
|
+
*/
|
|
117
|
+
static findCandidatesInText(text: string): readonly TextCandidate<EmailAddress>[];
|
|
118
|
+
equals(other: EmailAddress | null | undefined): boolean;
|
|
119
|
+
compareTo(other: EmailAddress | null | undefined): number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Returns a masked email showing the first character of the local part and the full domain,
|
|
123
|
+
* e.g. `peter@example.com` → `p***@example.com`.
|
|
124
|
+
* Set `maskDomain` to `true` to also mask the domain label: `p***@e***.com`.
|
|
125
|
+
*/
|
|
126
|
+
declare function maskEmailAddress(email: EmailAddress, options?: {
|
|
127
|
+
maskDomain?: boolean;
|
|
128
|
+
}): string;
|
|
129
|
+
/** Returns a `mailto:` URI, e.g. `mailto:info@example.com`. */
|
|
130
|
+
declare function toMailtoUri(email: EmailAddress): string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A URL or URI (`webbadress`). Accepts any valid URI scheme — `http`, `https`,
|
|
134
|
+
* `mailto`, `tel`, `ssh`, custom schemes, etc. Bare domains like `example.com`
|
|
135
|
+
* are auto-prefixed with `https://`. Reserved example/test domains per
|
|
136
|
+
* RFC 2606 / RFC 6761 are flagged via `isExampleDomain`.
|
|
137
|
+
*/
|
|
138
|
+
declare class Url {
|
|
139
|
+
#private;
|
|
140
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
141
|
+
/** The normalized URL string, e.g. `https://www.example.com/path`. */
|
|
142
|
+
readonly value: string;
|
|
143
|
+
/** The URI scheme without `://`, e.g. `https`. */
|
|
144
|
+
readonly scheme: string;
|
|
145
|
+
/** The full hostname, e.g. `www.example.com`. Empty for non-hierarchical URIs. */
|
|
146
|
+
readonly host: string;
|
|
147
|
+
/** Explicit port, or `null` when the default port for the scheme is used. */
|
|
148
|
+
readonly port: number | null;
|
|
149
|
+
/** The path component, e.g. `/path/to/page`. Root paths are `/`. */
|
|
150
|
+
readonly path: string;
|
|
151
|
+
/** Query string without `?`, or `null` when absent. */
|
|
152
|
+
readonly query: string | null;
|
|
153
|
+
/** Fragment without `#`, or `null` when absent. */
|
|
154
|
+
readonly fragment: string | null;
|
|
155
|
+
/** Top-level domain without the dot, e.g. `com`, `se`. */
|
|
156
|
+
readonly topLevelDomain: string;
|
|
157
|
+
/** Country associated with a country-code TLD, or `null` for generic TLDs. */
|
|
158
|
+
readonly country: Country | null;
|
|
159
|
+
/** True when the scheme is `https`. */
|
|
160
|
+
readonly isSecure: boolean;
|
|
161
|
+
/** True when the host is a reserved example/test domain (RFC 2606 / RFC 6761). */
|
|
162
|
+
readonly isExampleDomain: boolean;
|
|
163
|
+
/** True when the host is an IP address. */
|
|
164
|
+
readonly isIpAddress: boolean;
|
|
165
|
+
private constructor();
|
|
166
|
+
static tryParse(input: string | null | undefined): Url | null;
|
|
167
|
+
static parse(input: string): Url;
|
|
168
|
+
/**
|
|
169
|
+
* The standard `URL` view of this value, for interop with `fetch` and other
|
|
170
|
+
* web APIs. The .NET port exposes the same thing as `ToUri()`.
|
|
171
|
+
*/
|
|
172
|
+
toUrl(): URL;
|
|
173
|
+
/** Creates a {@link Url} from a standard `URL`. Throws when it cannot be represented. */
|
|
174
|
+
static fromUrl(url: URL): Url;
|
|
175
|
+
static isValid(input: string | null | undefined): boolean;
|
|
176
|
+
static format(input: string | null | undefined, options?: {
|
|
177
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
178
|
+
}): string | null;
|
|
179
|
+
static normalize(input: string | null | undefined, options?: {
|
|
180
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
181
|
+
}): string | null;
|
|
182
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
183
|
+
/** Returns the normalized URL, e.g. `https://www.example.com/path`. */
|
|
184
|
+
toNormalizedString(): string;
|
|
185
|
+
/** Returns the normalized URL, e.g. `https://www.example.com/path`. */
|
|
186
|
+
toString(): string;
|
|
187
|
+
/**
|
|
188
|
+
* Scans unstructured text for potential URLs. Heuristic — may include false positives.
|
|
189
|
+
*/
|
|
190
|
+
static findCandidatesInText(text: string): readonly TextCandidate<Url>[];
|
|
191
|
+
equals(other: Url | null | undefined): boolean;
|
|
192
|
+
compareTo(other: Url | null | undefined): number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns a masked URL showing the scheme and host but obscuring the path,
|
|
196
|
+
* query, and fragment, e.g.
|
|
197
|
+
* `https://www.example.com/my/secret/page?key=val` →
|
|
198
|
+
* `https://www.example.com/***?***`.
|
|
199
|
+
* For non-hierarchical URIs (mailto:, tel:), returns `scheme:***`.
|
|
200
|
+
*/
|
|
201
|
+
declare function maskUrl(url: Url): string;
|
|
202
|
+
|
|
203
|
+
export { EmailAddress, PublicEmailProvider, Url, maskEmailAddress, maskUrl, toMailtoUri };
|