@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,397 @@
|
|
|
1
|
+
import { P as PrimitiveTypeInfo, T as TextCandidate } from './text-candidate-qg2bD9PY.js';
|
|
2
|
+
import { ValidationResult } from './validation/index.js';
|
|
3
|
+
import { a as PhoneNumber } from './phone-number-C24--ggy.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The International Bank Account Number (ISO 13616), e.g. `SE4550000000058398257466`.
|
|
7
|
+
* Validated using MOD-97 check digits.
|
|
8
|
+
*/
|
|
9
|
+
declare class Iban {
|
|
10
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
11
|
+
static readonly displayName = "IBAN";
|
|
12
|
+
static readonly displayNameShort = "IBAN";
|
|
13
|
+
/** Normalized IBAN without spaces, e.g. `SE4550000000058398257466`. */
|
|
14
|
+
readonly value: string;
|
|
15
|
+
/** ISO 3166-1 alpha-2 country code, e.g. `SE`. */
|
|
16
|
+
readonly countryCode: string;
|
|
17
|
+
/** Display form grouped in blocks of four characters, e.g. `SE45 5000 0000 0583 9825 7466`. */
|
|
18
|
+
readonly formatted: string;
|
|
19
|
+
private constructor();
|
|
20
|
+
static tryParse(input: string | null | undefined): Iban | null;
|
|
21
|
+
static tryParse(input: string | null | undefined, countryCode: string): Iban | null;
|
|
22
|
+
static parse(input: string): Iban;
|
|
23
|
+
static isValid(input: string | null | undefined): boolean;
|
|
24
|
+
static format(input: string | null | undefined, options?: {
|
|
25
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
26
|
+
}): string | null;
|
|
27
|
+
static normalize(input: string | null | undefined, options?: {
|
|
28
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
29
|
+
}): string | null;
|
|
30
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
31
|
+
toNormalizedString(): string;
|
|
32
|
+
toDisplayString(): string;
|
|
33
|
+
toShortDisplayString(): string;
|
|
34
|
+
toString(): string;
|
|
35
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
36
|
+
static findCandidatesInText(text: string): readonly TextCandidate<Iban>[];
|
|
37
|
+
equals(other: Iban | null | undefined): boolean;
|
|
38
|
+
compareTo(other: Iban | null | undefined): number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns a masked IBAN preserving the country code and check digits,
|
|
42
|
+
* e.g. `SE45 **** **** **** **** ****`.
|
|
43
|
+
*/
|
|
44
|
+
declare function maskIban(iban: Iban): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A BIC (Business Identifier Code / SWIFT code) per ISO 9362.
|
|
48
|
+
* 8 or 11 uppercase characters, e.g. `NDEASESS` or `NDEASESSXXX`.
|
|
49
|
+
*/
|
|
50
|
+
declare class Bic {
|
|
51
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
52
|
+
/** Normalized 8 or 11 uppercase characters, e.g. `NDEASESS`. */
|
|
53
|
+
readonly code: string;
|
|
54
|
+
readonly institutionCode: string;
|
|
55
|
+
readonly countryCode: string;
|
|
56
|
+
readonly locationCode: string;
|
|
57
|
+
readonly branchCode: string | null;
|
|
58
|
+
/** True when the BIC has no branch code (or the branch code is the head office). */
|
|
59
|
+
get isPrimaryOffice(): boolean;
|
|
60
|
+
private constructor();
|
|
61
|
+
static tryParse(input: string | null | undefined): Bic | null;
|
|
62
|
+
static parse(input: string): Bic;
|
|
63
|
+
static isValid(input: string | null | undefined): boolean;
|
|
64
|
+
static format(input: string | null | undefined, options?: {
|
|
65
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
66
|
+
}): string | null;
|
|
67
|
+
static normalize(input: string | null | undefined, options?: {
|
|
68
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
69
|
+
}): string | null;
|
|
70
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
71
|
+
toNormalizedString(): string;
|
|
72
|
+
toString(): string;
|
|
73
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
74
|
+
static findCandidatesInText(text: string): readonly TextCandidate<Bic>[];
|
|
75
|
+
equals(other: Bic | null | undefined): boolean;
|
|
76
|
+
compareTo(other: Bic | null | undefined): number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns a masked BIC showing the country code, e.g. `NDEASESS` → `****SE**`.
|
|
80
|
+
*/
|
|
81
|
+
declare function maskBic(bic: Bic): string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Known Swedish banks, identified by clearing number ranges.
|
|
85
|
+
*
|
|
86
|
+
* Equivalent of the .NET `SwedishBank` enum.
|
|
87
|
+
*/
|
|
88
|
+
declare const SwedishBank: {
|
|
89
|
+
readonly Unknown: "Unknown";
|
|
90
|
+
readonly SverigesRiksbank: "SverigesRiksbank";
|
|
91
|
+
readonly Nordea: "Nordea";
|
|
92
|
+
readonly NordeaPersonkonto: "NordeaPersonkonto";
|
|
93
|
+
readonly NordeaPlusgirot: "NordeaPlusgirot";
|
|
94
|
+
readonly DanskeBank: "DanskeBank";
|
|
95
|
+
readonly Handelsbanken: "Handelsbanken";
|
|
96
|
+
readonly SEB: "SEB";
|
|
97
|
+
readonly Swedbank: "Swedbank";
|
|
98
|
+
readonly Lansforsakringar: "Lansforsakringar";
|
|
99
|
+
readonly IcaBanken: "IcaBanken";
|
|
100
|
+
readonly Skandiabanken: "Skandiabanken";
|
|
101
|
+
readonly SBABBank: "SBABBank";
|
|
102
|
+
readonly AvanzaBank: "AvanzaBank";
|
|
103
|
+
readonly AionBank: "AionBank";
|
|
104
|
+
readonly BnpParibas: "BnpParibas";
|
|
105
|
+
readonly CitibankEurope: "CitibankEurope";
|
|
106
|
+
readonly HSBBank: "HSBBank";
|
|
107
|
+
readonly CalyonBank: "CalyonBank";
|
|
108
|
+
readonly RoyalBankOfScotland: "RoyalBankOfScotland";
|
|
109
|
+
readonly DNBSverige: "DNBSverige";
|
|
110
|
+
readonly Ekobanken: "Ekobanken";
|
|
111
|
+
readonly EnityBankGroup: "EnityBankGroup";
|
|
112
|
+
readonly EpBank: "EpBank";
|
|
113
|
+
readonly IkanoBank: "IkanoBank";
|
|
114
|
+
readonly JAKMedlemsbank: "JAKMedlemsbank";
|
|
115
|
+
readonly KlarnaBank: "KlarnaBank";
|
|
116
|
+
readonly LandshypotekBank: "LandshypotekBank";
|
|
117
|
+
readonly LunarBank: "LunarBank";
|
|
118
|
+
readonly LanOchSparBank: "LanOchSparBank";
|
|
119
|
+
readonly MarginalenBank: "MarginalenBank";
|
|
120
|
+
readonly MultitudeBank: "MultitudeBank";
|
|
121
|
+
readonly NobaBankGroup: "NobaBankGroup";
|
|
122
|
+
readonly NordnetBank: "NordnetBank";
|
|
123
|
+
readonly NorthmillBank: "NorthmillBank";
|
|
124
|
+
readonly ResursBank: "ResursBank";
|
|
125
|
+
readonly Santander: "Santander";
|
|
126
|
+
readonly SparbankenSyd: "SparbankenSyd";
|
|
127
|
+
readonly SveaBank: "SveaBank";
|
|
128
|
+
readonly Alandsbanken: "Alandsbanken";
|
|
129
|
+
readonly VolvofinansBank: "VolvofinansBank";
|
|
130
|
+
readonly StadshypotekBank: "StadshypotekBank";
|
|
131
|
+
readonly GjensidigeNorSparebank: "GjensidigeNorSparebank";
|
|
132
|
+
readonly ParetoOhman: "ParetoOhman";
|
|
133
|
+
readonly Forex: "Forex";
|
|
134
|
+
readonly ParexBank: "ParexBank";
|
|
135
|
+
readonly BriteAb: "BriteAb";
|
|
136
|
+
readonly BankingCircle: "BankingCircle";
|
|
137
|
+
readonly BankOfChinaLuxembourg: "BankOfChinaLuxembourg";
|
|
138
|
+
readonly MedMeraBank: "MedMeraBank";
|
|
139
|
+
readonly Folkia: "Folkia";
|
|
140
|
+
readonly NetfondsBank: "NetfondsBank";
|
|
141
|
+
readonly NasdaqOmx: "NasdaqOmx";
|
|
142
|
+
readonly Riksgalden: "Riksgalden";
|
|
143
|
+
readonly Privatgirot: "Privatgirot";
|
|
144
|
+
readonly Intergiro: "Intergiro";
|
|
145
|
+
readonly Nykredit: "Nykredit";
|
|
146
|
+
readonly TellerBranchNorway: "TellerBranchNorway";
|
|
147
|
+
readonly BankernasAutomatbolag: "BankernasAutomatbolag";
|
|
148
|
+
readonly TellerBranchSweden: "TellerBranchSweden";
|
|
149
|
+
readonly KortacceptNordic: "KortacceptNordic";
|
|
150
|
+
readonly Kommuninvest: "Kommuninvest";
|
|
151
|
+
readonly VpSecurities: "VpSecurities";
|
|
152
|
+
};
|
|
153
|
+
type SwedishBank = (typeof SwedishBank)[keyof typeof SwedishBank];
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A Swedish clearing number (`clearingnummer`), 4 digits (or 5 starting with `8` for Swedbank).
|
|
157
|
+
*/
|
|
158
|
+
declare class SwedishBankClearingNumber {
|
|
159
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
160
|
+
readonly digits: string;
|
|
161
|
+
readonly bank: SwedishBank;
|
|
162
|
+
readonly bankName: string;
|
|
163
|
+
private constructor();
|
|
164
|
+
static tryParse(input: string | null | undefined): SwedishBankClearingNumber | null;
|
|
165
|
+
static parse(input: string): SwedishBankClearingNumber;
|
|
166
|
+
static isValid(input: string | null | undefined): boolean;
|
|
167
|
+
static format(input: string | null | undefined, options?: {
|
|
168
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
169
|
+
}): string | null;
|
|
170
|
+
static normalize(input: string | null | undefined, options?: {
|
|
171
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
172
|
+
}): string | null;
|
|
173
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
174
|
+
toNormalizedString(): string;
|
|
175
|
+
toString(): string;
|
|
176
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
177
|
+
equals(other: SwedishBankClearingNumber | null | undefined): boolean;
|
|
178
|
+
compareTo(other: SwedishBankClearingNumber | null | undefined): number;
|
|
179
|
+
}
|
|
180
|
+
/** Returns a masked clearing number showing the bank identifier (first digit), e.g. `5001` → `5***`. */
|
|
181
|
+
declare function maskSwedishBankClearingNumber(c: SwedishBankClearingNumber): string;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A Swedish bank account, identified by clearing number + account number with
|
|
185
|
+
* bank-specific length rules.
|
|
186
|
+
*/
|
|
187
|
+
declare class SwedishBankAccount {
|
|
188
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
189
|
+
static readonly displayName = "Bankkonto";
|
|
190
|
+
readonly clearing: SwedishBankClearingNumber;
|
|
191
|
+
readonly accountNumber: string;
|
|
192
|
+
readonly formatted: string;
|
|
193
|
+
get clearingNumber(): string;
|
|
194
|
+
get bankName(): string | null;
|
|
195
|
+
get bank(): SwedishBank | null;
|
|
196
|
+
private constructor();
|
|
197
|
+
static tryParse(input: string | null | undefined): SwedishBankAccount | null;
|
|
198
|
+
static parse(input: string): SwedishBankAccount;
|
|
199
|
+
static isValid(input: string | null | undefined): boolean;
|
|
200
|
+
static format(input: string | null | undefined, options?: {
|
|
201
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
202
|
+
}): string | null;
|
|
203
|
+
static normalize(input: string | null | undefined, options?: {
|
|
204
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
205
|
+
}): string | null;
|
|
206
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
207
|
+
toNormalizedString(): string;
|
|
208
|
+
toDisplayString(): string;
|
|
209
|
+
toString(): string;
|
|
210
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
211
|
+
static findCandidatesInText(text: string): readonly TextCandidate<SwedishBankAccount>[];
|
|
212
|
+
equals(other: SwedishBankAccount | null | undefined): boolean;
|
|
213
|
+
compareTo(other: SwedishBankAccount | null | undefined): number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Returns a masked bank account showing the clearing number, e.g. `5100-*******`.
|
|
217
|
+
* Pass `maskClearingNumber: true` to also mask the clearing number.
|
|
218
|
+
*/
|
|
219
|
+
declare function maskSwedishBankAccount(account: SwedishBankAccount, options?: {
|
|
220
|
+
maskClearingNumber?: boolean;
|
|
221
|
+
}): string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* A Swedish Bankgiro number (`bankgironummer`), e.g. `5805-6201`.
|
|
225
|
+
* 7 or 8 digits with Luhn check digit.
|
|
226
|
+
*/
|
|
227
|
+
declare class SwedishBankgiroNumber {
|
|
228
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
229
|
+
static readonly displayName = "Bankgiro";
|
|
230
|
+
static readonly displayNameShort = "BG";
|
|
231
|
+
/** Digit-only value, e.g. `58056201`. */
|
|
232
|
+
readonly digits: string;
|
|
233
|
+
/** Hyphenated display form, e.g. `5805-6201`. */
|
|
234
|
+
readonly formatted: string;
|
|
235
|
+
private constructor();
|
|
236
|
+
static tryParse(input: string | null | undefined): SwedishBankgiroNumber | null;
|
|
237
|
+
static parse(input: string): SwedishBankgiroNumber;
|
|
238
|
+
static isValid(input: string | null | undefined): boolean;
|
|
239
|
+
static format(input: string | null | undefined, options?: {
|
|
240
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
241
|
+
}): string | null;
|
|
242
|
+
static normalize(input: string | null | undefined, options?: {
|
|
243
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
244
|
+
}): string | null;
|
|
245
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
246
|
+
toNormalizedString(): string;
|
|
247
|
+
toDisplayString(): string;
|
|
248
|
+
toShortDisplayString(): string;
|
|
249
|
+
toString(): string;
|
|
250
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
251
|
+
static findCandidatesInText(text: string): readonly TextCandidate<SwedishBankgiroNumber>[];
|
|
252
|
+
equals(other: SwedishBankgiroNumber | null | undefined): boolean;
|
|
253
|
+
compareTo(other: SwedishBankgiroNumber | null | undefined): number;
|
|
254
|
+
}
|
|
255
|
+
/** Returns the Bankgirot search URL for this Bankgiro number. */
|
|
256
|
+
declare function getBankgirotUrl(bg: SwedishBankgiroNumber): string;
|
|
257
|
+
/**
|
|
258
|
+
* Returns a masked Bankgiro number, e.g. `****-6201` (default) or `5805-****` when
|
|
259
|
+
* `showLastDigits` is `false`.
|
|
260
|
+
*/
|
|
261
|
+
declare function maskSwedishBankgiroNumber(bg: SwedishBankgiroNumber, options?: {
|
|
262
|
+
showLastDigits?: boolean;
|
|
263
|
+
}): string;
|
|
264
|
+
|
|
265
|
+
/** OCR reference control type. */
|
|
266
|
+
declare const OcrReferenceControlType: {
|
|
267
|
+
readonly CheckDigitOnly: "CheckDigitOnly";
|
|
268
|
+
readonly VariableLengthDigit: "VariableLengthDigit";
|
|
269
|
+
readonly FixedLength: "FixedLength";
|
|
270
|
+
};
|
|
271
|
+
type OcrReferenceControlType = (typeof OcrReferenceControlType)[keyof typeof OcrReferenceControlType];
|
|
272
|
+
/** Options controlling OCR reference parsing. */
|
|
273
|
+
declare class OcrReferenceOptions {
|
|
274
|
+
static readonly Default: OcrReferenceOptions;
|
|
275
|
+
static readonly VariableLengthDigit: OcrReferenceOptions;
|
|
276
|
+
readonly controlType: OcrReferenceControlType;
|
|
277
|
+
readonly allowedLengths: readonly number[];
|
|
278
|
+
constructor(controlType?: OcrReferenceControlType, allowedLengths?: readonly number[]);
|
|
279
|
+
static fixedLength(...allowedLengths: number[]): OcrReferenceOptions;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* A Swedish OCR reference number (`OCR-nummer`), used in payment flows.
|
|
283
|
+
* 2–25 digits with Luhn check digit; optional length-digit and fixed-length variants.
|
|
284
|
+
*/
|
|
285
|
+
declare class SwedishOcrReferenceNumber {
|
|
286
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
287
|
+
static readonly displayName = "OCR";
|
|
288
|
+
static readonly displayNameShort = "OCR";
|
|
289
|
+
readonly value: string;
|
|
290
|
+
readonly formatted: string;
|
|
291
|
+
readonly lengthDigit: number | null;
|
|
292
|
+
get length(): number;
|
|
293
|
+
get checkDigit(): number;
|
|
294
|
+
private constructor();
|
|
295
|
+
static tryParse(input: string | null | undefined, options?: OcrReferenceOptions): SwedishOcrReferenceNumber | null;
|
|
296
|
+
static tryParseVariableLengthDigit(input: string | null | undefined): SwedishOcrReferenceNumber | null;
|
|
297
|
+
static tryParseFixedLength(input: string | null | undefined, fixedLengths: number | readonly number[]): SwedishOcrReferenceNumber | null;
|
|
298
|
+
static parse(input: string, options?: OcrReferenceOptions): SwedishOcrReferenceNumber;
|
|
299
|
+
static isValid(input: string | null | undefined, options?: OcrReferenceOptions): boolean;
|
|
300
|
+
static format(input: string | null | undefined, options?: {
|
|
301
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
302
|
+
}): string | null;
|
|
303
|
+
static normalize(input: string | null | undefined, options?: {
|
|
304
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
305
|
+
}): string | null;
|
|
306
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
307
|
+
toNormalizedString(): string;
|
|
308
|
+
toDisplayString(): string;
|
|
309
|
+
toShortDisplayString(): string;
|
|
310
|
+
toString(): string;
|
|
311
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
312
|
+
static findCandidatesInText(text: string): readonly TextCandidate<SwedishOcrReferenceNumber>[];
|
|
313
|
+
equals(other: SwedishOcrReferenceNumber | null | undefined): boolean;
|
|
314
|
+
compareTo(other: SwedishOcrReferenceNumber | null | undefined): number;
|
|
315
|
+
}
|
|
316
|
+
/** Returns a fully masked OCR reference, e.g. `12345678901` → `***********`. */
|
|
317
|
+
declare function maskSwedishOcrReferenceNumber(ocr: SwedishOcrReferenceNumber): string;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* A Swedish Plusgiro number (`plusgironummer`), e.g. `1234567-9`.
|
|
321
|
+
* 2–8 digits with Luhn check digit.
|
|
322
|
+
*/
|
|
323
|
+
declare class SwedishPostgiroNumber {
|
|
324
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
325
|
+
static readonly displayName = "Plusgiro";
|
|
326
|
+
static readonly displayNameShort = "PG";
|
|
327
|
+
/** Digit-only value, e.g. `41313008`. */
|
|
328
|
+
readonly digits: string;
|
|
329
|
+
/** Hyphenated display form, e.g. `4131300-8`. */
|
|
330
|
+
readonly formatted: string;
|
|
331
|
+
private constructor();
|
|
332
|
+
static tryParse(input: string | null | undefined): SwedishPostgiroNumber | null;
|
|
333
|
+
static parse(input: string): SwedishPostgiroNumber;
|
|
334
|
+
static isValid(input: string | null | undefined): boolean;
|
|
335
|
+
static format(input: string | null | undefined, options?: {
|
|
336
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
337
|
+
}): string | null;
|
|
338
|
+
static normalize(input: string | null | undefined, options?: {
|
|
339
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
340
|
+
}): string | null;
|
|
341
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
342
|
+
toNormalizedString(): string;
|
|
343
|
+
toDisplayString(): string;
|
|
344
|
+
toShortDisplayString(): string;
|
|
345
|
+
toString(): string;
|
|
346
|
+
static validate(input: string | null | undefined): ValidationResult;
|
|
347
|
+
static findCandidatesInText(text: string): readonly TextCandidate<SwedishPostgiroNumber>[];
|
|
348
|
+
equals(other: SwedishPostgiroNumber | null | undefined): boolean;
|
|
349
|
+
compareTo(other: SwedishPostgiroNumber | null | undefined): number;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Returns a masked Plusgiro number, e.g. `******-9` (default, showing the control digit) or
|
|
353
|
+
* `123456-*` when `showControlDigit` is `false`.
|
|
354
|
+
*/
|
|
355
|
+
declare function maskSwedishPostgiroNumber(pg: SwedishPostgiroNumber, options?: {
|
|
356
|
+
showControlDigit?: boolean;
|
|
357
|
+
}): string;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* A Swedish Swish payment number (`Swish-nummer`).
|
|
361
|
+
* Accepts:
|
|
362
|
+
* - Swish 123 numbers (10 digits starting with `123`)
|
|
363
|
+
* - 90-numbers (7 digits starting with `90X`, expanded to `123` + 7 digits)
|
|
364
|
+
* - Swedish mobile phone numbers
|
|
365
|
+
*/
|
|
366
|
+
declare class SwedishSwishNumber {
|
|
367
|
+
static readonly typeInfo: PrimitiveTypeInfo;
|
|
368
|
+
readonly value: string;
|
|
369
|
+
readonly formatted: string;
|
|
370
|
+
readonly isSwish123: boolean;
|
|
371
|
+
readonly isMobileNumber: boolean;
|
|
372
|
+
readonly is90Number: boolean;
|
|
373
|
+
readonly phoneNumber: PhoneNumber | null;
|
|
374
|
+
private constructor();
|
|
375
|
+
static tryParse(input: string | null | undefined): SwedishSwishNumber | null;
|
|
376
|
+
static parse(input: string): SwedishSwishNumber;
|
|
377
|
+
static isValid(input: string | null | undefined): boolean;
|
|
378
|
+
static format(input: string | null | undefined, options?: {
|
|
379
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
380
|
+
}): string | null;
|
|
381
|
+
static normalize(input: string | null | undefined, options?: {
|
|
382
|
+
fallbackToTrimmedInputWhenInvalid?: boolean;
|
|
383
|
+
}): string | null;
|
|
384
|
+
static isNormalized(input: string | null | undefined): boolean;
|
|
385
|
+
toNormalizedString(): string;
|
|
386
|
+
toString(): string;
|
|
387
|
+
static findCandidatesInText(text: string): readonly TextCandidate<SwedishSwishNumber>[];
|
|
388
|
+
equals(other: SwedishSwishNumber | null | undefined): boolean;
|
|
389
|
+
compareTo(other: SwedishSwishNumber | null | undefined): number;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Returns a masked Swish number, e.g. `123-*** ** **` for 123-numbers,
|
|
393
|
+
* `9** ** **` for 90-numbers.
|
|
394
|
+
*/
|
|
395
|
+
declare function maskSwedishSwishNumber(swish: SwedishSwishNumber): string;
|
|
396
|
+
|
|
397
|
+
export { Bic as B, Iban as I, OcrReferenceControlType as O, SwedishBank as S, OcrReferenceOptions as a, SwedishBankAccount as b, SwedishBankClearingNumber as c, SwedishBankgiroNumber as d, SwedishOcrReferenceNumber as e, SwedishPostgiroNumber as f, SwedishSwishNumber as g, getBankgirotUrl as h, maskIban as i, maskSwedishBankAccount as j, maskSwedishBankClearingNumber as k, maskSwedishBankgiroNumber as l, maskBic as m, maskSwedishOcrReferenceNumber as n, maskSwedishPostgiroNumber as o, maskSwedishSwishNumber as p };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata describing a primitive value-object type — its human-readable
|
|
3
|
+
* names, representative emoji, and reference source URLs.
|
|
4
|
+
*
|
|
5
|
+
* The .NET equivalent is `Buildi.Primitives.PrimitiveTypeInfo` (a `record`).
|
|
6
|
+
*/
|
|
7
|
+
interface PrimitiveTypeInfo {
|
|
8
|
+
readonly englishName: string;
|
|
9
|
+
readonly localizedName: string;
|
|
10
|
+
readonly emoji: string;
|
|
11
|
+
readonly sources: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Broad classification of a {@link TextCandidate} for filtering and selective
|
|
16
|
+
* masking.
|
|
17
|
+
*/
|
|
18
|
+
declare const TextCandidateCategory: {
|
|
19
|
+
readonly PersonalIdentifier: "PersonalIdentifier";
|
|
20
|
+
readonly OrganizationIdentifier: "OrganizationIdentifier";
|
|
21
|
+
readonly Financial: "Financial";
|
|
22
|
+
readonly Contact: "Contact";
|
|
23
|
+
readonly Vehicle: "Vehicle";
|
|
24
|
+
readonly Property: "Property";
|
|
25
|
+
readonly Product: "Product";
|
|
26
|
+
readonly Geography: "Geography";
|
|
27
|
+
readonly Measurement: "Measurement";
|
|
28
|
+
};
|
|
29
|
+
type TextCandidateCategory = (typeof TextCandidateCategory)[keyof typeof TextCandidateCategory];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Indicates the confidence level of a candidate found by text scanning.
|
|
33
|
+
* Higher confidence means stronger structural evidence, but no level guarantees
|
|
34
|
+
* the absence of false positives.
|
|
35
|
+
*/
|
|
36
|
+
declare const TextMatchConfidence: {
|
|
37
|
+
/**
|
|
38
|
+
* Pattern match only. High false-positive risk — the matched text merely
|
|
39
|
+
* fits a syntactic pattern (e.g. a run of digits that happens to be the
|
|
40
|
+
* right length).
|
|
41
|
+
*/
|
|
42
|
+
readonly Low: 0;
|
|
43
|
+
/**
|
|
44
|
+
* Structural match with partial validation — the format is correct but no
|
|
45
|
+
* checksum or strong distinguishing feature confirms the match.
|
|
46
|
+
*/
|
|
47
|
+
readonly Medium: 1;
|
|
48
|
+
/**
|
|
49
|
+
* Strong match with checksum or format-specific validation (e.g. a personal
|
|
50
|
+
* identity number with a valid Luhn check digit and plausible date, or an
|
|
51
|
+
* IBAN with valid MOD-97).
|
|
52
|
+
*/
|
|
53
|
+
readonly High: 2;
|
|
54
|
+
};
|
|
55
|
+
type TextMatchConfidence = (typeof TextMatchConfidence)[keyof typeof TextMatchConfidence];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A potential match of a structured type found in unstructured text.
|
|
59
|
+
*
|
|
60
|
+
* Text scanning is heuristic-based. Candidates may be false positives, and
|
|
61
|
+
* valid occurrences may be missed. No guarantee is made that the matched text
|
|
62
|
+
* actually represents the identified type in its original context.
|
|
63
|
+
*/
|
|
64
|
+
declare class TextCandidate<T = unknown> {
|
|
65
|
+
/** Zero-based start position in the scanned text. */
|
|
66
|
+
readonly startIndex: number;
|
|
67
|
+
/** Number of characters in the original matched span. */
|
|
68
|
+
readonly length: number;
|
|
69
|
+
/** The raw substring from the input text that was matched. */
|
|
70
|
+
readonly originalText: string;
|
|
71
|
+
/**
|
|
72
|
+
* Short type name, e.g. `EmailAddress` or `SwedishPersonalIdentityNumber`.
|
|
73
|
+
*/
|
|
74
|
+
readonly typeName: string;
|
|
75
|
+
/** Broad category of the matched type. */
|
|
76
|
+
readonly category: TextCandidateCategory;
|
|
77
|
+
/** Machine-comparable canonical form of the matched value. */
|
|
78
|
+
readonly normalizedForm: string;
|
|
79
|
+
/** Human-readable display form of the matched value. */
|
|
80
|
+
readonly formattedForm: string;
|
|
81
|
+
/**
|
|
82
|
+
* Display form with sensitive content masked (e.g. `990807-****`).
|
|
83
|
+
* Produced by the type's `toMaskedString()` helper.
|
|
84
|
+
*/
|
|
85
|
+
readonly maskedForm: string;
|
|
86
|
+
/** Heuristic confidence level. */
|
|
87
|
+
readonly confidence: TextMatchConfidence;
|
|
88
|
+
/** The successfully parsed instance of the matched type. */
|
|
89
|
+
readonly value: T;
|
|
90
|
+
constructor(opts: {
|
|
91
|
+
startIndex: number;
|
|
92
|
+
length: number;
|
|
93
|
+
originalText: string;
|
|
94
|
+
typeName: string;
|
|
95
|
+
category: TextCandidateCategory;
|
|
96
|
+
normalizedForm: string;
|
|
97
|
+
formattedForm: string;
|
|
98
|
+
maskedForm: string;
|
|
99
|
+
confidence: TextMatchConfidence;
|
|
100
|
+
value: T;
|
|
101
|
+
});
|
|
102
|
+
/** Exclusive end position (`startIndex + length`). */
|
|
103
|
+
get endIndex(): number;
|
|
104
|
+
/** Returns `true` if this candidate's span overlaps with `other`. */
|
|
105
|
+
overlaps(other: TextCandidate): boolean;
|
|
106
|
+
/** Returns `true` if this candidate's span fully contains `other`. */
|
|
107
|
+
contains(other: TextCandidate): boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type PrimitiveTypeInfo as P, TextCandidate as T, TextCandidateCategory as a, TextMatchConfidence as b };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata describing a primitive value-object type — its human-readable
|
|
3
|
+
* names, representative emoji, and reference source URLs.
|
|
4
|
+
*
|
|
5
|
+
* The .NET equivalent is `Buildi.Primitives.PrimitiveTypeInfo` (a `record`).
|
|
6
|
+
*/
|
|
7
|
+
interface PrimitiveTypeInfo {
|
|
8
|
+
readonly englishName: string;
|
|
9
|
+
readonly localizedName: string;
|
|
10
|
+
readonly emoji: string;
|
|
11
|
+
readonly sources: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Broad classification of a {@link TextCandidate} for filtering and selective
|
|
16
|
+
* masking.
|
|
17
|
+
*/
|
|
18
|
+
declare const TextCandidateCategory: {
|
|
19
|
+
readonly PersonalIdentifier: "PersonalIdentifier";
|
|
20
|
+
readonly OrganizationIdentifier: "OrganizationIdentifier";
|
|
21
|
+
readonly Financial: "Financial";
|
|
22
|
+
readonly Contact: "Contact";
|
|
23
|
+
readonly Vehicle: "Vehicle";
|
|
24
|
+
readonly Property: "Property";
|
|
25
|
+
readonly Product: "Product";
|
|
26
|
+
readonly Geography: "Geography";
|
|
27
|
+
readonly Measurement: "Measurement";
|
|
28
|
+
};
|
|
29
|
+
type TextCandidateCategory = (typeof TextCandidateCategory)[keyof typeof TextCandidateCategory];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Indicates the confidence level of a candidate found by text scanning.
|
|
33
|
+
* Higher confidence means stronger structural evidence, but no level guarantees
|
|
34
|
+
* the absence of false positives.
|
|
35
|
+
*/
|
|
36
|
+
declare const TextMatchConfidence: {
|
|
37
|
+
/**
|
|
38
|
+
* Pattern match only. High false-positive risk — the matched text merely
|
|
39
|
+
* fits a syntactic pattern (e.g. a run of digits that happens to be the
|
|
40
|
+
* right length).
|
|
41
|
+
*/
|
|
42
|
+
readonly Low: 0;
|
|
43
|
+
/**
|
|
44
|
+
* Structural match with partial validation — the format is correct but no
|
|
45
|
+
* checksum or strong distinguishing feature confirms the match.
|
|
46
|
+
*/
|
|
47
|
+
readonly Medium: 1;
|
|
48
|
+
/**
|
|
49
|
+
* Strong match with checksum or format-specific validation (e.g. a personal
|
|
50
|
+
* identity number with a valid Luhn check digit and plausible date, or an
|
|
51
|
+
* IBAN with valid MOD-97).
|
|
52
|
+
*/
|
|
53
|
+
readonly High: 2;
|
|
54
|
+
};
|
|
55
|
+
type TextMatchConfidence = (typeof TextMatchConfidence)[keyof typeof TextMatchConfidence];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A potential match of a structured type found in unstructured text.
|
|
59
|
+
*
|
|
60
|
+
* Text scanning is heuristic-based. Candidates may be false positives, and
|
|
61
|
+
* valid occurrences may be missed. No guarantee is made that the matched text
|
|
62
|
+
* actually represents the identified type in its original context.
|
|
63
|
+
*/
|
|
64
|
+
declare class TextCandidate<T = unknown> {
|
|
65
|
+
/** Zero-based start position in the scanned text. */
|
|
66
|
+
readonly startIndex: number;
|
|
67
|
+
/** Number of characters in the original matched span. */
|
|
68
|
+
readonly length: number;
|
|
69
|
+
/** The raw substring from the input text that was matched. */
|
|
70
|
+
readonly originalText: string;
|
|
71
|
+
/**
|
|
72
|
+
* Short type name, e.g. `EmailAddress` or `SwedishPersonalIdentityNumber`.
|
|
73
|
+
*/
|
|
74
|
+
readonly typeName: string;
|
|
75
|
+
/** Broad category of the matched type. */
|
|
76
|
+
readonly category: TextCandidateCategory;
|
|
77
|
+
/** Machine-comparable canonical form of the matched value. */
|
|
78
|
+
readonly normalizedForm: string;
|
|
79
|
+
/** Human-readable display form of the matched value. */
|
|
80
|
+
readonly formattedForm: string;
|
|
81
|
+
/**
|
|
82
|
+
* Display form with sensitive content masked (e.g. `990807-****`).
|
|
83
|
+
* Produced by the type's `toMaskedString()` helper.
|
|
84
|
+
*/
|
|
85
|
+
readonly maskedForm: string;
|
|
86
|
+
/** Heuristic confidence level. */
|
|
87
|
+
readonly confidence: TextMatchConfidence;
|
|
88
|
+
/** The successfully parsed instance of the matched type. */
|
|
89
|
+
readonly value: T;
|
|
90
|
+
constructor(opts: {
|
|
91
|
+
startIndex: number;
|
|
92
|
+
length: number;
|
|
93
|
+
originalText: string;
|
|
94
|
+
typeName: string;
|
|
95
|
+
category: TextCandidateCategory;
|
|
96
|
+
normalizedForm: string;
|
|
97
|
+
formattedForm: string;
|
|
98
|
+
maskedForm: string;
|
|
99
|
+
confidence: TextMatchConfidence;
|
|
100
|
+
value: T;
|
|
101
|
+
});
|
|
102
|
+
/** Exclusive end position (`startIndex + length`). */
|
|
103
|
+
get endIndex(): number;
|
|
104
|
+
/** Returns `true` if this candidate's span overlaps with `other`. */
|
|
105
|
+
overlaps(other: TextCandidate): boolean;
|
|
106
|
+
/** Returns `true` if this candidate's span fully contains `other`. */
|
|
107
|
+
contains(other: TextCandidate): boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type PrimitiveTypeInfo as P, TextCandidate as T, TextCandidateCategory as a, TextMatchConfidence as b };
|