@sampuli/data 0.1.0 → 0.2.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 (4) hide show
  1. package/README.md +65 -28
  2. package/dist/index.cjs +3219 -84
  3. package/dist/index.js +3219 -84
  4. package/package.json +10 -7
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # @sampuli/data
2
2
 
3
- **Format-true synthetic test data 27 countries, Kenya first.** Valid KRA
4
- PINs and M-Pesa numbers, Nigerian BVNs, South African IDs, real bank SWIFT/BIC
5
- codes, and ready-made KYC / transfer / payment / merchant scenarios per
6
- country — generated on the spot, never real people.
7
-
8
- Built for QA and dev teams at African banks and fintechs (and beyond) who need
9
- test data that *passes their own format validation*. Free, no volume caps.
3
+ **Format-true synthetic test data for countries worldwide.** National IDs, tax
4
+ numbers, IBANs & SWIFT/BIC, bank accounts, phone numbers and ready-made KYC /
5
+ transfer / payment scenarios each in the correct format for its own country,
6
+ generated on the spot.
7
+
8
+ One API, dozens of countries: Kenyan KRA PINs & M-Pesa numbers, Nigerian BVNs,
9
+ German & Gulf IBANs, Italian Codice Fiscale, Brazilian CPF/CNPJ, Mexican CLABE,
10
+ Turkish TCKN, Singapore NRIC — and many more, each shaped to its national rules
11
+ (checksums, prefixes, bank codes).
12
+
13
+ > **Every value is entirely synthetic.** It matches the real *format* only and
14
+ > corresponds to no real person, account, or registered number. Never present
15
+ > any output as a genuine ID, tax number, IBAN, or bank account.
16
+
17
+ Built for QA and CI at banks and fintechs anywhere — test data that *passes
18
+ your own format validation*. Free, no volume caps.
10
19
  The engine behind [Sampuli](https://sampuli.site).
11
20
 
12
21
  ```bash
@@ -18,26 +27,31 @@ npm install @sampuli/data
18
27
  ```js
19
28
  import { generate, generateMany, listPacks } from '@sampuli/data'
20
29
 
21
- listPacks() // ['KE','DZ','AO', 'FR','NL','BR', …] — every Sampuli country
30
+ listPacks() // every installed country, e.g.
31
+ // ['KE','NG','ZA','EG','DE','FR','IT','TR','SA','BR','MX','SG', …]
22
32
 
23
- generate('ke.phone') // '0712345678' (a real Safaricom/Airtel/Telkom prefix)
24
- generate('ke.kra_pin') // → 'A123456789Z' (valid KRA PIN format)
25
- generate('ng.person') // → a coherent Nigerian record
26
- generate('za.person') // → a coherent South African record
33
+ // One value the spec is `country.field`:
34
+ generate('ke.phone') // Kenya → '0712345678'
35
+ generate('ng.bvn') // Nigeria '22803022407'
36
+ generate('de.account') // Germany 'DE19100900004650895069' (IBAN)
37
+ generate('it.id') // Italy → 'LNEFRC90M22F205G' (Codice Fiscale)
38
+ generate('sg.id') // Singapore → 'S6763250H' (NRIC)
27
39
 
28
- generate('ke.person')
40
+ // A whole coherent record — any country:
41
+ generate('de.person')
29
42
  // → {
30
- // name: 'Mercy Achieng', phone: '0748163920', id: '27380011',
31
- // kra: 'A661044820Q', bank: 'Equity Bank', swift: 'EQBLKENA',
32
- // account: '830155120774', amount: 'KES 12,400.00'
43
+ // name: 'Mia Zimmermann', phone: '0179 1480356', id: 'L0PYL465F',
44
+ // tax: '74259823954', bank: 'HypoVereinsbank', swift: 'HYVEDEMMXXX',
45
+ // account: 'DE68700202706388873556', amount: '€16.680,00'
33
46
  // }
34
47
 
35
- generateMany('ke.person', 200) // → 200 coherent records
48
+ generateMany('br.person', 500) // → 500 coherent Brazilian records
36
49
  ```
37
50
 
38
51
  Every pack uses the same spec shape — swap the country code. A pack's fields
39
52
  and presets vary by country; discover them with `listFields(code)` /
40
- `listPresets(code)`. (Kenya's tax id field is `kra`; most other packs use `tax`.)
53
+ `listPresets(code)`. Records stay internally coherent (bank SWIFT, gender
54
+ name, town ↔ region, email ↔ name).
41
55
 
42
56
  CommonJS works too:
43
57
 
@@ -72,6 +86,28 @@ Kenya's field keys, for example: `name`, `phone`, `id`, `kra`, `bank`,
72
86
  swift/account/amount) with locale-specific extras and presets — always check
73
87
  `listFields(code)`.
74
88
 
89
+ **Every country also has payment-card and passport fields** (off by default):
90
+ `card` (Luhn-valid PAN, scheme-correct BIN), `card_scheme` (Visa / Mastercard /
91
+ American Express), `card_expiry` (MM/YY), `card_cvv`, `passport` (number),
92
+ `passport_expiry`, and `passport_mrz` — a full ICAO-9303 TD3 machine-readable
93
+ zone with correct check digits, coherent with the record's name and gender.
94
+
95
+ ```js
96
+ generate('dk.card') // → '4536 3094 5269 0134' (Visa, Luhn-valid)
97
+ generate('gb.person', { fields: ['name', 'card', 'card_scheme', 'card_cvv', 'passport'] })
98
+ generate('za.passport_mrz') // → two 44-char MRZ lines with valid ICAO check digits
99
+ ```
100
+
101
+ **And a set of cross-country extras** (also off by default): a transaction
102
+ (`txn_datetime`, `txn_type`, `txn_status`, `txn_channel`, `txn_mcc` with real
103
+ ISO-18245 codes), `ip` / `ipv6`, `licence` (driver's licence), `income`
104
+ (currency-magnitude-aware for the pack's currency), `employer`, and `country`.
105
+
106
+ ```js
107
+ generate('jp.income') // → '9,970,000 JPY' (scaled to the local currency)
108
+ generate('ke.person', { fields: ['name', 'txn_datetime', 'txn_type', 'txn_mcc', 'ip', 'income'] })
109
+ ```
110
+
75
111
  ## Choosing which fields a record has
76
112
 
77
113
  `generate('ke.person')` returns the on-by-default columns. To include the
@@ -116,18 +152,19 @@ generateMany('ke.person', 100, { seed: 'batch' }) // identical batch every run
116
152
 
117
153
  ## Scope
118
154
 
119
- Ships **all 27 Sampuli country packs**, free, with no volume caps — Africa
120
- (Kenya, Nigeria, South Africa, Egypt, Ghana, Tanzania, Uganda, Rwanda,
121
- Algeria, Angola, Morocco, Ethiopia, Côte d'Ivoire, DR Congo, Tunisia,
122
- Cameroon, Mauritius), plus Germany, Switzerland, UK, Canada, US, UAE,
123
- Australia, China, India, Japan. Try them at [sampuli.site](https://sampuli.site).
124
- Additional packs can be plugged in at runtime via `registerPack(pack)`.
155
+ Ships every Sampuli country pack, free, with no volume caps — countries across
156
+ Africa, Europe, the Middle East, Asia-Pacific and the Americas, and growing.
157
+ Call `listPacks()` for the full set installed, or browse them at
158
+ [sampuli.site](https://sampuli.site). Additional packs can be plugged in at
159
+ runtime via `registerPack(pack)`.
125
160
 
126
- ## Accuracy
161
+ ## Accuracy & synthetic data
127
162
 
128
- Every value is *format-valid*: it matches the real shape and passes standard
129
- format checks. It is entirely synthetic — invented at call time, corresponding
130
- to no real person, account, or business.
163
+ Every value is *format-correct*: it matches the real shape and passes standard
164
+ format checks. It is **entirely synthetic** — invented at call time and
165
+ corresponding to no real person, account, business, or registered number. It is
166
+ for testing only; do not present any output as a genuine KRA PIN, national ID,
167
+ tax number, IBAN, or bank account.
131
168
 
132
169
  ## License
133
170