@budiauktioner/buildi-primitives 0.2.1 → 0.3.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/PARITY.md +7 -7
  3. package/README.md +18 -1
  4. package/dist/cjs/contact/phone-number-test-data.js +1 -1
  5. package/dist/cjs/contact/phone-number-test-data.js.map +1 -1
  6. package/dist/cjs/contact/phone-number.js +36 -14
  7. package/dist/cjs/contact/phone-number.js.map +2 -2
  8. package/dist/cjs/organization/swedish-organization-number.js.map +2 -2
  9. package/dist/cjs/register-default-text-scanners.js +2 -0
  10. package/dist/cjs/register-default-text-scanners.js.map +2 -2
  11. package/dist/cjs/sample-data/index.js +18 -1
  12. package/dist/cjs/sample-data/index.js.map +2 -2
  13. package/dist/cjs/text-scanning/text-scan-result.js +3 -0
  14. package/dist/cjs/text-scanning/text-scan-result.js.map +2 -2
  15. package/dist/cjs/validation/validation-error-reason.js +6 -1
  16. package/dist/cjs/validation/validation-error-reason.js.map +2 -2
  17. package/dist/cjs/vehicle/index.js +4 -0
  18. package/dist/cjs/vehicle/index.js.map +2 -2
  19. package/dist/cjs/vehicle/watercraft-identification-number.js +332 -0
  20. package/dist/cjs/vehicle/watercraft-identification-number.js.map +7 -0
  21. package/dist/esm/contact/phone-number-test-data.js +1 -1
  22. package/dist/esm/contact/phone-number-test-data.js.map +1 -1
  23. package/dist/esm/contact/phone-number.js +36 -14
  24. package/dist/esm/contact/phone-number.js.map +2 -2
  25. package/dist/esm/organization/swedish-organization-number.js.map +2 -2
  26. package/dist/esm/register-default-text-scanners.js +2 -0
  27. package/dist/esm/register-default-text-scanners.js.map +2 -2
  28. package/dist/esm/sample-data/index.js +18 -1
  29. package/dist/esm/sample-data/index.js.map +2 -2
  30. package/dist/esm/text-scanning/text-scan-result.js +3 -0
  31. package/dist/esm/text-scanning/text-scan-result.js.map +2 -2
  32. package/dist/esm/validation/validation-error-reason.js +6 -1
  33. package/dist/esm/validation/validation-error-reason.js.map +2 -2
  34. package/dist/esm/vehicle/index.js +8 -0
  35. package/dist/esm/vehicle/index.js.map +2 -2
  36. package/dist/esm/vehicle/watercraft-identification-number.js +315 -0
  37. package/dist/esm/vehicle/watercraft-identification-number.js.map +7 -0
  38. package/dist/types/banking/index.d.cts +2 -2
  39. package/dist/types/banking/index.d.ts +2 -2
  40. package/dist/types/contact/index.d.cts +1 -1
  41. package/dist/types/contact/index.d.ts +1 -1
  42. package/dist/types/index.d.cts +2 -1
  43. package/dist/types/index.d.ts +2 -1
  44. package/dist/types/sample-data/index.d.cts +10 -2
  45. package/dist/types/sample-data/index.d.ts +10 -2
  46. package/dist/types/text-scanning/index.d.cts +3 -1
  47. package/dist/types/text-scanning/index.d.ts +3 -1
  48. package/dist/types/validation/index.d.cts +4 -0
  49. package/dist/types/validation/index.d.ts +4 -0
  50. package/dist/types/vehicle/index.d.cts +2 -0
  51. package/dist/types/vehicle/index.d.ts +2 -0
  52. package/dist/types/watercraft-identification-number-Db1I2LQM.d.cts +123 -0
  53. package/dist/types/watercraft-identification-number-o8B3C6Nx.d.ts +123 -0
  54. package/package.json +18 -13
  55. package/dist/types/{swedish-swish-number-CL6Gx_h3.d.cts → swedish-swish-number-Bh-UbVoN.d.cts} +136 -136
  56. package/dist/types/{swedish-swish-number-DDG3mNDg.d.ts → swedish-swish-number-C2Wccuyr.d.ts} +136 -136
@@ -80,6 +80,142 @@ declare class Bic {
80
80
  */
81
81
  declare function maskBic(bic: Bic): string;
82
82
 
83
+ /**
84
+ * A Swedish Bankgiro number (`bankgironummer`), e.g. `5805-6201`.
85
+ * 7 or 8 digits with Luhn check digit.
86
+ */
87
+ declare class SwedishBankgiroNumber {
88
+ static readonly typeInfo: PrimitiveTypeInfo;
89
+ static readonly displayName = "Bankgiro";
90
+ static readonly displayNameShort = "BG";
91
+ /** Digit-only value, e.g. `58056201`. */
92
+ readonly digits: string;
93
+ /** Hyphenated display form, e.g. `5805-6201`. */
94
+ readonly formatted: string;
95
+ private constructor();
96
+ static tryParse(input: string | null | undefined): SwedishBankgiroNumber | null;
97
+ static parse(input: string): SwedishBankgiroNumber;
98
+ static isValid(input: string | null | undefined): boolean;
99
+ static format(input: string | null | undefined, options?: {
100
+ fallbackToTrimmedInputWhenInvalid?: boolean;
101
+ }): string | null;
102
+ static normalize(input: string | null | undefined, options?: {
103
+ fallbackToTrimmedInputWhenInvalid?: boolean;
104
+ }): string | null;
105
+ static isNormalized(input: string | null | undefined): boolean;
106
+ toNormalizedString(): string;
107
+ toDisplayString(): string;
108
+ toShortDisplayString(): string;
109
+ toString(): string;
110
+ static validate(input: string | null | undefined): ValidationResult;
111
+ static findCandidatesInText(text: string): readonly TextCandidate<SwedishBankgiroNumber>[];
112
+ equals(other: SwedishBankgiroNumber | null | undefined): boolean;
113
+ compareTo(other: SwedishBankgiroNumber | null | undefined): number;
114
+ }
115
+ /** Returns the Bankgirot search URL for this Bankgiro number. */
116
+ declare function getBankgirotUrl(bg: SwedishBankgiroNumber): string;
117
+ /**
118
+ * Returns a masked Bankgiro number, e.g. `****-6201` (default) or `5805-****` when
119
+ * `showLastDigits` is `false`.
120
+ */
121
+ declare function maskSwedishBankgiroNumber(bg: SwedishBankgiroNumber, options?: {
122
+ showLastDigits?: boolean;
123
+ }): string;
124
+
125
+ /**
126
+ * A Swedish Plusgiro number (`plusgironummer`), e.g. `1234567-9`.
127
+ * 2–8 digits with Luhn check digit.
128
+ */
129
+ declare class SwedishPostgiroNumber {
130
+ static readonly typeInfo: PrimitiveTypeInfo;
131
+ static readonly displayName = "Plusgiro";
132
+ static readonly displayNameShort = "PG";
133
+ /** Digit-only value, e.g. `41313008`. */
134
+ readonly digits: string;
135
+ /** Hyphenated display form, e.g. `4131300-8`. */
136
+ readonly formatted: string;
137
+ private constructor();
138
+ static tryParse(input: string | null | undefined): SwedishPostgiroNumber | null;
139
+ static parse(input: string): SwedishPostgiroNumber;
140
+ static isValid(input: string | null | undefined): boolean;
141
+ static format(input: string | null | undefined, options?: {
142
+ fallbackToTrimmedInputWhenInvalid?: boolean;
143
+ }): string | null;
144
+ static normalize(input: string | null | undefined, options?: {
145
+ fallbackToTrimmedInputWhenInvalid?: boolean;
146
+ }): string | null;
147
+ static isNormalized(input: string | null | undefined): boolean;
148
+ toNormalizedString(): string;
149
+ toDisplayString(): string;
150
+ toShortDisplayString(): string;
151
+ toString(): string;
152
+ static validate(input: string | null | undefined): ValidationResult;
153
+ static findCandidatesInText(text: string): readonly TextCandidate<SwedishPostgiroNumber>[];
154
+ equals(other: SwedishPostgiroNumber | null | undefined): boolean;
155
+ compareTo(other: SwedishPostgiroNumber | null | undefined): number;
156
+ }
157
+ /**
158
+ * Returns a masked Plusgiro number, e.g. `******-9` (default, showing the control digit) or
159
+ * `123456-*` when `showControlDigit` is `false`.
160
+ */
161
+ declare function maskSwedishPostgiroNumber(pg: SwedishPostgiroNumber, options?: {
162
+ showControlDigit?: boolean;
163
+ }): string;
164
+
165
+ /** OCR reference control type. */
166
+ declare const OcrReferenceControlType: {
167
+ readonly CheckDigitOnly: "CheckDigitOnly";
168
+ readonly VariableLengthDigit: "VariableLengthDigit";
169
+ readonly FixedLength: "FixedLength";
170
+ };
171
+ type OcrReferenceControlType = (typeof OcrReferenceControlType)[keyof typeof OcrReferenceControlType];
172
+ /** Options controlling OCR reference parsing. */
173
+ declare class OcrReferenceOptions {
174
+ static readonly Default: OcrReferenceOptions;
175
+ static readonly VariableLengthDigit: OcrReferenceOptions;
176
+ readonly controlType: OcrReferenceControlType;
177
+ readonly allowedLengths: readonly number[];
178
+ constructor(controlType?: OcrReferenceControlType, allowedLengths?: readonly number[]);
179
+ static fixedLength(...allowedLengths: number[]): OcrReferenceOptions;
180
+ }
181
+ /**
182
+ * A Swedish OCR reference number (`OCR-nummer`), used in payment flows.
183
+ * 2–25 digits with Luhn check digit; optional length-digit and fixed-length variants.
184
+ */
185
+ declare class SwedishOcrReferenceNumber {
186
+ static readonly typeInfo: PrimitiveTypeInfo;
187
+ static readonly displayName = "OCR";
188
+ static readonly displayNameShort = "OCR";
189
+ readonly value: string;
190
+ readonly formatted: string;
191
+ readonly lengthDigit: number | null;
192
+ get length(): number;
193
+ get checkDigit(): number;
194
+ private constructor();
195
+ static tryParse(input: string | null | undefined, options?: OcrReferenceOptions): SwedishOcrReferenceNumber | null;
196
+ static tryParseVariableLengthDigit(input: string | null | undefined): SwedishOcrReferenceNumber | null;
197
+ static tryParseFixedLength(input: string | null | undefined, fixedLengths: number | readonly number[]): SwedishOcrReferenceNumber | null;
198
+ static parse(input: string, options?: OcrReferenceOptions): SwedishOcrReferenceNumber;
199
+ static isValid(input: string | null | undefined, options?: OcrReferenceOptions): 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
+ toShortDisplayString(): string;
210
+ toString(): string;
211
+ static validate(input: string | null | undefined): ValidationResult;
212
+ static findCandidatesInText(text: string): readonly TextCandidate<SwedishOcrReferenceNumber>[];
213
+ equals(other: SwedishOcrReferenceNumber | null | undefined): boolean;
214
+ compareTo(other: SwedishOcrReferenceNumber | null | undefined): number;
215
+ }
216
+ /** Returns a fully masked OCR reference, e.g. `12345678901` → `***********`. */
217
+ declare function maskSwedishOcrReferenceNumber(ocr: SwedishOcrReferenceNumber): string;
218
+
83
219
  /**
84
220
  * Known Swedish banks, identified by clearing number ranges.
85
221
  *
@@ -220,142 +356,6 @@ declare function maskSwedishBankAccount(account: SwedishBankAccount, options?: {
220
356
  maskClearingNumber?: boolean;
221
357
  }): string;
222
358
 
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
359
  /**
360
360
  * A Swedish Swish payment number (`Swish-nummer`).
361
361
  * Accepts: