pakdatakit 2.2.1 → 2.5.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 (154) hide show
  1. package/DATA.md +512 -34
  2. package/LICENSE +1 -1
  3. package/NOTICE +14 -0
  4. package/README.md +472 -28
  5. package/dist/address.cjs +6 -5
  6. package/dist/address.js +4 -3
  7. package/dist/bills.cjs +19 -0
  8. package/dist/bills.d.cts +63 -0
  9. package/dist/bills.d.ts +63 -0
  10. package/dist/bills.js +2 -0
  11. package/dist/{chunk-4VSGCQ6K.cjs → chunk-2OBKPYJZ.cjs} +3 -3
  12. package/dist/chunk-33GOK7EE.cjs +5312 -0
  13. package/dist/chunk-33QMFE2Z.js +21244 -0
  14. package/dist/chunk-34U2ZMHR.js +194 -0
  15. package/dist/chunk-4GSBHJX6.js +165 -0
  16. package/dist/chunk-5DDHO5Z7.cjs +565 -0
  17. package/dist/chunk-5EY5DQS7.js +51 -0
  18. package/dist/chunk-5RGX4DWF.js +559 -0
  19. package/dist/chunk-5UCRHVI4.cjs +302 -0
  20. package/dist/{chunk-TTARJWGT.js → chunk-7DY26QPN.js} +2 -2
  21. package/dist/chunk-7E7L3NYS.cjs +11 -0
  22. package/dist/{chunk-3ZA265SK.cjs → chunk-AUQFA7EE.cjs} +172 -4
  23. package/dist/{chunk-QKH7W2CC.js → chunk-B7DOQ5QF.js} +6 -5
  24. package/dist/{chunk-HBOZIITD.js → chunk-CADQM4ZN.js} +14 -14
  25. package/dist/chunk-CF6AMRBU.cjs +198 -0
  26. package/dist/chunk-CZOZB4K3.js +61 -0
  27. package/dist/{chunk-3IARSCO6.cjs → chunk-DHOP7LQX.cjs} +25 -14
  28. package/dist/chunk-E2XU6NOW.js +909 -0
  29. package/dist/chunk-E6GWBOKV.cjs +911 -0
  30. package/dist/chunk-E6HSKRAE.js +9 -0
  31. package/dist/chunk-EA3SIHYT.js +313 -0
  32. package/dist/{chunk-33FXHM2E.cjs → chunk-ESKXG7Y6.cjs} +5 -5
  33. package/dist/chunk-I7UUPD3G.cjs +21252 -0
  34. package/dist/{chunk-YPPKY5XZ.js → chunk-IBZPJS4H.js} +26 -15
  35. package/dist/chunk-IDTRFOQW.js +35 -0
  36. package/dist/{chunk-XCXFGTHW.cjs → chunk-J5ZF46NZ.cjs} +14 -14
  37. package/dist/{chunk-NZQ47NWD.js → chunk-KRYHLYN2.js} +1 -1
  38. package/dist/{chunk-RXNYY5K5.js → chunk-LQHM3ADX.js} +172 -4
  39. package/dist/{chunk-HTERSQGF.cjs → chunk-MTS6SVNP.cjs} +4 -4
  40. package/dist/chunk-OTI7HY55.js +297 -0
  41. package/dist/{chunk-6IPPANNX.js → chunk-P7LVE2TF.js} +2 -2
  42. package/dist/{chunk-47P7HILD.cjs → chunk-QFPEFD67.cjs} +9 -8
  43. package/dist/chunk-RZQJAZKC.js +22 -0
  44. package/dist/{chunk-PLDVGOKZ.js → chunk-S274QFFB.js} +2 -2
  45. package/dist/chunk-SF4ECUZ6.cjs +56 -0
  46. package/dist/chunk-SQIHFEXI.cjs +25 -0
  47. package/dist/{chunk-NAJGGUAM.cjs → chunk-TC3VRWZV.cjs} +2 -2
  48. package/dist/{chunk-U7MWHXMF.cjs → chunk-TVL6RDAU.cjs} +4 -4
  49. package/dist/chunk-UYFTXD4P.js +168 -0
  50. package/dist/{chunk-AZV45DMG.js → chunk-V2XE3NCG.js} +2 -2
  51. package/dist/chunk-XCFZKCV2.cjs +37 -0
  52. package/dist/chunk-XOTCIXY6.js +5301 -0
  53. package/dist/chunk-XVEG53NN.cjs +322 -0
  54. package/dist/chunk-YDUXIENX.cjs +172 -0
  55. package/dist/chunk-YPAWNWFD.cjs +168 -0
  56. package/dist/chunk-YQFI7W3I.cjs +65 -0
  57. package/dist/{chunk-NTD4JLDW.cjs → chunk-YTLE5K7G.cjs} +1 -1
  58. package/dist/{chunk-EMH4IP2U.js → chunk-ZRONAQBV.js} +1 -1
  59. package/dist/class-validator.cjs +65 -0
  60. package/dist/class-validator.d.cts +63 -0
  61. package/dist/class-validator.d.ts +63 -0
  62. package/dist/class-validator.js +54 -0
  63. package/dist/cli.js +1 -1
  64. package/dist/courier.cjs +16 -0
  65. package/dist/courier.d.cts +51 -0
  66. package/dist/courier.d.ts +51 -0
  67. package/dist/courier.js +3 -0
  68. package/dist/fbr-invoice.cjs +25 -0
  69. package/dist/fbr-invoice.d.cts +170 -0
  70. package/dist/fbr-invoice.d.ts +170 -0
  71. package/dist/fbr-invoice.js +4 -0
  72. package/dist/geo.cjs +23 -6
  73. package/dist/geo.d.cts +56 -1
  74. package/dist/geo.d.ts +56 -1
  75. package/dist/geo.js +2 -1
  76. package/dist/holidays.cjs +4 -4
  77. package/dist/holidays.js +1 -1
  78. package/dist/iban.cjs +5 -5
  79. package/dist/iban.d.cts +8 -6
  80. package/dist/iban.d.ts +8 -6
  81. package/dist/iban.js +1 -1
  82. package/dist/incometax.cjs +27 -0
  83. package/dist/incometax.d.cts +91 -0
  84. package/dist/incometax.d.ts +91 -0
  85. package/dist/incometax.js +2 -0
  86. package/dist/index.cjs +253 -111
  87. package/dist/index.d.cts +12 -4
  88. package/dist/index.d.ts +12 -4
  89. package/dist/index.js +25 -15
  90. package/dist/input.cjs +9 -9
  91. package/dist/input.js +3 -3
  92. package/dist/joi.cjs +43 -0
  93. package/dist/joi.d.cts +25 -0
  94. package/dist/joi.d.ts +25 -0
  95. package/dist/joi.js +37 -0
  96. package/dist/networks.cjs +3 -3
  97. package/dist/networks.js +2 -2
  98. package/dist/numbers.cjs +6 -6
  99. package/dist/numbers.js +2 -2
  100. package/dist/passport.cjs +11 -0
  101. package/dist/passport.d.cts +27 -0
  102. package/dist/passport.d.ts +27 -0
  103. package/dist/passport.js +2 -0
  104. package/dist/phone.cjs +8 -8
  105. package/dist/phone.js +3 -3
  106. package/dist/postal.cjs +14 -6
  107. package/dist/postal.d.cts +54 -2
  108. package/dist/postal.d.ts +54 -2
  109. package/dist/postal.js +1 -1
  110. package/dist/quality.cjs +25 -0
  111. package/dist/quality.d.cts +62 -0
  112. package/dist/quality.d.ts +62 -0
  113. package/dist/quality.js +8 -0
  114. package/dist/raast.cjs +6 -6
  115. package/dist/raast.js +2 -2
  116. package/dist/salestax.cjs +20 -0
  117. package/dist/salestax.d.cts +106 -0
  118. package/dist/salestax.d.ts +106 -0
  119. package/dist/salestax.js +3 -0
  120. package/dist/superstruct.cjs +41 -0
  121. package/dist/superstruct.d.cts +25 -0
  122. package/dist/superstruct.d.ts +25 -0
  123. package/dist/superstruct.js +39 -0
  124. package/dist/text.cjs +21 -5
  125. package/dist/text.d.cts +90 -1
  126. package/dist/text.d.ts +90 -1
  127. package/dist/text.js +1 -1
  128. package/dist/valibot.cjs +18 -8
  129. package/dist/valibot.d.cts +3 -0
  130. package/dist/valibot.d.ts +3 -0
  131. package/dist/valibot.js +17 -7
  132. package/dist/vehicle.cjs +15 -0
  133. package/dist/vehicle.d.cts +43 -0
  134. package/dist/vehicle.d.ts +43 -0
  135. package/dist/vehicle.js +2 -0
  136. package/dist/whatsapp.cjs +3 -3
  137. package/dist/whatsapp.js +2 -2
  138. package/dist/yup.cjs +18 -8
  139. package/dist/yup.d.cts +3 -0
  140. package/dist/yup.d.ts +3 -0
  141. package/dist/yup.js +17 -7
  142. package/dist/zod.cjs +18 -8
  143. package/dist/zod.d.cts +3 -0
  144. package/dist/zod.d.ts +3 -0
  145. package/dist/zod.js +17 -7
  146. package/package.json +167 -6
  147. package/dist/chunk-34CJGJ67.cjs +0 -1697
  148. package/dist/chunk-4VVFS6FN.cjs +0 -715
  149. package/dist/chunk-E6DT2DWQ.js +0 -1689
  150. package/dist/chunk-GJENL6VK.cjs +0 -22
  151. package/dist/chunk-HUQY2WR5.js +0 -20
  152. package/dist/chunk-JKE4AMSZ.js +0 -47
  153. package/dist/chunk-KEHCTYLO.cjs +0 -52
  154. package/dist/chunk-LIYNKIKS.js +0 -709
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Kind of electricity bill identifier.
3
+ *
4
+ * - `reference`: the 14-digit reference number on a DISCO (WAPDA) bill,
5
+ * optionally followed by `U` (urban) or `R` (rural).
6
+ * - `customer-id`: the customer ID on a DISCO bill: 10 digits, or 11 for
7
+ * LESCO.
8
+ * - `k-electric`: a 13-digit K-Electric account number (`04000…`).
9
+ */
10
+ type ElectricityRefType = 'reference' | 'customer-id' | 'k-electric';
11
+ /** Result of {@link parseElectricityRef}. */
12
+ interface ElectricityRef {
13
+ type: ElectricityRefType;
14
+ /** The digits, without separators or the U/R letter. */
15
+ digits: string;
16
+ /**
17
+ * Display form: `01 14111 1234567 U` for a reference (2, 5 and 7 digits,
18
+ * as on PITC's bill illustration), the digits for the others.
19
+ */
20
+ formatted: string;
21
+ /** `U` or `R` when given after a reference number, otherwise `null`. */
22
+ urbanRural: 'U' | 'R' | null;
23
+ /**
24
+ * The distribution company. `K-Electric` for a K-Electric account;
25
+ * otherwise always `null`, because no official source maps reference or
26
+ * customer ID digits to a DISCO.
27
+ */
28
+ disco: 'K-Electric' | null;
29
+ }
30
+ /**
31
+ * Parses a Pakistani electricity bill identifier: a DISCO reference number,
32
+ * a DISCO customer ID or a K-Electric account number.
33
+ *
34
+ * Formats are those the utilities' own bill pages ask for (retrieved
35
+ * 2026-11-18; see DATA.md): PITC's bill pages take a 14-digit reference
36
+ * number with a separate U/R choice, or a 10-digit customer ID (11 digits
37
+ * for LESCO); K-Electric asks for a "13 digits KE Account Number starting
38
+ * from 04000". No check digit is published, so only the format is checked.
39
+ *
40
+ * Spaces, dashes and dots are ignored, and Urdu digits are accepted.
41
+ *
42
+ * @returns The identifier, or `null` if it matches none of the formats.
43
+ * Never throws.
44
+ */
45
+ declare function parseElectricityRef(input: string): ElectricityRef | null;
46
+ /**
47
+ * Validates a Pakistani electricity bill identifier. See
48
+ * {@link parseElectricityRef}.
49
+ */
50
+ declare function validateElectricityRef(input: string): boolean;
51
+ /** A gas company whose consumer number format is published. */
52
+ type GasCompany = 'SNGPL' | 'SSGC';
53
+ /**
54
+ * Validates a gas bill consumer number: 11 digits for SNGPL, 10 digits for
55
+ * SSGC, as their bill pages ask for (retrieved 2026-11-18; see DATA.md). No
56
+ * check digit is published, so only the format is checked.
57
+ *
58
+ * @param company - `SNGPL` or `SSGC`; anything else returns `false`
59
+ */
60
+ declare function validateGasConsumerNumber(input: string, company: GasCompany): boolean;
61
+
62
+ export { parseElectricityRef, validateElectricityRef, validateGasConsumerNumber };
63
+ export type { ElectricityRef, ElectricityRefType, GasCompany };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Kind of electricity bill identifier.
3
+ *
4
+ * - `reference`: the 14-digit reference number on a DISCO (WAPDA) bill,
5
+ * optionally followed by `U` (urban) or `R` (rural).
6
+ * - `customer-id`: the customer ID on a DISCO bill: 10 digits, or 11 for
7
+ * LESCO.
8
+ * - `k-electric`: a 13-digit K-Electric account number (`04000…`).
9
+ */
10
+ type ElectricityRefType = 'reference' | 'customer-id' | 'k-electric';
11
+ /** Result of {@link parseElectricityRef}. */
12
+ interface ElectricityRef {
13
+ type: ElectricityRefType;
14
+ /** The digits, without separators or the U/R letter. */
15
+ digits: string;
16
+ /**
17
+ * Display form: `01 14111 1234567 U` for a reference (2, 5 and 7 digits,
18
+ * as on PITC's bill illustration), the digits for the others.
19
+ */
20
+ formatted: string;
21
+ /** `U` or `R` when given after a reference number, otherwise `null`. */
22
+ urbanRural: 'U' | 'R' | null;
23
+ /**
24
+ * The distribution company. `K-Electric` for a K-Electric account;
25
+ * otherwise always `null`, because no official source maps reference or
26
+ * customer ID digits to a DISCO.
27
+ */
28
+ disco: 'K-Electric' | null;
29
+ }
30
+ /**
31
+ * Parses a Pakistani electricity bill identifier: a DISCO reference number,
32
+ * a DISCO customer ID or a K-Electric account number.
33
+ *
34
+ * Formats are those the utilities' own bill pages ask for (retrieved
35
+ * 2026-11-18; see DATA.md): PITC's bill pages take a 14-digit reference
36
+ * number with a separate U/R choice, or a 10-digit customer ID (11 digits
37
+ * for LESCO); K-Electric asks for a "13 digits KE Account Number starting
38
+ * from 04000". No check digit is published, so only the format is checked.
39
+ *
40
+ * Spaces, dashes and dots are ignored, and Urdu digits are accepted.
41
+ *
42
+ * @returns The identifier, or `null` if it matches none of the formats.
43
+ * Never throws.
44
+ */
45
+ declare function parseElectricityRef(input: string): ElectricityRef | null;
46
+ /**
47
+ * Validates a Pakistani electricity bill identifier. See
48
+ * {@link parseElectricityRef}.
49
+ */
50
+ declare function validateElectricityRef(input: string): boolean;
51
+ /** A gas company whose consumer number format is published. */
52
+ type GasCompany = 'SNGPL' | 'SSGC';
53
+ /**
54
+ * Validates a gas bill consumer number: 11 digits for SNGPL, 10 digits for
55
+ * SSGC, as their bill pages ask for (retrieved 2026-11-18; see DATA.md). No
56
+ * check digit is published, so only the format is checked.
57
+ *
58
+ * @param company - `SNGPL` or `SSGC`; anything else returns `false`
59
+ */
60
+ declare function validateGasConsumerNumber(input: string, company: GasCompany): boolean;
61
+
62
+ export { parseElectricityRef, validateElectricityRef, validateGasConsumerNumber };
63
+ export type { ElectricityRef, ElectricityRefType, GasCompany };
package/dist/bills.js ADDED
@@ -0,0 +1,2 @@
1
+ export { parseElectricityRef, validateElectricityRef, validateGasConsumerNumber } from './chunk-CZOZB4K3.js';
2
+ 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,