pakdatakit 2.2.0 → 2.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 (125) hide show
  1. package/DATA.md +306 -36
  2. package/README.md +178 -30
  3. package/dist/address.cjs +5 -5
  4. package/dist/address.d.cts +2 -1
  5. package/dist/address.d.ts +2 -1
  6. package/dist/address.js +3 -3
  7. package/dist/{chunk-4VSGCQ6K.cjs → chunk-2OBKPYJZ.cjs} +3 -3
  8. package/dist/chunk-33QMFE2Z.js +21244 -0
  9. package/dist/chunk-7E7L3NYS.cjs +11 -0
  10. package/dist/{chunk-TTARJWGT.js → chunk-A3HBEBXY.js} +2 -2
  11. package/dist/{chunk-3ZA265SK.cjs → chunk-AUQFA7EE.cjs} +172 -4
  12. package/dist/{chunk-HBOZIITD.js → chunk-CADQM4ZN.js} +14 -14
  13. package/dist/{chunk-3IARSCO6.cjs → chunk-DHOP7LQX.cjs} +25 -14
  14. package/dist/chunk-E6HSKRAE.js +9 -0
  15. package/dist/{chunk-33FXHM2E.cjs → chunk-ESKXG7Y6.cjs} +5 -5
  16. package/dist/{chunk-U7MWHXMF.cjs → chunk-FRBPAGEJ.cjs} +4 -4
  17. package/dist/chunk-I7UUPD3G.cjs +21252 -0
  18. package/dist/{chunk-YPPKY5XZ.js → chunk-IBZPJS4H.js} +26 -15
  19. package/dist/{chunk-CLL6VDPO.cjs → chunk-J5ARB4TE.cjs} +8 -8
  20. package/dist/{chunk-XCXFGTHW.cjs → chunk-J5ZF46NZ.cjs} +14 -14
  21. package/dist/{chunk-NZQ47NWD.js → chunk-KRYHLYN2.js} +1 -1
  22. package/dist/{chunk-RXNYY5K5.js → chunk-LQHM3ADX.js} +172 -4
  23. package/dist/{chunk-HTERSQGF.cjs → chunk-MTS6SVNP.cjs} +4 -4
  24. package/dist/chunk-N4S22XX3.js +6208 -0
  25. package/dist/chunk-OKMBYX3F.cjs +6220 -0
  26. package/dist/{chunk-6IPPANNX.js → chunk-P7LVE2TF.js} +2 -2
  27. package/dist/chunk-RZQJAZKC.js +22 -0
  28. package/dist/{chunk-PLDVGOKZ.js → chunk-S274QFFB.js} +2 -2
  29. package/dist/chunk-SQIHFEXI.cjs +25 -0
  30. package/dist/chunk-TBTWZC74.cjs +32 -0
  31. package/dist/{chunk-NAJGGUAM.cjs → chunk-TC3VRWZV.cjs} +2 -2
  32. package/dist/{chunk-I664KOWP.js → chunk-TQP2T33V.js} +5 -5
  33. package/dist/{chunk-AZV45DMG.js → chunk-V2XE3NCG.js} +2 -2
  34. package/dist/{chunk-NTD4JLDW.cjs → chunk-YTLE5K7G.cjs} +1 -1
  35. package/dist/{chunk-HUQY2WR5.js → chunk-YTSMFGTW.js} +13 -3
  36. package/dist/{chunk-EMH4IP2U.js → chunk-ZRONAQBV.js} +1 -1
  37. package/dist/class-validator.cjs +57 -0
  38. package/dist/class-validator.d.cts +57 -0
  39. package/dist/class-validator.d.ts +57 -0
  40. package/dist/class-validator.js +47 -0
  41. package/dist/cli.js +1 -1
  42. package/dist/cnic.d.cts +2 -1
  43. package/dist/cnic.d.ts +2 -1
  44. package/dist/geo.cjs +22 -6
  45. package/dist/geo.d.cts +56 -1
  46. package/dist/geo.d.ts +56 -1
  47. package/dist/geo.js +1 -1
  48. package/dist/hijri.d.cts +2 -1
  49. package/dist/hijri.d.ts +2 -1
  50. package/dist/holidays.cjs +4 -4
  51. package/dist/holidays.d.cts +2 -1
  52. package/dist/holidays.d.ts +2 -1
  53. package/dist/holidays.js +1 -1
  54. package/dist/iban.cjs +5 -5
  55. package/dist/iban.d.cts +10 -7
  56. package/dist/iban.d.ts +10 -7
  57. package/dist/iban.js +1 -1
  58. package/dist/index.cjs +106 -68
  59. package/dist/index.d.cts +5 -3
  60. package/dist/index.d.ts +5 -3
  61. package/dist/index.js +16 -14
  62. package/dist/input.cjs +9 -9
  63. package/dist/input.d.cts +2 -1
  64. package/dist/input.d.ts +2 -1
  65. package/dist/input.js +3 -3
  66. package/dist/joi.cjs +37 -0
  67. package/dist/joi.d.cts +24 -0
  68. package/dist/joi.d.ts +24 -0
  69. package/dist/joi.js +31 -0
  70. package/dist/networks.cjs +3 -3
  71. package/dist/networks.d.cts +2 -1
  72. package/dist/networks.d.ts +2 -1
  73. package/dist/networks.js +2 -2
  74. package/dist/numbers.cjs +6 -6
  75. package/dist/numbers.d.cts +2 -1
  76. package/dist/numbers.d.ts +2 -1
  77. package/dist/numbers.js +2 -2
  78. package/dist/passport.cjs +11 -0
  79. package/dist/passport.d.cts +27 -0
  80. package/dist/passport.d.ts +27 -0
  81. package/dist/passport.js +2 -0
  82. package/dist/phone.cjs +8 -8
  83. package/dist/phone.d.cts +2 -1
  84. package/dist/phone.d.ts +2 -1
  85. package/dist/phone.js +3 -3
  86. package/dist/postal.cjs +14 -6
  87. package/dist/postal.d.cts +54 -2
  88. package/dist/postal.d.ts +54 -2
  89. package/dist/postal.js +1 -1
  90. package/dist/raast.cjs +6 -6
  91. package/dist/raast.d.cts +2 -1
  92. package/dist/raast.d.ts +2 -1
  93. package/dist/raast.js +2 -2
  94. package/dist/superstruct.cjs +35 -0
  95. package/dist/superstruct.d.cts +24 -0
  96. package/dist/superstruct.d.ts +24 -0
  97. package/dist/superstruct.js +33 -0
  98. package/dist/tax.d.cts +2 -1
  99. package/dist/tax.d.ts +2 -1
  100. package/dist/valibot.cjs +12 -8
  101. package/dist/valibot.d.cts +2 -0
  102. package/dist/valibot.d.ts +2 -0
  103. package/dist/valibot.js +11 -7
  104. package/dist/vehicle.cjs +15 -0
  105. package/dist/vehicle.d.cts +43 -0
  106. package/dist/vehicle.d.ts +43 -0
  107. package/dist/vehicle.js +2 -0
  108. package/dist/whatsapp.cjs +3 -3
  109. package/dist/whatsapp.js +2 -2
  110. package/dist/words.d.cts +2 -1
  111. package/dist/words.d.ts +2 -1
  112. package/dist/yup.cjs +12 -8
  113. package/dist/yup.d.cts +2 -0
  114. package/dist/yup.d.ts +2 -0
  115. package/dist/yup.js +11 -7
  116. package/dist/zod.cjs +12 -8
  117. package/dist/zod.d.cts +2 -0
  118. package/dist/zod.d.ts +2 -0
  119. package/dist/zod.js +11 -7
  120. package/package.json +109 -11
  121. package/dist/chunk-4VVFS6FN.cjs +0 -715
  122. package/dist/chunk-GJENL6VK.cjs +0 -22
  123. package/dist/chunk-J272OMDL.js +0 -1687
  124. package/dist/chunk-LIYNKIKS.js +0 -709
  125. package/dist/chunk-SBS2GHM3.cjs +0 -1695
package/README.md CHANGED
@@ -43,13 +43,20 @@ Validate CNICs, analyze phone numbers, detect networks, build WhatsApp links, ch
43
43
 
44
44
  ## 📦 Packages
45
45
 
46
- | Package | Install | For |
47
- | --------------------------------------------------------------------------------- | ------------------------------ | -------------------------------------------------------------- |
48
- | [`pakdatakit`](https://www.npmjs.com/package/pakdatakit) | `npm install pakdatakit` | JavaScript and TypeScript (Node, browsers, Bun, Deno) |
49
- | [`pakdatakit` (Python)](https://github.com/chmuzamil/pakdatakit/tree/main/python) | `pip install pakdatakit` | Python 3.9+, same functions in snake_case, same data |
50
- | [`pakdatakit-react`](https://github.com/chmuzamil/pakdatakit/tree/main/react) | `npm install pakdatakit-react` | React inputs that format as you type, and a Raast QR component |
51
-
52
- The Python package is checked against the TypeScript library with over 12,000 shared test cases, so both give the same results.
46
+ | Package | Install | For |
47
+ | ------------------------------------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------- |
48
+ | [`pakdatakit`](https://www.npmjs.com/package/pakdatakit) | `npm install pakdatakit` | JavaScript and TypeScript (Node, browsers, Bun, Deno) |
49
+ | [`pakdatakit` (Python)](https://github.com/chmuzamil/pakdatakit/tree/main/python) | `pip install pakdatakit` | Python 3.9+, same functions in snake_case, same data |
50
+ | [`pakdatakit-react`](https://github.com/chmuzamil/pakdatakit/tree/main/react) | `npm install pakdatakit-react` | React inputs that format as you type, and a Raast QR component |
51
+ | [`pakdatakit-faker`](https://github.com/chmuzamil/pakdatakit/tree/main/faker) | `npm install -D pakdatakit-faker` | Seeded mock data: CNICs, phones, IBANs, addresses and whole personas that pass every validator |
52
+ | [`pakdatakit` (Dart)](https://github.com/chmuzamil/pakdatakit/tree/main/dart) | `dart pub add pakdatakit` | Dart and Flutter (including web), same functions and data |
53
+ | [`pakdatakit_flutter`](https://github.com/chmuzamil/pakdatakit/tree/main/flutter) | `flutter pub add pakdatakit_flutter` | Flutter input formatters, form fields and a Raast QR widget |
54
+ | [`PakDataKit` (.NET)](https://github.com/chmuzamil/pakdatakit/tree/main/dotnet) | Build from `dotnet/` (not on NuGet yet) | .NET 8, same functions and data, with DataAnnotations and FluentValidation packages |
55
+ | [`chmuzamil/pakdatakit` (PHP)](https://github.com/chmuzamil/pakdatakit/tree/main/php) | Build from `php/` (not on Packagist yet) | PHP 8.2+, same functions and data, with Laravel rules, rule objects and Eloquent casts |
56
+ | [`pakdatakit-vue`](https://github.com/chmuzamil/pakdatakit/tree/main/vue) | Build from `vue/` (not on npm yet) | Vue 3 composables and a `v-pak-input` directive that format as you type |
57
+ | [`pakdatakit-angular`](https://github.com/chmuzamil/pakdatakit/tree/main/angular) | Build from `angular/` (not on npm yet) | Angular directives, pipes and form validators |
58
+
59
+ The Python, Dart, .NET and PHP packages are checked against the TypeScript library with over 12,000 shared test cases, so all five give the same results.
53
60
 
54
61
  ---
55
62
 
@@ -63,20 +70,22 @@ The Python package is checked against the TypeScript library with over 12,000 sh
63
70
 
64
71
  ## Why PakDataKit?
65
72
 
66
- Every Pakistani application eventually needs to solve the same problems:
67
-
68
- - Validate CNIC numbers
69
- - Normalize mobile numbers
70
- - Detect mobile networks
71
- - Generate WhatsApp click-to-chat links
72
- - Validate Pakistani IBANs and detect banks
73
- - Look up postal codes and cities
74
- - Map cities to provinces
75
- - Format PKR values in Lakh and Crore conventions
73
+ Most Pakistani apps validate CNICs, mobile numbers and IBANs with a regex copied from somewhere. A regex checks the shape. PakDataKit checks what the shape can't show:
76
74
 
77
- Most teams implement these repeatedly.
75
+ | Task | Typical regex | PakDataKit |
76
+ | ----------------- | ---------------------------- | ----------------------------------------------------------------------------------------------- |
77
+ | CNIC | 13 digits, maybe with dashes | Province code, province and gender decoding, Urdu digits |
78
+ | Mobile number | `03` + 9 digits | Allocated `03XX` prefixes only, `+92` / `0092` / `0` forms, original network |
79
+ | IBAN | `PK` + 22 characters | Mod-97 checksum, bank name and type from the bank code |
80
+ | NTN / STRN | Digit count | CNIC-based and business NTNs, display formats |
81
+ | Passport, plates | Usually not handled | Common-shape checks, with sources and limits in [DATA.md](./DATA.md) |
82
+ | Raast QR | Not possible | Create, parse and check payment QR codes (CRC, IBAN, amount, expiry) |
83
+ | Holidays, Hijri | Not possible | Observed Eid/Ashura/Milad dates from official notifications, Hijri conversion |
84
+ | Amounts, currency | Not possible | Lakh/crore formatting, amounts in words in English and Urdu |
85
+ | Forms | Write each rule per library | Ready rules for Zod, Valibot, Yup, Joi, Superstruct and class-validator (NestJS) |
86
+ | Other languages | Rewrite it | Python and Dart packages with the core functions, checked against over 12,000 shared test cases |
78
87
 
79
- PakDataKit provides a single, typed, reusable solution so you can focus on building your product instead of rebuilding common utilities.
88
+ The npm package has no runtime dependencies, ships ESM and CommonJS with TypeScript types, and works offline: all data is bundled. Every dataset lists its sources in [DATA.md](./DATA.md).
80
89
 
81
90
  ---
82
91
 
@@ -136,7 +145,7 @@ import { validateCNIC } from 'pakdatakit/cnic';
136
145
  const { analyzePhone } = require('pakdatakit/phone');
137
146
  ```
138
147
 
139
- Subpaths: `address`, `cnic`, `format`, `geo`, `hijri`, `holidays`, `iban`, `input`, `networks`, `numbers`, `phone`, `postal`, `raast`, `tax`, `text`, `whatsapp`, `words`, plus the form adapters `zod`, `valibot` and `yup`.
148
+ Subpaths: `address`, `cnic`, `format`, `geo`, `hijri`, `holidays`, `iban`, `input`, `networks`, `numbers`, `passport`, `phone`, `postal`, `raast`, `tax`, `text`, `vehicle`, `whatsapp`, `words`, plus the form adapters `zod`, `valibot`, `yup`, `joi`, `superstruct` and `class-validator`.
140
149
 
141
150
  ---
142
151
 
@@ -393,7 +402,7 @@ getBankFromIBAN('invalid');
393
402
  // null
394
403
  ```
395
404
 
396
- Supported bank codes include HABB, MEZN, SCBL, UNIL, BAHL, NBPA, MUCB, JSBL, SADA (SadaPay), NAYA (NayaPay), RQMI (Raqami), MSHQ (Mashreq), and 48 total entries in the dataset, checked against real IBANs (see [DATA.md](./DATA.md)). Merged or renamed banks are labelled with their current name, e.g. `SAUD` → "Silkbank Limited (merged into United Bank Limited)".
405
+ Supported bank codes include HABB, MEZN, SCBL, UNIL, BAHL, NBPA, MUCB, JSBL, SADA (SadaPay), NAYA (NayaPay), RQMI (Raqami), MSHQ (Mashreq), and 50 total entries in the dataset, checked against real IBANs (see [DATA.md](./DATA.md)). Merged or renamed banks are labelled with their current name, e.g. `SAUD` → "Silkbank Limited (merged into United Bank Limited)".
397
406
 
398
407
  ---
399
408
 
@@ -401,7 +410,7 @@ Supported bank codes include HABB, MEZN, SCBL, UNIL, BAHL, NBPA, MUCB, JSBL, SAD
401
410
 
402
411
  ### getCityByPostalCode()
403
412
 
404
- Returns the city for a Pakistani postal code.
413
+ Returns the city for a Pakistani postal code. Only codes of post offices in a city on pakdatakit's city list return a city; codes of offices in other towns and villages return `null` (use `getPostOffice()` for those).
405
414
 
406
415
  ```ts
407
416
  getCityByPostalCode(postalCode: string): string | null
@@ -413,6 +422,12 @@ Examples:
413
422
  getCityByPostalCode('60000');
414
423
  // "Multan"
415
424
 
425
+ getCityByPostalCode('54660');
426
+ // "Lahore"
427
+
428
+ getCityByPostalCode('48330');
429
+ // null (a village post office; see getPostOffice)
430
+
416
431
  getCityByPostalCode('99999');
417
432
  // null
418
433
  ```
@@ -439,6 +454,30 @@ getPostalCode('karachi');
439
454
 
440
455
  ---
441
456
 
457
+ ### getPostOffice() / searchPostOffices()
458
+
459
+ Every delivery post office in Pakistan Post's directory (about 2,560), including those in towns and villages.
460
+
461
+ ```ts
462
+ getPostOffice(code: string): PostOffice | null
463
+ searchPostOffices(query: string): PostOffice[] // by office name, town or code prefix
464
+ ```
465
+
466
+ ```ts
467
+ getPostOffice('48330');
468
+ // { code: "48330", office: "Dulmial", town: "Dulmial", district: null, province: "Punjab" }
469
+
470
+ getPostOffice('54660');
471
+ // { code: "54660", office: "Lahore Gulberg Colony", town: "Lahore", district: "Lahore", province: "Punjab" }
472
+
473
+ searchPostOffices('dulmial');
474
+ // [{ code: "48330", office: "Dulmial", ... }]
475
+ ```
476
+
477
+ `town` is the city the office belongs to when that is known, and otherwise the office's own name, which is usually its town or village. `district` is only given for offices in a district's headquarters town; the directory has no district column. The directory is a separate data file (about 32 kB gzipped), so it is only bundled when you call these functions.
478
+
479
+ ---
480
+
442
481
  ## Mobile Networks
443
482
 
444
483
  ### getNetwork()
@@ -554,6 +593,43 @@ searchDistricts('karachi'); // ["Karachi Central", "Karachi East", ...]
554
593
 
555
594
  ---
556
595
 
596
+ ### getDivisions() / getDivisionOfDistrict()
597
+
598
+ The 30 administrative divisions of the 2023 census (Punjab 9, Sindh 6, Khyber Pakhtunkhwa 7, Balochistan 8).
599
+
600
+ ```ts
601
+ getDivisions('Sindh');
602
+ // ["Hyderabad", "Karachi", "Larkana", "Mirpur Khas", "Shaheed Benazirabad", "Sukkur"]
603
+
604
+ getDivisionOfDistrict('Attock'); // "Rawalpindi"
605
+ getDivisionOfDistrict('Quetta East'); // null (created after the census)
606
+ ```
607
+
608
+ ---
609
+
610
+ ### getTehsils() / getTehsilDistrict()
611
+
612
+ The 591 tehsils, talukas and sub-divisions of the 2023 census.
613
+
614
+ ```ts
615
+ getTehsils('Toba Tek Singh');
616
+ // ["Gojra", "Kamalia", "Pirmahal", "Toba Tek Singh"]
617
+
618
+ getTehsilDistrict('Gojra'); // "Toba Tek Singh"
619
+ getTehsilDistrict('Khanpur'); // null (three districts have a Khanpur)
620
+ getTehsilDistrict('Khanpur', 'Sindh'); // "Shikarpur"
621
+ ```
622
+
623
+ **Census districts.** Every tehsil is recorded under the district it was in at the 2023 census, which had 136 districts. Districts created or split since then (Murree, Talagang, Quetta East and West, and others) are handled like this:
624
+
625
+ - `getTehsils('Rawalpindi')` still lists Murree, as the census did.
626
+ - `getTehsils('Murree')` lists only the tehsils an official source places in the new district (Kotli Sattian and Murree). Where no official list could be found, as for `Quetta East`, it is empty.
627
+ - `getTehsilDistrict()` and `getDivisionOfDistrict()` answer with census names: `Quetta`, not Quetta East or Quetta West.
628
+
629
+ Azad Jammu and Kashmir and Gilgit-Baltistan are not in the census tables, so they have no divisions or tehsils here. See [DATA.md](./DATA.md).
630
+
631
+ ---
632
+
557
633
  ## Address Utilities
558
634
 
559
635
  ### parseAddress()
@@ -707,6 +783,38 @@ FBR does not publish its check-digit algorithms, so these check the format only.
707
783
 
708
784
  ---
709
785
 
786
+ ## Passports & Vehicle Plates
787
+
788
+ ### validatePassport()
789
+
790
+ Checks the format of a Pakistani passport number: two letters and seven digits.
791
+
792
+ ```ts
793
+ validatePassport('AB1234567'); // true
794
+ validatePassport('ab 1234567'); // true
795
+ validatePassport('A12345678'); // false
796
+ ```
797
+
798
+ DGIP does not publish the format, so this checks the common shape only. Other passport types may differ; see [DATA.md](./DATA.md#passport-numbers).
799
+
800
+ ### parseVehiclePlate() / validateVehiclePlate()
801
+
802
+ Splits a vehicle registration number into its series letters, number and the optional year that older Punjab plates carry.
803
+
804
+ ```ts
805
+ parseVehiclePlate('lea 1234');
806
+ // { series: 'LEA', number: '1234', year: null, formatted: 'LEA-1234' }
807
+
808
+ parseVehiclePlate('LEA-1234-19');
809
+ // { series: 'LEA', number: '1234', year: '19', formatted: 'LEA-1234' }
810
+
811
+ validateVehiclePlate('ABC-123'); // true
812
+ ```
813
+
814
+ Each province sets its own format and several changed in 2024–2026, so this accepts the shape they share (1–4 letters, then 1–4 digits) and does not check series letters against districts. See [DATA.md](./DATA.md#vehicle-registration-plates).
815
+
816
+ ---
817
+
710
818
  ## Raast QR Codes
711
819
 
712
820
  ### createRaastP2PQr() / createMerchantQr() / parseRaastQr()
@@ -739,9 +847,7 @@ parseRaastQr(payload);
739
847
  createMerchantQr({
740
848
  merchantAccount: {
741
849
  tag: '28',
742
- fields: {
743
- /* sub-fields from your bank */
744
- },
850
+ fields: {/* sub-fields from your bank */},
745
851
  },
746
852
  merchantName: 'Aziz General Store',
747
853
  city: 'Karachi',
@@ -801,7 +907,7 @@ Fixed holidays follow the year they applied in: Iqbal Day was restored in 2022 a
801
907
 
802
908
  ## Form Validation
803
909
 
804
- Ready-made schemas for [Zod](https://zod.dev), [Valibot](https://valibot.dev) and [Yup](https://github.com/jquense/yup). Install the library you use; PakDataKit does not depend on any of them.
910
+ Ready-made schemas for [Zod](https://zod.dev), [Valibot](https://valibot.dev), [Yup](https://github.com/jquense/yup), [Joi](https://joi.dev) and [Superstruct](https://docs.superstructjs.org), and decorators for [class-validator](https://github.com/typestack/class-validator) (and so NestJS). Install the library you use; PakDataKit does not depend on any of them.
805
911
 
806
912
  ```ts
807
913
  import { z } from 'zod';
@@ -828,7 +934,47 @@ import { pk } from 'pakdatakit/yup';
828
934
  const CheckoutForm = object({ cnic: pk.cnic().required(), phone: pk.phone() });
829
935
  ```
830
936
 
831
- Available schemas: `pk.cnic()`, `pk.phone()`, `pk.iban()`, `pk.ntn()`, `pk.strn()` and `pk.landline()`. Every factory accepts `{ message }` to replace the default error. The Yup schemas let empty values pass so `.required()` decides whether a field is mandatory.
937
+ ```ts
938
+ import Joi from 'joi';
939
+ import { pk } from 'pakdatakit/joi';
940
+
941
+ const CheckoutForm = Joi.object({
942
+ cnic: pk.cnic().required(),
943
+ phone: pk.phone(),
944
+ });
945
+ ```
946
+
947
+ ```ts
948
+ import { object, optional } from 'superstruct';
949
+ import { pk } from 'pakdatakit/superstruct';
950
+
951
+ const CheckoutForm = object({ cnic: pk.cnic(), phone: optional(pk.phone()) });
952
+ ```
953
+
954
+ Available schemas: `pk.cnic()`, `pk.phone()`, `pk.iban()`, `pk.ntn()`, `pk.strn()`, `pk.landline()`, `pk.passport()` and `pk.vehiclePlate()`. Every factory accepts `{ message }` to replace the default error. The Yup schemas let empty values pass so `.required()` decides whether a field is mandatory.
955
+
956
+ ### class-validator and NestJS
957
+
958
+ Decorators for DTOs, checked by NestJS's `ValidationPipe` like any other class-validator rule. No NestJS package is needed.
959
+
960
+ ```ts
961
+ import { IsOptional } from 'class-validator';
962
+ import { IsCNIC, IsPakIBAN, IsPakPhone } from 'pakdatakit/class-validator';
963
+
964
+ export class CreateCustomerDto {
965
+ @IsCNIC()
966
+ cnic!: string;
967
+
968
+ @IsOptional()
969
+ @IsPakPhone({ message: 'Enter a Pakistani mobile number' })
970
+ phone?: string;
971
+
972
+ @IsPakIBAN()
973
+ iban!: string;
974
+ }
975
+ ```
976
+
977
+ Decorators: `IsCNIC`, `IsPakPhone`, `IsPakIBAN` (named so it doesn't clash with class-validator's own `IsIBAN`), `IsNTN`, `IsSTRN`, `IsPakLandline`, `IsPakPassport` and `IsVehiclePlate`, also available as `pk.cnic()` and so on. They accept class-validator's options (`message`, `groups`, `each`, `always`); use `@IsOptional()` for optional fields. Values that are not strings fail.
832
978
 
833
979
  ### As-you-type helpers
834
980
 
@@ -963,10 +1109,12 @@ const budget = formatLakh(2500000);
963
1109
  - Raast QR codes
964
1110
  - Public holidays with observed moon-sighting dates
965
1111
 
966
- ### Planned
1112
+ ### v2.2 ✅
967
1113
 
968
- - CNIC check-digit validation (pending a publicly documented NADRA algorithm)
969
- - Mobile Number Portability lookup API
1114
+ - Python package on PyPI, Dart package on pub.dev
1115
+ - `pakdatakit-react` form inputs, `pakdatakit-faker` test data and
1116
+ `pakdatakit_flutter` widgets
1117
+ - Bank details (`getBankInfo`, `getBanks`), API docs and `llms.txt`
970
1118
 
971
1119
  ---
972
1120
 
package/dist/address.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunkCLL6VDPO_cjs = require('./chunk-CLL6VDPO.cjs');
4
- require('./chunk-4VVFS6FN.cjs');
5
- require('./chunk-SBS2GHM3.cjs');
3
+ var chunkJ5ARB4TE_cjs = require('./chunk-J5ARB4TE.cjs');
4
+ require('./chunk-I7UUPD3G.cjs');
5
+ require('./chunk-OKMBYX3F.cjs');
6
6
  require('./chunk-VPBMIYO2.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "formatAddress", {
11
11
  enumerable: true,
12
- get: function () { return chunkCLL6VDPO_cjs.formatAddress; }
12
+ get: function () { return chunkJ5ARB4TE_cjs.formatAddress; }
13
13
  });
14
14
  Object.defineProperty(exports, "parseAddress", {
15
15
  enumerable: true,
16
- get: function () { return chunkCLL6VDPO_cjs.parseAddress; }
16
+ get: function () { return chunkJ5ARB4TE_cjs.parseAddress; }
17
17
  });
@@ -33,4 +33,5 @@ declare function formatAddress(parts: Partial<ParsedAddress> & {
33
33
  raw?: string;
34
34
  }): string;
35
35
 
36
- export { type ParsedAddress, formatAddress, parseAddress };
36
+ export { formatAddress, parseAddress };
37
+ export type { ParsedAddress };
package/dist/address.d.ts CHANGED
@@ -33,4 +33,5 @@ declare function formatAddress(parts: Partial<ParsedAddress> & {
33
33
  raw?: string;
34
34
  }): string;
35
35
 
36
- export { type ParsedAddress, formatAddress, parseAddress };
36
+ export { formatAddress, parseAddress };
37
+ export type { ParsedAddress };
package/dist/address.js CHANGED
@@ -1,4 +1,4 @@
1
- export { formatAddress, parseAddress } from './chunk-I664KOWP.js';
2
- import './chunk-LIYNKIKS.js';
3
- import './chunk-J272OMDL.js';
1
+ export { formatAddress, parseAddress } from './chunk-TQP2T33V.js';
2
+ import './chunk-33QMFE2Z.js';
3
+ import './chunk-N4S22XX3.js';
4
4
  import './chunk-ENQ7O7VW.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3IARSCO6_cjs = require('./chunk-3IARSCO6.cjs');
3
+ var chunkDHOP7LQX_cjs = require('./chunk-DHOP7LQX.cjs');
4
4
  var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
  // src/internal/emv.ts
@@ -115,7 +115,7 @@ function checkLength(value, max, label) {
115
115
  }
116
116
  function normalizeIban(iban) {
117
117
  const normalized = chunkVPBMIYO2_cjs.stripSeparators(iban).toUpperCase();
118
- if (!chunk3IARSCO6_cjs.validateIBAN(normalized)) {
118
+ if (!chunkDHOP7LQX_cjs.validateIBAN(normalized)) {
119
119
  throw new RangeError(`Invalid Pakistani IBAN: ${iban}`);
120
120
  }
121
121
  return normalized;
@@ -279,7 +279,7 @@ function parseRaastQr(payload) {
279
279
  dynamic: fieldValue(fields, "01") === "12",
280
280
  crcValid,
281
281
  iban,
282
- ibanValid: iban !== null && chunk3IARSCO6_cjs.validateIBAN(iban),
282
+ ibanValid: iban !== null && chunkDHOP7LQX_cjs.validateIBAN(iban),
283
283
  amount: toAmount(fieldValue(fields, kind === "p2p" ? "05" : "54")),
284
284
  expiresAt: parseExpiry(expiry),
285
285
  bankName: kind === "p2p" ? fieldValue(fields, "03") : null,