@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.
Files changed (107) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +253 -0
  4. package/THIRD_PARTY_NOTICES.md +52 -0
  5. package/dist/banking/index.cjs +6491 -0
  6. package/dist/banking/index.cjs.map +1 -0
  7. package/dist/banking/index.d.cts +58 -0
  8. package/dist/banking/index.d.ts +58 -0
  9. package/dist/banking/index.js +6464 -0
  10. package/dist/banking/index.js.map +1 -0
  11. package/dist/contact/index.cjs +6678 -0
  12. package/dist/contact/index.cjs.map +1 -0
  13. package/dist/contact/index.d.cts +709 -0
  14. package/dist/contact/index.d.ts +709 -0
  15. package/dist/contact/index.js +6586 -0
  16. package/dist/contact/index.js.map +1 -0
  17. package/dist/country-BhD51LDL.d.cts +433 -0
  18. package/dist/country-p0n0EVQ9.d.ts +433 -0
  19. package/dist/finance/index.cjs +3592 -0
  20. package/dist/finance/index.cjs.map +1 -0
  21. package/dist/finance/index.d.cts +83 -0
  22. package/dist/finance/index.d.ts +83 -0
  23. package/dist/finance/index.js +3584 -0
  24. package/dist/finance/index.js.map +1 -0
  25. package/dist/geography/index.cjs +4227 -0
  26. package/dist/geography/index.cjs.map +1 -0
  27. package/dist/geography/index.d.cts +34 -0
  28. package/dist/geography/index.d.ts +34 -0
  29. package/dist/geography/index.js +4202 -0
  30. package/dist/geography/index.js.map +1 -0
  31. package/dist/index.cjs +14087 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +75 -0
  34. package/dist/index.d.ts +75 -0
  35. package/dist/index.js +13868 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/isin-EeVPpNWu.d.ts +39 -0
  38. package/dist/isin-ZlQLBVm8.d.cts +39 -0
  39. package/dist/organization/index.cjs +2376 -0
  40. package/dist/organization/index.cjs.map +1 -0
  41. package/dist/organization/index.d.cts +117 -0
  42. package/dist/organization/index.d.ts +117 -0
  43. package/dist/organization/index.js +2346 -0
  44. package/dist/organization/index.js.map +1 -0
  45. package/dist/person/index.cjs +1144 -0
  46. package/dist/person/index.cjs.map +1 -0
  47. package/dist/person/index.d.cts +60 -0
  48. package/dist/person/index.d.ts +60 -0
  49. package/dist/person/index.js +1125 -0
  50. package/dist/person/index.js.map +1 -0
  51. package/dist/person-full-name-Cmc9Ynuc.d.cts +82 -0
  52. package/dist/person-full-name-D6Hbsab6.d.ts +82 -0
  53. package/dist/phone-number-C24--ggy.d.ts +139 -0
  54. package/dist/phone-number-DZ-YxCQQ.d.cts +139 -0
  55. package/dist/property/index.cjs +487 -0
  56. package/dist/property/index.cjs.map +1 -0
  57. package/dist/property/index.d.cts +56 -0
  58. package/dist/property/index.d.ts +56 -0
  59. package/dist/property/index.js +480 -0
  60. package/dist/property/index.js.map +1 -0
  61. package/dist/sample-data/index.cjs +12310 -0
  62. package/dist/sample-data/index.cjs.map +1 -0
  63. package/dist/sample-data/index.d.cts +260 -0
  64. package/dist/sample-data/index.d.ts +260 -0
  65. package/dist/sample-data/index.js +12302 -0
  66. package/dist/sample-data/index.js.map +1 -0
  67. package/dist/swedish-address-DNC3ftRF.d.cts +297 -0
  68. package/dist/swedish-address-GMzjqgxb.d.ts +297 -0
  69. package/dist/swedish-bank-account-holder-name-BFJ8h1aO.d.cts +45 -0
  70. package/dist/swedish-bank-account-holder-name-CAAru07F.d.ts +45 -0
  71. package/dist/swedish-municipality-DlUS7g7h.d.cts +87 -0
  72. package/dist/swedish-municipality-nDRHYRAd.d.ts +87 -0
  73. package/dist/swedish-organization-name-D7NvERxA.d.cts +33 -0
  74. package/dist/swedish-organization-name-rR0Q836C.d.ts +33 -0
  75. package/dist/swedish-organization-number-Bcj7V_lh.d.cts +130 -0
  76. package/dist/swedish-organization-number-DM8dpXwR.d.ts +130 -0
  77. package/dist/swedish-organization-type-CZOdETwG.d.cts +29 -0
  78. package/dist/swedish-organization-type-CZOdETwG.d.ts +29 -0
  79. package/dist/swedish-personal-identity-number-BiIg4io3.d.ts +149 -0
  80. package/dist/swedish-personal-identity-number-Cp9Coz55.d.cts +149 -0
  81. package/dist/swedish-property-designation-BM-gdd9x.d.ts +46 -0
  82. package/dist/swedish-property-designation-BaHXufqV.d.cts +46 -0
  83. package/dist/swedish-sni-code-Ccsswpni.d.ts +53 -0
  84. package/dist/swedish-sni-code-CuJFyM6l.d.cts +53 -0
  85. package/dist/swedish-swish-number-CL6Gx_h3.d.cts +397 -0
  86. package/dist/swedish-swish-number-DDG3mNDg.d.ts +397 -0
  87. package/dist/text-candidate-qg2bD9PY.d.cts +110 -0
  88. package/dist/text-candidate-qg2bD9PY.d.ts +110 -0
  89. package/dist/text-scanning/index.cjs +10414 -0
  90. package/dist/text-scanning/index.cjs.map +1 -0
  91. package/dist/text-scanning/index.d.cts +153 -0
  92. package/dist/text-scanning/index.d.ts +153 -0
  93. package/dist/text-scanning/index.js +10406 -0
  94. package/dist/text-scanning/index.js.map +1 -0
  95. package/dist/validation/index.cjs +83 -0
  96. package/dist/validation/index.cjs.map +1 -0
  97. package/dist/validation/index.d.cts +63 -0
  98. package/dist/validation/index.d.ts +63 -0
  99. package/dist/validation/index.js +79 -0
  100. package/dist/validation/index.js.map +1 -0
  101. package/dist/web/index.cjs +3994 -0
  102. package/dist/web/index.cjs.map +1 -0
  103. package/dist/web/index.d.cts +203 -0
  104. package/dist/web/index.d.ts +203 -0
  105. package/dist/web/index.js +3987 -0
  106. package/dist/web/index.js.map +1 -0
  107. package/package.json +211 -0
@@ -0,0 +1,153 @@
1
+ import { T as TextCandidate, a as TextCandidateCategory, b as TextMatchConfidence } from '../text-candidate-qg2bD9PY.cjs';
2
+ import { I as Iban, B as Bic, d as SwedishBankgiroNumber, f as SwedishPostgiroNumber, b as SwedishBankAccount, e as SwedishOcrReferenceNumber, g as SwedishSwishNumber } from '../swedish-swish-number-CL6Gx_h3.cjs';
3
+ import { c as AddressZipCode, A as Address, S as SwedishAddress } from '../swedish-address-DNC3ftRF.cjs';
4
+ import { a as PhoneNumber } from '../phone-number-DZ-YxCQQ.cjs';
5
+ import { I as Isin } from '../isin-ZlQLBVm8.cjs';
6
+ import { a as Country } from '../country-BhD51LDL.cjs';
7
+ import { S as SwedishCounty, a as SwedishMunicipality } from '../swedish-municipality-DlUS7g7h.cjs';
8
+ import { S as SwedishOrganizationNumber, E as EuVatNumber, L as LeiCode, D as DunsNumber } from '../swedish-organization-number-Bcj7V_lh.cjs';
9
+ import { b as SwedishPersonalIdentityNumber, S as SwedishCoordinationNumber } from '../swedish-personal-identity-number-Cp9Coz55.cjs';
10
+ import { S as SwedishPropertyDesignation } from '../swedish-property-designation-BaHXufqV.cjs';
11
+ import { EmailAddress, Url } from '../web/index.cjs';
12
+ import '../validation/index.cjs';
13
+ import '../swedish-organization-type-CZOdETwG.cjs';
14
+
15
+ /** Registers every built-in `findCandidatesInText` implementation on the shared scanner. */
16
+ declare function registerDefaultTextScanners(): void;
17
+
18
+ /**
19
+ * The result of scanning unstructured text for structured value types.
20
+ * Contains all found candidates, a resolved non-overlapping subset, and
21
+ * methods for bulk replacement / masking.
22
+ *
23
+ * Text scanning is heuristic-based. Candidates may be false positives, and
24
+ * valid occurrences may be missed.
25
+ */
26
+ declare class TextScanResult {
27
+ /** All candidates sorted by `startIndex`, including overlapping ones. */
28
+ readonly all: readonly TextCandidate[];
29
+ /**
30
+ * Non-overlapping subset after resolution. When candidates overlap or one
31
+ * contains another, the winner is chosen by: containment (longer enclosing
32
+ * match wins), then higher {@link TextMatchConfidence}, then longer span,
33
+ * then category priority.
34
+ */
35
+ readonly resolvedCandidates: readonly TextCandidate[];
36
+ constructor(candidates: readonly TextCandidate[]);
37
+ get totalCount(): number;
38
+ /** Returns the number of candidates in the given category. */
39
+ countByCategory(category: TextCandidateCategory): number;
40
+ /** Returns the number of candidates at or above the given confidence level. */
41
+ countByConfidence(minimum: TextMatchConfidence): number;
42
+ /** Returns all candidates whose `typeName` equals `typeName`. */
43
+ byTypeName<T = unknown>(typeName: string): TextCandidate<T>[];
44
+ get emails(): TextCandidate<EmailAddress>[];
45
+ get urls(): TextCandidate<Url>[];
46
+ get phoneNumbers(): TextCandidate<PhoneNumber>[];
47
+ get zipCodes(): TextCandidate<AddressZipCode>[];
48
+ get addresses(): TextCandidate<Address>[];
49
+ get swedishAddresses(): TextCandidate<SwedishAddress>[];
50
+ get personalIdentityNumbers(): TextCandidate<SwedishPersonalIdentityNumber>[];
51
+ get coordinationNumbers(): TextCandidate<SwedishCoordinationNumber>[];
52
+ get organizationNumbers(): TextCandidate<SwedishOrganizationNumber>[];
53
+ get euVatNumbers(): TextCandidate<EuVatNumber>[];
54
+ get leiCodes(): TextCandidate<LeiCode>[];
55
+ get dunsNumbers(): TextCandidate<DunsNumber>[];
56
+ get ibans(): TextCandidate<Iban>[];
57
+ get bics(): TextCandidate<Bic>[];
58
+ get bankgiroNumbers(): TextCandidate<SwedishBankgiroNumber>[];
59
+ get postgiroNumbers(): TextCandidate<SwedishPostgiroNumber>[];
60
+ get bankAccounts(): TextCandidate<SwedishBankAccount>[];
61
+ get ocrReferences(): TextCandidate<SwedishOcrReferenceNumber>[];
62
+ get swedishSwishNumbers(): TextCandidate<SwedishSwishNumber>[];
63
+ get isins(): TextCandidate<Isin>[];
64
+ get countries(): TextCandidate<Country>[];
65
+ get counties(): TextCandidate<SwedishCounty>[];
66
+ get municipalities(): TextCandidate<SwedishMunicipality>[];
67
+ get propertyDesignations(): TextCandidate<SwedishPropertyDesignation>[];
68
+ /** Returns all candidates in the given category. */
69
+ byCategory(category: TextCandidateCategory): TextCandidate[];
70
+ /**
71
+ * Replaces each resolved candidate's span in `text` with its `maskedForm`.
72
+ */
73
+ maskAll(text: string): string;
74
+ /**
75
+ * Replaces each resolved candidate's span in `text` with `replacement`.
76
+ */
77
+ redactAll(text: string, replacement?: string): string;
78
+ /**
79
+ * Replaces each resolved candidate's span in `text` using a custom mapper.
80
+ * Replacements are applied right-to-left on the original text so positions
81
+ * remain valid.
82
+ */
83
+ replaceAll(text: string, replacer: (c: TextCandidate) => string): string;
84
+ }
85
+
86
+ /**
87
+ * Configuration for the text scanner controlling which categories to scan and
88
+ * the minimum confidence threshold.
89
+ */
90
+ interface TextScannerOptions {
91
+ /**
92
+ * When set, only categories in this set are scanned. Mutually exclusive
93
+ * with {@link excludeCategories}.
94
+ */
95
+ includeCategories?: ReadonlySet<TextCandidateCategory>;
96
+ /**
97
+ * When set, categories in this set are skipped. Ignored if
98
+ * {@link includeCategories} is set.
99
+ */
100
+ excludeCategories?: ReadonlySet<TextCandidateCategory>;
101
+ /**
102
+ * Candidates below this confidence level are discarded from results.
103
+ * Defaults to {@link TextMatchConfidence.Low} (keep everything).
104
+ */
105
+ minimumConfidence?: TextMatchConfidence;
106
+ }
107
+
108
+ /**
109
+ * A scan function returns all candidates found in `text` for one type.
110
+ */
111
+ type TextScanFunction<T = unknown> = (text: string) => readonly TextCandidate<T>[];
112
+ /**
113
+ * A registration that wires one type's `findCandidatesInText` function into a
114
+ * scanner.
115
+ */
116
+ interface RegisteredScanner<T = unknown> {
117
+ readonly typeName: string;
118
+ readonly category: TextCandidateCategory;
119
+ readonly scan: TextScanFunction<T>;
120
+ }
121
+ /**
122
+ * Aggregate scanner that runs every registered type's `findCandidatesInText`
123
+ * and merges the results.
124
+ *
125
+ * In contrast to the .NET `TextScanner` (which hard-codes a fixed list of
126
+ * types in its constructor), the JS port uses a registry. Type modules call
127
+ * {@link TextScanner.register} (or push to {@link defaultTextScanner}) so the
128
+ * scanner is extensible without editing this file.
129
+ */
130
+ declare class TextScanner {
131
+ private readonly registrations;
132
+ /**
133
+ * Registers a type's scan function. Called once per type, normally at
134
+ * module load time.
135
+ */
136
+ register<T>(reg: RegisteredScanner<T>): void;
137
+ /** Currently registered scanners. Mainly useful for tests. */
138
+ get registered(): readonly RegisteredScanner[];
139
+ /**
140
+ * Scans `text` for all registered types matching the given `options`.
141
+ * Returns an aggregate result with overlap resolution.
142
+ */
143
+ scan(text: string, options?: TextScannerOptions): TextScanResult;
144
+ }
145
+ /**
146
+ * The default scanner used by `@budiauktioner/buildi-primitives`. Type modules with
147
+ * `findCandidatesInText` register themselves with this instance at module
148
+ * load time. Applications that need an isolated scanner can construct their
149
+ * own {@link TextScanner}.
150
+ */
151
+ declare const defaultTextScanner: TextScanner;
152
+
153
+ export { type RegisteredScanner, TextCandidate, TextCandidateCategory, TextMatchConfidence, type TextScanFunction, TextScanResult, TextScanner, type TextScannerOptions, defaultTextScanner, registerDefaultTextScanners };
@@ -0,0 +1,153 @@
1
+ import { T as TextCandidate, a as TextCandidateCategory, b as TextMatchConfidence } from '../text-candidate-qg2bD9PY.js';
2
+ import { I as Iban, B as Bic, d as SwedishBankgiroNumber, f as SwedishPostgiroNumber, b as SwedishBankAccount, e as SwedishOcrReferenceNumber, g as SwedishSwishNumber } from '../swedish-swish-number-DDG3mNDg.js';
3
+ import { c as AddressZipCode, A as Address, S as SwedishAddress } from '../swedish-address-GMzjqgxb.js';
4
+ import { a as PhoneNumber } from '../phone-number-C24--ggy.js';
5
+ import { I as Isin } from '../isin-EeVPpNWu.js';
6
+ import { a as Country } from '../country-p0n0EVQ9.js';
7
+ import { S as SwedishCounty, a as SwedishMunicipality } from '../swedish-municipality-nDRHYRAd.js';
8
+ import { S as SwedishOrganizationNumber, E as EuVatNumber, L as LeiCode, D as DunsNumber } from '../swedish-organization-number-DM8dpXwR.js';
9
+ import { b as SwedishPersonalIdentityNumber, S as SwedishCoordinationNumber } from '../swedish-personal-identity-number-BiIg4io3.js';
10
+ import { S as SwedishPropertyDesignation } from '../swedish-property-designation-BM-gdd9x.js';
11
+ import { EmailAddress, Url } from '../web/index.js';
12
+ import '../validation/index.js';
13
+ import '../swedish-organization-type-CZOdETwG.js';
14
+
15
+ /** Registers every built-in `findCandidatesInText` implementation on the shared scanner. */
16
+ declare function registerDefaultTextScanners(): void;
17
+
18
+ /**
19
+ * The result of scanning unstructured text for structured value types.
20
+ * Contains all found candidates, a resolved non-overlapping subset, and
21
+ * methods for bulk replacement / masking.
22
+ *
23
+ * Text scanning is heuristic-based. Candidates may be false positives, and
24
+ * valid occurrences may be missed.
25
+ */
26
+ declare class TextScanResult {
27
+ /** All candidates sorted by `startIndex`, including overlapping ones. */
28
+ readonly all: readonly TextCandidate[];
29
+ /**
30
+ * Non-overlapping subset after resolution. When candidates overlap or one
31
+ * contains another, the winner is chosen by: containment (longer enclosing
32
+ * match wins), then higher {@link TextMatchConfidence}, then longer span,
33
+ * then category priority.
34
+ */
35
+ readonly resolvedCandidates: readonly TextCandidate[];
36
+ constructor(candidates: readonly TextCandidate[]);
37
+ get totalCount(): number;
38
+ /** Returns the number of candidates in the given category. */
39
+ countByCategory(category: TextCandidateCategory): number;
40
+ /** Returns the number of candidates at or above the given confidence level. */
41
+ countByConfidence(minimum: TextMatchConfidence): number;
42
+ /** Returns all candidates whose `typeName` equals `typeName`. */
43
+ byTypeName<T = unknown>(typeName: string): TextCandidate<T>[];
44
+ get emails(): TextCandidate<EmailAddress>[];
45
+ get urls(): TextCandidate<Url>[];
46
+ get phoneNumbers(): TextCandidate<PhoneNumber>[];
47
+ get zipCodes(): TextCandidate<AddressZipCode>[];
48
+ get addresses(): TextCandidate<Address>[];
49
+ get swedishAddresses(): TextCandidate<SwedishAddress>[];
50
+ get personalIdentityNumbers(): TextCandidate<SwedishPersonalIdentityNumber>[];
51
+ get coordinationNumbers(): TextCandidate<SwedishCoordinationNumber>[];
52
+ get organizationNumbers(): TextCandidate<SwedishOrganizationNumber>[];
53
+ get euVatNumbers(): TextCandidate<EuVatNumber>[];
54
+ get leiCodes(): TextCandidate<LeiCode>[];
55
+ get dunsNumbers(): TextCandidate<DunsNumber>[];
56
+ get ibans(): TextCandidate<Iban>[];
57
+ get bics(): TextCandidate<Bic>[];
58
+ get bankgiroNumbers(): TextCandidate<SwedishBankgiroNumber>[];
59
+ get postgiroNumbers(): TextCandidate<SwedishPostgiroNumber>[];
60
+ get bankAccounts(): TextCandidate<SwedishBankAccount>[];
61
+ get ocrReferences(): TextCandidate<SwedishOcrReferenceNumber>[];
62
+ get swedishSwishNumbers(): TextCandidate<SwedishSwishNumber>[];
63
+ get isins(): TextCandidate<Isin>[];
64
+ get countries(): TextCandidate<Country>[];
65
+ get counties(): TextCandidate<SwedishCounty>[];
66
+ get municipalities(): TextCandidate<SwedishMunicipality>[];
67
+ get propertyDesignations(): TextCandidate<SwedishPropertyDesignation>[];
68
+ /** Returns all candidates in the given category. */
69
+ byCategory(category: TextCandidateCategory): TextCandidate[];
70
+ /**
71
+ * Replaces each resolved candidate's span in `text` with its `maskedForm`.
72
+ */
73
+ maskAll(text: string): string;
74
+ /**
75
+ * Replaces each resolved candidate's span in `text` with `replacement`.
76
+ */
77
+ redactAll(text: string, replacement?: string): string;
78
+ /**
79
+ * Replaces each resolved candidate's span in `text` using a custom mapper.
80
+ * Replacements are applied right-to-left on the original text so positions
81
+ * remain valid.
82
+ */
83
+ replaceAll(text: string, replacer: (c: TextCandidate) => string): string;
84
+ }
85
+
86
+ /**
87
+ * Configuration for the text scanner controlling which categories to scan and
88
+ * the minimum confidence threshold.
89
+ */
90
+ interface TextScannerOptions {
91
+ /**
92
+ * When set, only categories in this set are scanned. Mutually exclusive
93
+ * with {@link excludeCategories}.
94
+ */
95
+ includeCategories?: ReadonlySet<TextCandidateCategory>;
96
+ /**
97
+ * When set, categories in this set are skipped. Ignored if
98
+ * {@link includeCategories} is set.
99
+ */
100
+ excludeCategories?: ReadonlySet<TextCandidateCategory>;
101
+ /**
102
+ * Candidates below this confidence level are discarded from results.
103
+ * Defaults to {@link TextMatchConfidence.Low} (keep everything).
104
+ */
105
+ minimumConfidence?: TextMatchConfidence;
106
+ }
107
+
108
+ /**
109
+ * A scan function returns all candidates found in `text` for one type.
110
+ */
111
+ type TextScanFunction<T = unknown> = (text: string) => readonly TextCandidate<T>[];
112
+ /**
113
+ * A registration that wires one type's `findCandidatesInText` function into a
114
+ * scanner.
115
+ */
116
+ interface RegisteredScanner<T = unknown> {
117
+ readonly typeName: string;
118
+ readonly category: TextCandidateCategory;
119
+ readonly scan: TextScanFunction<T>;
120
+ }
121
+ /**
122
+ * Aggregate scanner that runs every registered type's `findCandidatesInText`
123
+ * and merges the results.
124
+ *
125
+ * In contrast to the .NET `TextScanner` (which hard-codes a fixed list of
126
+ * types in its constructor), the JS port uses a registry. Type modules call
127
+ * {@link TextScanner.register} (or push to {@link defaultTextScanner}) so the
128
+ * scanner is extensible without editing this file.
129
+ */
130
+ declare class TextScanner {
131
+ private readonly registrations;
132
+ /**
133
+ * Registers a type's scan function. Called once per type, normally at
134
+ * module load time.
135
+ */
136
+ register<T>(reg: RegisteredScanner<T>): void;
137
+ /** Currently registered scanners. Mainly useful for tests. */
138
+ get registered(): readonly RegisteredScanner[];
139
+ /**
140
+ * Scans `text` for all registered types matching the given `options`.
141
+ * Returns an aggregate result with overlap resolution.
142
+ */
143
+ scan(text: string, options?: TextScannerOptions): TextScanResult;
144
+ }
145
+ /**
146
+ * The default scanner used by `@budiauktioner/buildi-primitives`. Type modules with
147
+ * `findCandidatesInText` register themselves with this instance at module
148
+ * load time. Applications that need an isolated scanner can construct their
149
+ * own {@link TextScanner}.
150
+ */
151
+ declare const defaultTextScanner: TextScanner;
152
+
153
+ export { type RegisteredScanner, TextCandidate, TextCandidateCategory, TextMatchConfidence, type TextScanFunction, TextScanResult, TextScanner, type TextScannerOptions, defaultTextScanner, registerDefaultTextScanners };