pakdatakit 2.1.2 → 2.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 (68) hide show
  1. package/DATA.md +104 -0
  2. package/README.md +85 -3
  3. package/dist/address.cjs +4 -4
  4. package/dist/address.js +2 -2
  5. package/dist/{chunk-PHHKIMO2.cjs → chunk-33FXHM2E.cjs} +5 -5
  6. package/dist/chunk-3IARSCO6.cjs +317 -0
  7. package/dist/{chunk-BSS4Z7NI.cjs → chunk-3ZA265SK.cjs} +2 -2
  8. package/dist/{chunk-Q7XHVR3U.cjs → chunk-4VSGCQ6K.cjs} +86 -15
  9. package/dist/{chunk-Y6BUGLXU.js → chunk-6IPPANNX.js} +4 -1
  10. package/dist/{chunk-L45UXUWX.js → chunk-AZV45DMG.js} +1 -1
  11. package/dist/{chunk-QQQKISXT.js → chunk-BR4QLZPX.js} +11 -2
  12. package/dist/{chunk-AUATLZA5.cjs → chunk-CLL6VDPO.cjs} +4 -4
  13. package/dist/{chunk-P4CGOJEM.js → chunk-EMH4IP2U.js} +1 -1
  14. package/dist/{chunk-JNP27XW2.cjs → chunk-GJENL6VK.cjs} +6 -6
  15. package/dist/{chunk-APXP7OK7.cjs → chunk-HIZQBWNW.cjs} +11 -2
  16. package/dist/{chunk-YS7MOLK2.cjs → chunk-HTERSQGF.cjs} +3 -3
  17. package/dist/{chunk-E7GAK72W.js → chunk-HUQY2WR5.js} +3 -3
  18. package/dist/{chunk-L2BDDM2W.js → chunk-I664KOWP.js} +1 -1
  19. package/dist/{chunk-K6CZFCX6.js → chunk-J272OMDL.js} +51 -6
  20. package/dist/{chunk-KQKW2ZEK.cjs → chunk-NAJGGUAM.cjs} +2 -2
  21. package/dist/{chunk-YLWZGSFY.cjs → chunk-NTD4JLDW.cjs} +4 -0
  22. package/dist/{chunk-R7UTY3SY.js → chunk-NZQ47NWD.js} +84 -14
  23. package/dist/{chunk-432ZYMYV.js → chunk-PLDVGOKZ.js} +2 -2
  24. package/dist/{chunk-T3E4B5MJ.js → chunk-RXNYY5K5.js} +1 -1
  25. package/dist/{chunk-3COX5FSL.cjs → chunk-SBS2GHM3.cjs} +51 -6
  26. package/dist/chunk-TTARJWGT.js +82 -0
  27. package/dist/chunk-U7MWHXMF.cjs +89 -0
  28. package/dist/chunk-YPPKY5XZ.js +312 -0
  29. package/dist/cli.js +1 -1
  30. package/dist/geo.cjs +6 -6
  31. package/dist/geo.js +1 -1
  32. package/dist/holidays.d.cts +2 -1
  33. package/dist/holidays.d.ts +2 -1
  34. package/dist/iban.cjs +11 -3
  35. package/dist/iban.d.cts +45 -1
  36. package/dist/iban.d.ts +45 -1
  37. package/dist/iban.js +1 -1
  38. package/dist/index.cjs +76 -37
  39. package/dist/index.d.cts +11 -2
  40. package/dist/index.d.ts +11 -2
  41. package/dist/index.js +16 -10
  42. package/dist/input.cjs +34 -0
  43. package/dist/input.d.cts +67 -0
  44. package/dist/input.d.ts +67 -0
  45. package/dist/input.js +5 -0
  46. package/dist/networks.cjs +3 -3
  47. package/dist/networks.js +2 -2
  48. package/dist/numbers.cjs +6 -6
  49. package/dist/numbers.js +2 -2
  50. package/dist/phone.cjs +8 -8
  51. package/dist/phone.js +3 -3
  52. package/dist/raast.cjs +9 -5
  53. package/dist/raast.d.cts +53 -8
  54. package/dist/raast.d.ts +53 -8
  55. package/dist/raast.js +2 -2
  56. package/dist/valibot.cjs +7 -7
  57. package/dist/valibot.js +6 -6
  58. package/dist/whatsapp.cjs +3 -3
  59. package/dist/whatsapp.js +2 -2
  60. package/dist/words.cjs +3 -3
  61. package/dist/words.js +1 -1
  62. package/dist/yup.cjs +7 -7
  63. package/dist/yup.js +6 -6
  64. package/dist/zod.cjs +7 -7
  65. package/dist/zod.js +6 -6
  66. package/package.json +16 -3
  67. package/dist/chunk-4EUKCSLW.js +0 -221
  68. package/dist/chunk-E47SNBWQ.cjs +0 -224
package/dist/raast.d.cts CHANGED
@@ -10,6 +10,8 @@ interface EmvField {
10
10
  children?: EmvField[];
11
11
  }
12
12
 
13
+ /** A duration such as `'30m'`, `'12h'` or `'7d'` (minutes, hours or days). */
14
+ type RaastDuration = `${number}${'m' | 'h' | 'd'}`;
13
15
  /** Options for {@link createRaastP2PQr}. */
14
16
  interface RaastP2PQrOptions {
15
17
  /** Payee's Pakistani IBAN. */
@@ -25,8 +27,16 @@ interface RaastP2PQrOptions {
25
27
  * expiry, and ignore the amount in static ones.
26
28
  */
27
29
  amount?: number;
28
- /** When a QR with an amount stops working (tag 07). Required with `amount`. */
30
+ /**
31
+ * When a QR with an amount stops working (tag 07). With `amount`, give this
32
+ * or `expiresIn`.
33
+ */
29
34
  expiresAt?: Date;
35
+ /**
36
+ * How long from now a QR with an amount works, instead of `expiresAt`:
37
+ * milliseconds, or a string such as `'30m'`, `'12h'` or `'7d'`.
38
+ */
39
+ expiresIn?: number | RaastDuration;
30
40
  /** Payee's bank name (up to 25 characters). */
31
41
  bankName?: string;
32
42
  /** Payment description (up to 30 characters). */
@@ -105,16 +115,12 @@ interface ParsedRaastQr {
105
115
  *
106
116
  * @example
107
117
  * createRaastP2PQr({ iban: 'PK36SCBL0000001123456702' });
108
- * createRaastP2PQr({
109
- * iban: 'PK36SCBL0000001123456702',
110
- * amount: 1500,
111
- * expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
112
- * });
118
+ * createRaastP2PQr({ iban: 'PK36SCBL0000001123456702', amount: 1500, expiresIn: '1d' });
113
119
  *
114
120
  * @param options - Payee IBAN and optional amount with expiry, bank name and description
115
121
  * @returns QR payload string
116
122
  * @throws {RangeError} If the IBAN is invalid, a field is too long, or an
117
- * amount is given without `expiresAt`
123
+ * amount is given without `expiresAt` or `expiresIn`
118
124
  */
119
125
  declare function createRaastP2PQr(options: RaastP2PQrOptions): string;
120
126
  /**
@@ -139,5 +145,44 @@ declare function createMerchantQr(options: MerchantQrOptions): string;
139
145
  * @returns Parsed details, or `null` if the payload is not a well-formed Pakistani QR code
140
146
  */
141
147
  declare function parseRaastQr(payload: string): ParsedRaastQr | null;
148
+ /** A problem that stops a Raast QR from working or makes it unsafe to pay. */
149
+ type RaastQrError = 'not-a-raast-qr' | 'bad-checksum' | 'no-iban' | 'invalid-iban' | 'expired' | 'missing-expiry';
150
+ /** Something worth telling the payer, but which does not stop payment. */
151
+ type RaastQrWarning = 'amount-ignored' | 'expires-soon';
152
+ /** Result of {@link validateRaastQr}. */
153
+ interface RaastQrValidation {
154
+ /** `true` when there are no errors. */
155
+ valid: boolean;
156
+ errors: RaastQrError[];
157
+ warnings: RaastQrWarning[];
158
+ /** The parsed QR, or `null` if it could not be read. */
159
+ qr: ParsedRaastQr | null;
160
+ }
161
+ /** Options for {@link validateRaastQr}. */
162
+ interface ValidateRaastQrOptions {
163
+ /** The time to check expiry against. Defaults to now. */
164
+ now?: Date;
165
+ /** Warn when a QR expires within this many milliseconds. Defaults to 1 hour. */
166
+ expiresSoonMs?: number;
167
+ }
168
+ /**
169
+ * Checks whether a Raast QR code can be paid, e.g. before showing a payment
170
+ * screen or to warn about a tampered sticker.
171
+ *
172
+ * Errors: not a Pakistani payment QR, checksum mismatch (damaged or edited),
173
+ * no IBAN or an IBAN that fails its checksum, expired, or a fixed-amount QR
174
+ * without the expiry that banking apps require.
175
+ * Warnings: an amount in a static QR (apps ignore it, so the payer must type
176
+ * it), or a QR that expires soon (within an hour by default).
177
+ *
178
+ * @example
179
+ * validateRaastQr(scannedText);
180
+ * // { valid: false, errors: ['expired'], warnings: [], qr: { ... } }
181
+ *
182
+ * @param payload - Text decoded from the QR code
183
+ * @param options - Time to check against and the "expires soon" window
184
+ * @returns Validation result with the parsed QR
185
+ */
186
+ declare function validateRaastQr(payload: string, options?: ValidateRaastQrOptions): RaastQrValidation;
142
187
 
143
- export { type MerchantAccountInfo, type MerchantQrOptions, type ParsedRaastQr, type RaastP2PQrOptions, createMerchantQr, createRaastP2PQr, parseRaastQr };
188
+ export { type EmvField, type MerchantAccountInfo, type MerchantQrOptions, type ParsedRaastQr, type RaastDuration, type RaastP2PQrOptions, type RaastQrError, type RaastQrValidation, type RaastQrWarning, type ValidateRaastQrOptions, createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr };
package/dist/raast.d.ts CHANGED
@@ -10,6 +10,8 @@ interface EmvField {
10
10
  children?: EmvField[];
11
11
  }
12
12
 
13
+ /** A duration such as `'30m'`, `'12h'` or `'7d'` (minutes, hours or days). */
14
+ type RaastDuration = `${number}${'m' | 'h' | 'd'}`;
13
15
  /** Options for {@link createRaastP2PQr}. */
14
16
  interface RaastP2PQrOptions {
15
17
  /** Payee's Pakistani IBAN. */
@@ -25,8 +27,16 @@ interface RaastP2PQrOptions {
25
27
  * expiry, and ignore the amount in static ones.
26
28
  */
27
29
  amount?: number;
28
- /** When a QR with an amount stops working (tag 07). Required with `amount`. */
30
+ /**
31
+ * When a QR with an amount stops working (tag 07). With `amount`, give this
32
+ * or `expiresIn`.
33
+ */
29
34
  expiresAt?: Date;
35
+ /**
36
+ * How long from now a QR with an amount works, instead of `expiresAt`:
37
+ * milliseconds, or a string such as `'30m'`, `'12h'` or `'7d'`.
38
+ */
39
+ expiresIn?: number | RaastDuration;
30
40
  /** Payee's bank name (up to 25 characters). */
31
41
  bankName?: string;
32
42
  /** Payment description (up to 30 characters). */
@@ -105,16 +115,12 @@ interface ParsedRaastQr {
105
115
  *
106
116
  * @example
107
117
  * createRaastP2PQr({ iban: 'PK36SCBL0000001123456702' });
108
- * createRaastP2PQr({
109
- * iban: 'PK36SCBL0000001123456702',
110
- * amount: 1500,
111
- * expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
112
- * });
118
+ * createRaastP2PQr({ iban: 'PK36SCBL0000001123456702', amount: 1500, expiresIn: '1d' });
113
119
  *
114
120
  * @param options - Payee IBAN and optional amount with expiry, bank name and description
115
121
  * @returns QR payload string
116
122
  * @throws {RangeError} If the IBAN is invalid, a field is too long, or an
117
- * amount is given without `expiresAt`
123
+ * amount is given without `expiresAt` or `expiresIn`
118
124
  */
119
125
  declare function createRaastP2PQr(options: RaastP2PQrOptions): string;
120
126
  /**
@@ -139,5 +145,44 @@ declare function createMerchantQr(options: MerchantQrOptions): string;
139
145
  * @returns Parsed details, or `null` if the payload is not a well-formed Pakistani QR code
140
146
  */
141
147
  declare function parseRaastQr(payload: string): ParsedRaastQr | null;
148
+ /** A problem that stops a Raast QR from working or makes it unsafe to pay. */
149
+ type RaastQrError = 'not-a-raast-qr' | 'bad-checksum' | 'no-iban' | 'invalid-iban' | 'expired' | 'missing-expiry';
150
+ /** Something worth telling the payer, but which does not stop payment. */
151
+ type RaastQrWarning = 'amount-ignored' | 'expires-soon';
152
+ /** Result of {@link validateRaastQr}. */
153
+ interface RaastQrValidation {
154
+ /** `true` when there are no errors. */
155
+ valid: boolean;
156
+ errors: RaastQrError[];
157
+ warnings: RaastQrWarning[];
158
+ /** The parsed QR, or `null` if it could not be read. */
159
+ qr: ParsedRaastQr | null;
160
+ }
161
+ /** Options for {@link validateRaastQr}. */
162
+ interface ValidateRaastQrOptions {
163
+ /** The time to check expiry against. Defaults to now. */
164
+ now?: Date;
165
+ /** Warn when a QR expires within this many milliseconds. Defaults to 1 hour. */
166
+ expiresSoonMs?: number;
167
+ }
168
+ /**
169
+ * Checks whether a Raast QR code can be paid, e.g. before showing a payment
170
+ * screen or to warn about a tampered sticker.
171
+ *
172
+ * Errors: not a Pakistani payment QR, checksum mismatch (damaged or edited),
173
+ * no IBAN or an IBAN that fails its checksum, expired, or a fixed-amount QR
174
+ * without the expiry that banking apps require.
175
+ * Warnings: an amount in a static QR (apps ignore it, so the payer must type
176
+ * it), or a QR that expires soon (within an hour by default).
177
+ *
178
+ * @example
179
+ * validateRaastQr(scannedText);
180
+ * // { valid: false, errors: ['expired'], warnings: [], qr: { ... } }
181
+ *
182
+ * @param payload - Text decoded from the QR code
183
+ * @param options - Time to check against and the "expires soon" window
184
+ * @returns Validation result with the parsed QR
185
+ */
186
+ declare function validateRaastQr(payload: string, options?: ValidateRaastQrOptions): RaastQrValidation;
142
187
 
143
- export { type MerchantAccountInfo, type MerchantQrOptions, type ParsedRaastQr, type RaastP2PQrOptions, createMerchantQr, createRaastP2PQr, parseRaastQr };
188
+ export { type EmvField, type MerchantAccountInfo, type MerchantQrOptions, type ParsedRaastQr, type RaastDuration, type RaastP2PQrOptions, type RaastQrError, type RaastQrValidation, type RaastQrWarning, type ValidateRaastQrOptions, createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr };
package/dist/raast.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createMerchantQr, createRaastP2PQr, parseRaastQr } from './chunk-R7UTY3SY.js';
2
- import './chunk-4EUKCSLW.js';
1
+ export { createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr } from './chunk-NZQ47NWD.js';
2
+ import './chunk-YPPKY5XZ.js';
3
3
  import './chunk-ENQ7O7VW.js';
package/dist/valibot.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkJNP27XW2_cjs = require('./chunk-JNP27XW2.cjs');
4
- require('./chunk-BSS4Z7NI.cjs');
5
- require('./chunk-PHHKIMO2.cjs');
6
- require('./chunk-YS7MOLK2.cjs');
3
+ var chunkGJENL6VK_cjs = require('./chunk-GJENL6VK.cjs');
4
+ require('./chunk-3ZA265SK.cjs');
5
+ require('./chunk-33FXHM2E.cjs');
6
+ require('./chunk-HTERSQGF.cjs');
7
+ require('./chunk-NTD4JLDW.cjs');
7
8
  require('./chunk-H6M6L26S.cjs');
8
- require('./chunk-YLWZGSFY.cjs');
9
9
  require('./chunk-HTCSHHOR.cjs');
10
- require('./chunk-E47SNBWQ.cjs');
10
+ require('./chunk-3IARSCO6.cjs');
11
11
  require('./chunk-VPBMIYO2.cjs');
12
12
  var v = require('valibot');
13
13
 
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
32
32
  var v__namespace = /*#__PURE__*/_interopNamespace(v);
33
33
 
34
34
  function schema(name) {
35
- const rule = chunkJNP27XW2_cjs.RULES[name];
35
+ const rule = chunkGJENL6VK_cjs.RULES[name];
36
36
  return (options = {}) => v__namespace.pipe(v__namespace.string(), v__namespace.check(rule.test, options.message ?? rule.message));
37
37
  }
38
38
  var pk = {
package/dist/valibot.js CHANGED
@@ -1,11 +1,11 @@
1
- import { RULES } from './chunk-E7GAK72W.js';
2
- import './chunk-T3E4B5MJ.js';
3
- import './chunk-432ZYMYV.js';
4
- import './chunk-L45UXUWX.js';
1
+ import { RULES } from './chunk-HUQY2WR5.js';
2
+ import './chunk-RXNYY5K5.js';
3
+ import './chunk-PLDVGOKZ.js';
4
+ import './chunk-AZV45DMG.js';
5
+ import './chunk-6IPPANNX.js';
5
6
  import './chunk-CEPNSHIC.js';
6
- import './chunk-Y6BUGLXU.js';
7
7
  import './chunk-EEVNLTB4.js';
8
- import './chunk-4EUKCSLW.js';
8
+ import './chunk-YPPKY5XZ.js';
9
9
  import './chunk-ENQ7O7VW.js';
10
10
  import * as v from 'valibot';
11
11
 
package/dist/whatsapp.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkKQKW2ZEK_cjs = require('./chunk-KQKW2ZEK.cjs');
4
- require('./chunk-YLWZGSFY.cjs');
3
+ var chunkNAJGGUAM_cjs = require('./chunk-NAJGGUAM.cjs');
4
+ require('./chunk-NTD4JLDW.cjs');
5
5
  require('./chunk-VPBMIYO2.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "createWhatsAppLink", {
10
10
  enumerable: true,
11
- get: function () { return chunkKQKW2ZEK_cjs.createWhatsAppLink; }
11
+ get: function () { return chunkNAJGGUAM_cjs.createWhatsAppLink; }
12
12
  });
package/dist/whatsapp.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createWhatsAppLink } from './chunk-P4CGOJEM.js';
2
- import './chunk-Y6BUGLXU.js';
1
+ export { createWhatsAppLink } from './chunk-EMH4IP2U.js';
2
+ import './chunk-6IPPANNX.js';
3
3
  import './chunk-ENQ7O7VW.js';
package/dist/words.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkAPXP7OK7_cjs = require('./chunk-APXP7OK7.cjs');
3
+ var chunkHIZQBWNW_cjs = require('./chunk-HIZQBWNW.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "amountInWords", {
8
8
  enumerable: true,
9
- get: function () { return chunkAPXP7OK7_cjs.amountInWords; }
9
+ get: function () { return chunkHIZQBWNW_cjs.amountInWords; }
10
10
  });
11
11
  Object.defineProperty(exports, "numberToWords", {
12
12
  enumerable: true,
13
- get: function () { return chunkAPXP7OK7_cjs.numberToWords; }
13
+ get: function () { return chunkHIZQBWNW_cjs.numberToWords; }
14
14
  });
package/dist/words.js CHANGED
@@ -1 +1 @@
1
- export { amountInWords, numberToWords } from './chunk-QQQKISXT.js';
1
+ export { amountInWords, numberToWords } from './chunk-BR4QLZPX.js';
package/dist/yup.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkJNP27XW2_cjs = require('./chunk-JNP27XW2.cjs');
4
- require('./chunk-BSS4Z7NI.cjs');
5
- require('./chunk-PHHKIMO2.cjs');
6
- require('./chunk-YS7MOLK2.cjs');
3
+ var chunkGJENL6VK_cjs = require('./chunk-GJENL6VK.cjs');
4
+ require('./chunk-3ZA265SK.cjs');
5
+ require('./chunk-33FXHM2E.cjs');
6
+ require('./chunk-HTERSQGF.cjs');
7
+ require('./chunk-NTD4JLDW.cjs');
7
8
  require('./chunk-H6M6L26S.cjs');
8
- require('./chunk-YLWZGSFY.cjs');
9
9
  require('./chunk-HTCSHHOR.cjs');
10
- require('./chunk-E47SNBWQ.cjs');
10
+ require('./chunk-3IARSCO6.cjs');
11
11
  require('./chunk-VPBMIYO2.cjs');
12
12
  var yup = require('yup');
13
13
 
14
14
  function schema(name) {
15
- const rule = chunkJNP27XW2_cjs.RULES[name];
15
+ const rule = chunkGJENL6VK_cjs.RULES[name];
16
16
  return (options = {}) => yup.string().test(
17
17
  `pk-${name}`,
18
18
  options.message ?? rule.message,
package/dist/yup.js CHANGED
@@ -1,11 +1,11 @@
1
- import { RULES } from './chunk-E7GAK72W.js';
2
- import './chunk-T3E4B5MJ.js';
3
- import './chunk-432ZYMYV.js';
4
- import './chunk-L45UXUWX.js';
1
+ import { RULES } from './chunk-HUQY2WR5.js';
2
+ import './chunk-RXNYY5K5.js';
3
+ import './chunk-PLDVGOKZ.js';
4
+ import './chunk-AZV45DMG.js';
5
+ import './chunk-6IPPANNX.js';
5
6
  import './chunk-CEPNSHIC.js';
6
- import './chunk-Y6BUGLXU.js';
7
7
  import './chunk-EEVNLTB4.js';
8
- import './chunk-4EUKCSLW.js';
8
+ import './chunk-YPPKY5XZ.js';
9
9
  import './chunk-ENQ7O7VW.js';
10
10
  import { string } from 'yup';
11
11
 
package/dist/zod.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkJNP27XW2_cjs = require('./chunk-JNP27XW2.cjs');
4
- require('./chunk-BSS4Z7NI.cjs');
5
- require('./chunk-PHHKIMO2.cjs');
6
- require('./chunk-YS7MOLK2.cjs');
3
+ var chunkGJENL6VK_cjs = require('./chunk-GJENL6VK.cjs');
4
+ require('./chunk-3ZA265SK.cjs');
5
+ require('./chunk-33FXHM2E.cjs');
6
+ require('./chunk-HTERSQGF.cjs');
7
+ require('./chunk-NTD4JLDW.cjs');
7
8
  require('./chunk-H6M6L26S.cjs');
8
- require('./chunk-YLWZGSFY.cjs');
9
9
  require('./chunk-HTCSHHOR.cjs');
10
- require('./chunk-E47SNBWQ.cjs');
10
+ require('./chunk-3IARSCO6.cjs');
11
11
  require('./chunk-VPBMIYO2.cjs');
12
12
  var zod = require('zod');
13
13
 
14
14
  function schema(name) {
15
- const rule = chunkJNP27XW2_cjs.RULES[name];
15
+ const rule = chunkGJENL6VK_cjs.RULES[name];
16
16
  return (options = {}) => zod.z.string().refine(rule.test, { message: options.message ?? rule.message });
17
17
  }
18
18
  var pk = {
package/dist/zod.js CHANGED
@@ -1,11 +1,11 @@
1
- import { RULES } from './chunk-E7GAK72W.js';
2
- import './chunk-T3E4B5MJ.js';
3
- import './chunk-432ZYMYV.js';
4
- import './chunk-L45UXUWX.js';
1
+ import { RULES } from './chunk-HUQY2WR5.js';
2
+ import './chunk-RXNYY5K5.js';
3
+ import './chunk-PLDVGOKZ.js';
4
+ import './chunk-AZV45DMG.js';
5
+ import './chunk-6IPPANNX.js';
5
6
  import './chunk-CEPNSHIC.js';
6
- import './chunk-Y6BUGLXU.js';
7
7
  import './chunk-EEVNLTB4.js';
8
- import './chunk-4EUKCSLW.js';
8
+ import './chunk-YPPKY5XZ.js';
9
9
  import './chunk-ENQ7O7VW.js';
10
10
  import { z } from 'zod';
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pakdatakit",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Production-ready utility toolkit for Pakistani developers — CNIC, phone, WhatsApp, IBAN, postal codes, address parsing, Hijri dates, Roman Urdu, networks, geography, and formatting",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -90,6 +90,16 @@
90
90
  "default": "./dist/iban.cjs"
91
91
  }
92
92
  },
93
+ "./input": {
94
+ "import": {
95
+ "types": "./dist/input.d.ts",
96
+ "default": "./dist/input.js"
97
+ },
98
+ "require": {
99
+ "types": "./dist/input.d.cts",
100
+ "default": "./dist/input.cjs"
101
+ }
102
+ },
93
103
  "./networks": {
94
104
  "import": {
95
105
  "types": "./dist/networks.d.ts",
@@ -213,7 +223,8 @@
213
223
  "./package.json": "./package.json"
214
224
  },
215
225
  "files": [
216
- "dist"
226
+ "dist",
227
+ "DATA.md"
217
228
  ],
218
229
  "sideEffects": false,
219
230
  "scripts": {
@@ -227,7 +238,8 @@
227
238
  "format": "prettier --write .",
228
239
  "format:check": "prettier --check .",
229
240
  "typecheck": "tsc --noEmit",
230
- "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build"
241
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build",
242
+ "docs": "typedoc && node scripts/generate-llms.mjs"
231
243
  },
232
244
  "keywords": [
233
245
  "pakistan",
@@ -284,6 +296,7 @@
284
296
  "libphonenumber-js": "^1.13.15",
285
297
  "prettier": "^3.5.3",
286
298
  "tsup": "^8.5.0",
299
+ "typedoc": "^0.28.20",
287
300
  "typescript": "^5.8.3",
288
301
  "valibot": "^1.5.0",
289
302
  "vitest": "^3.2.1",
@@ -1,221 +0,0 @@
1
- import { lazy, stripSeparators } from './chunk-ENQ7O7VW.js';
2
-
3
- // data/banks.json
4
- var banks_default = [
5
- {
6
- code: "ABPA",
7
- name: "Allied Bank Limited"
8
- },
9
- {
10
- code: "AIIN",
11
- name: "Al Baraka Bank (Pakistan) Limited"
12
- },
13
- {
14
- code: "ALFH",
15
- name: "Bank Alfalah Limited"
16
- },
17
- {
18
- code: "APNA",
19
- name: "Apna Microfinance Bank"
20
- },
21
- {
22
- code: "ASCM",
23
- name: "Askari Bank Limited"
24
- },
25
- {
26
- code: "BAHL",
27
- name: "Bank Al Habib Limited"
28
- },
29
- {
30
- code: "BKIP",
31
- name: "BankIslami Pakistan Limited"
32
- },
33
- {
34
- code: "BPUN",
35
- name: "The Bank of Punjab"
36
- },
37
- {
38
- code: "CITI",
39
- name: "Citibank N.A. Pakistan"
40
- },
41
- {
42
- code: "DEUT",
43
- name: "Deutsche Bank AG"
44
- },
45
- {
46
- code: "DUIB",
47
- name: "Dubai Islamic Bank Pakistan Limited"
48
- },
49
- {
50
- code: "FAYS",
51
- name: "Faysal Bank Limited"
52
- },
53
- {
54
- code: "FINC",
55
- name: "ABHI Microfinance Bank (formerly FINCA Microfinance Bank)"
56
- },
57
- {
58
- code: "FMFB",
59
- name: "HBL Microfinance Bank (formerly First MicroFinance Bank)"
60
- },
61
- {
62
- code: "FWOM",
63
- name: "First Women Bank Limited"
64
- },
65
- {
66
- code: "HABB",
67
- name: "Habib Bank Limited"
68
- },
69
- {
70
- code: "ICBK",
71
- name: "Industrial and Commercial Bank of China"
72
- },
73
- {
74
- code: "JCMA",
75
- name: "Mobilink Microfinance Bank (JazzCash)"
76
- },
77
- {
78
- code: "JSBL",
79
- name: "JS Bank Limited"
80
- },
81
- {
82
- code: "KHYB",
83
- name: "The Bank of Khyber"
84
- },
85
- {
86
- code: "KMBL",
87
- name: "Khushhali Microfinance Bank"
88
- },
89
- {
90
- code: "MCBL",
91
- name: "MCB Bank Limited"
92
- },
93
- {
94
- code: "MCIB",
95
- name: "MCB Islamic Bank Limited"
96
- },
97
- {
98
- code: "MEZN",
99
- name: "Meezan Bank Limited"
100
- },
101
- {
102
- code: "MPBL",
103
- name: "Habib Metropolitan Bank Limited"
104
- },
105
- {
106
- code: "MSHQ",
107
- name: "Mashreq Bank Pakistan"
108
- },
109
- {
110
- code: "MUCB",
111
- name: "MCB Bank Limited"
112
- },
113
- {
114
- code: "NBPA",
115
- name: "National Bank of Pakistan"
116
- },
117
- {
118
- code: "NBPB",
119
- name: "National Bank of Pakistan"
120
- },
121
- {
122
- code: "NIBP",
123
- name: "NIB Bank Limited (merged into MCB Bank)"
124
- },
125
- {
126
- code: "NRSP",
127
- name: "NRSP Microfinance Bank"
128
- },
129
- {
130
- code: "PAKB",
131
- name: "Pak Oman Microfinance Bank"
132
- },
133
- {
134
- code: "SADA",
135
- name: "SadaPay"
136
- },
137
- {
138
- code: "SAMB",
139
- name: "Samba Bank Limited"
140
- },
141
- {
142
- code: "SAUD",
143
- name: "Silkbank Limited (merged into United Bank Limited)"
144
- },
145
- {
146
- code: "SBPP",
147
- name: "State Bank of Pakistan"
148
- },
149
- {
150
- code: "SCBL",
151
- name: "Standard Chartered Bank (Pakistan) Limited"
152
- },
153
- {
154
- code: "SIND",
155
- name: "Sindh Bank Limited"
156
- },
157
- {
158
- code: "SONE",
159
- name: "Soneri Bank Limited"
160
- },
161
- {
162
- code: "SUMB",
163
- name: "Bank Makramah Limited (formerly Summit Bank)"
164
- },
165
- {
166
- code: "TAMW",
167
- name: "easypaisa Digital Bank (formerly Tameer Microfinance Bank)"
168
- },
169
- {
170
- code: "TMFB",
171
- name: "easypaisa Digital Bank (formerly Telenor Microfinance Bank)"
172
- },
173
- {
174
- code: "UMBL",
175
- name: "U Microfinance Bank"
176
- },
177
- {
178
- code: "UNIL",
179
- name: "United Bank Limited"
180
- }
181
- ];
182
-
183
- // src/iban.ts
184
- var PK_IBAN_PATTERN = /^PK\d{2}[A-Z]{4}[A-Z0-9]{16}$/;
185
- var bankMap = lazy(
186
- () => new Map(
187
- banks_default.map((entry) => [entry.code, entry.name])
188
- )
189
- );
190
- function expandIbanChars(value) {
191
- return value.replace(
192
- /[A-Z]/g,
193
- (char) => (char.charCodeAt(0) - 55).toString()
194
- );
195
- }
196
- function mod97(numericIban) {
197
- let remainder = 0;
198
- for (const digit of numericIban) {
199
- remainder = (remainder * 10 + Number(digit)) % 97;
200
- }
201
- return remainder;
202
- }
203
- function normalizeIBAN(iban) {
204
- return stripSeparators(iban).toUpperCase();
205
- }
206
- function validateIBAN(iban) {
207
- const normalized = normalizeIBAN(iban);
208
- if (!PK_IBAN_PATTERN.test(normalized)) {
209
- return false;
210
- }
211
- const rearranged = normalized.slice(4) + normalized.slice(0, 4);
212
- return mod97(expandIbanChars(rearranged)) === 1;
213
- }
214
- function getBankFromIBAN(iban) {
215
- if (!validateIBAN(iban)) {
216
- return null;
217
- }
218
- return bankMap().get(normalizeIBAN(iban).slice(4, 8)) ?? null;
219
- }
220
-
221
- export { getBankFromIBAN, validateIBAN };