pakdatakit 2.2.1 → 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.
- package/DATA.md +302 -33
- package/README.md +172 -27
- package/dist/address.cjs +5 -5
- package/dist/address.js +3 -3
- package/dist/{chunk-4VSGCQ6K.cjs → chunk-2OBKPYJZ.cjs} +3 -3
- package/dist/chunk-33QMFE2Z.js +21244 -0
- package/dist/chunk-7E7L3NYS.cjs +11 -0
- package/dist/{chunk-TTARJWGT.js → chunk-A3HBEBXY.js} +2 -2
- package/dist/{chunk-3ZA265SK.cjs → chunk-AUQFA7EE.cjs} +172 -4
- package/dist/{chunk-HBOZIITD.js → chunk-CADQM4ZN.js} +14 -14
- package/dist/{chunk-3IARSCO6.cjs → chunk-DHOP7LQX.cjs} +25 -14
- package/dist/chunk-E6HSKRAE.js +9 -0
- package/dist/{chunk-33FXHM2E.cjs → chunk-ESKXG7Y6.cjs} +5 -5
- package/dist/{chunk-U7MWHXMF.cjs → chunk-FRBPAGEJ.cjs} +4 -4
- package/dist/chunk-I7UUPD3G.cjs +21252 -0
- package/dist/{chunk-YPPKY5XZ.js → chunk-IBZPJS4H.js} +26 -15
- package/dist/{chunk-47P7HILD.cjs → chunk-J5ARB4TE.cjs} +8 -8
- package/dist/{chunk-XCXFGTHW.cjs → chunk-J5ZF46NZ.cjs} +14 -14
- package/dist/{chunk-NZQ47NWD.js → chunk-KRYHLYN2.js} +1 -1
- package/dist/{chunk-RXNYY5K5.js → chunk-LQHM3ADX.js} +172 -4
- package/dist/{chunk-HTERSQGF.cjs → chunk-MTS6SVNP.cjs} +4 -4
- package/dist/chunk-N4S22XX3.js +6208 -0
- package/dist/chunk-OKMBYX3F.cjs +6220 -0
- package/dist/{chunk-6IPPANNX.js → chunk-P7LVE2TF.js} +2 -2
- package/dist/chunk-RZQJAZKC.js +22 -0
- package/dist/{chunk-PLDVGOKZ.js → chunk-S274QFFB.js} +2 -2
- package/dist/chunk-SQIHFEXI.cjs +25 -0
- package/dist/chunk-TBTWZC74.cjs +32 -0
- package/dist/{chunk-NAJGGUAM.cjs → chunk-TC3VRWZV.cjs} +2 -2
- package/dist/{chunk-QKH7W2CC.js → chunk-TQP2T33V.js} +5 -5
- package/dist/{chunk-AZV45DMG.js → chunk-V2XE3NCG.js} +2 -2
- package/dist/{chunk-NTD4JLDW.cjs → chunk-YTLE5K7G.cjs} +1 -1
- package/dist/{chunk-HUQY2WR5.js → chunk-YTSMFGTW.js} +13 -3
- package/dist/{chunk-EMH4IP2U.js → chunk-ZRONAQBV.js} +1 -1
- package/dist/class-validator.cjs +57 -0
- package/dist/class-validator.d.cts +57 -0
- package/dist/class-validator.d.ts +57 -0
- package/dist/class-validator.js +47 -0
- package/dist/cli.js +1 -1
- package/dist/geo.cjs +22 -6
- package/dist/geo.d.cts +56 -1
- package/dist/geo.d.ts +56 -1
- package/dist/geo.js +1 -1
- package/dist/holidays.cjs +4 -4
- package/dist/holidays.js +1 -1
- package/dist/iban.cjs +5 -5
- package/dist/iban.d.cts +8 -6
- package/dist/iban.d.ts +8 -6
- package/dist/iban.js +1 -1
- package/dist/index.cjs +106 -68
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +16 -14
- package/dist/input.cjs +9 -9
- package/dist/input.js +3 -3
- package/dist/joi.cjs +37 -0
- package/dist/joi.d.cts +24 -0
- package/dist/joi.d.ts +24 -0
- package/dist/joi.js +31 -0
- package/dist/networks.cjs +3 -3
- package/dist/networks.js +2 -2
- package/dist/numbers.cjs +6 -6
- package/dist/numbers.js +2 -2
- package/dist/passport.cjs +11 -0
- package/dist/passport.d.cts +27 -0
- package/dist/passport.d.ts +27 -0
- package/dist/passport.js +2 -0
- package/dist/phone.cjs +8 -8
- package/dist/phone.js +3 -3
- package/dist/postal.cjs +14 -6
- package/dist/postal.d.cts +54 -2
- package/dist/postal.d.ts +54 -2
- package/dist/postal.js +1 -1
- package/dist/raast.cjs +6 -6
- package/dist/raast.js +2 -2
- package/dist/superstruct.cjs +35 -0
- package/dist/superstruct.d.cts +24 -0
- package/dist/superstruct.d.ts +24 -0
- package/dist/superstruct.js +33 -0
- package/dist/valibot.cjs +12 -8
- package/dist/valibot.d.cts +2 -0
- package/dist/valibot.d.ts +2 -0
- package/dist/valibot.js +11 -7
- package/dist/vehicle.cjs +15 -0
- package/dist/vehicle.d.cts +43 -0
- package/dist/vehicle.d.ts +43 -0
- package/dist/vehicle.js +2 -0
- package/dist/whatsapp.cjs +3 -3
- package/dist/whatsapp.js +2 -2
- package/dist/yup.cjs +12 -8
- package/dist/yup.d.cts +2 -0
- package/dist/yup.d.ts +2 -0
- package/dist/yup.js +11 -7
- package/dist/zod.cjs +12 -8
- package/dist/zod.d.cts +2 -0
- package/dist/zod.d.ts +2 -0
- package/dist/zod.js +11 -7
- package/package.json +101 -3
- package/dist/chunk-34CJGJ67.cjs +0 -1697
- package/dist/chunk-4VVFS6FN.cjs +0 -715
- package/dist/chunk-E6DT2DWQ.js +0 -1689
- package/dist/chunk-GJENL6VK.cjs +0 -22
- package/dist/chunk-LIYNKIKS.js +0 -709
package/dist/joi.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { A as AdapterOptions } from './rules-GxgPiVws.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Joi schemas for Pakistani identifiers.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import Joi from 'joi';
|
|
9
|
+
* import { pk } from 'pakdatakit/joi';
|
|
10
|
+
*
|
|
11
|
+
* const form = Joi.object({ cnic: pk.cnic().required(), phone: pk.phone() });
|
|
12
|
+
*/
|
|
13
|
+
declare const pk: {
|
|
14
|
+
cnic: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
15
|
+
phone: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
16
|
+
iban: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
17
|
+
ntn: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
18
|
+
strn: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
19
|
+
landline: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
20
|
+
passport: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
21
|
+
vehiclePlate: (options?: AdapterOptions) => Joi.StringSchema<string>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { AdapterOptions, pk };
|
package/dist/joi.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RULES } from './chunk-YTSMFGTW.js';
|
|
2
|
+
import './chunk-RZQJAZKC.js';
|
|
3
|
+
import './chunk-LQHM3ADX.js';
|
|
4
|
+
import './chunk-E6HSKRAE.js';
|
|
5
|
+
import './chunk-S274QFFB.js';
|
|
6
|
+
import './chunk-V2XE3NCG.js';
|
|
7
|
+
import './chunk-P7LVE2TF.js';
|
|
8
|
+
import './chunk-CEPNSHIC.js';
|
|
9
|
+
import './chunk-EEVNLTB4.js';
|
|
10
|
+
import './chunk-IBZPJS4H.js';
|
|
11
|
+
import './chunk-ENQ7O7VW.js';
|
|
12
|
+
import Joi from 'joi';
|
|
13
|
+
|
|
14
|
+
function schema(name) {
|
|
15
|
+
const rule = RULES[name];
|
|
16
|
+
return (options = {}) => Joi.string().custom(
|
|
17
|
+
(value, helpers) => rule.test(value) ? value : helpers.message({ custom: options.message ?? rule.message })
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
var pk = {
|
|
21
|
+
cnic: schema("cnic"),
|
|
22
|
+
phone: schema("phone"),
|
|
23
|
+
iban: schema("iban"),
|
|
24
|
+
ntn: schema("ntn"),
|
|
25
|
+
strn: schema("strn"),
|
|
26
|
+
landline: schema("landline"),
|
|
27
|
+
passport: schema("passport"),
|
|
28
|
+
vehiclePlate: schema("vehiclePlate")
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { pk };
|
package/dist/networks.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkMTS6SVNP_cjs = require('./chunk-MTS6SVNP.cjs');
|
|
4
|
+
require('./chunk-YTLE5K7G.cjs');
|
|
5
5
|
require('./chunk-VPBMIYO2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "getNetwork", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkMTS6SVNP_cjs.getNetwork; }
|
|
12
12
|
});
|
package/dist/networks.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getNetwork } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { getNetwork } from './chunk-V2XE3NCG.js';
|
|
2
|
+
import './chunk-P7LVE2TF.js';
|
|
3
3
|
import './chunk-ENQ7O7VW.js';
|
package/dist/numbers.cjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkAUQFA7EE_cjs = require('./chunk-AUQFA7EE.cjs');
|
|
4
|
+
require('./chunk-YTLE5K7G.cjs');
|
|
5
5
|
require('./chunk-VPBMIYO2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "analyzeNumber", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkAUQFA7EE_cjs.analyzeNumber; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "getAreaCode", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkAUQFA7EE_cjs.getAreaCode; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "getNumberType", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkAUQFA7EE_cjs.getNumberType; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "validateLandline", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkAUQFA7EE_cjs.validateLandline; }
|
|
24
24
|
});
|
package/dist/numbers.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { analyzeNumber, getAreaCode, getNumberType, validateLandline } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { analyzeNumber, getAreaCode, getNumberType, validateLandline } from './chunk-LQHM3ADX.js';
|
|
2
|
+
import './chunk-P7LVE2TF.js';
|
|
3
3
|
import './chunk-ENQ7O7VW.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7E7L3NYS_cjs = require('./chunk-7E7L3NYS.cjs');
|
|
4
|
+
require('./chunk-VPBMIYO2.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "validatePassport", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk7E7L3NYS_cjs.validatePassport; }
|
|
11
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates the format of a Pakistani passport number: two letters followed by
|
|
3
|
+
* seven digits, e.g. `AB1234567`. Case, surrounding spaces and spaces or
|
|
4
|
+
* dashes between the letters and digits are ignored.
|
|
5
|
+
*
|
|
6
|
+
* DGIP does not publish the format, so this checks the common shape only. Two
|
|
7
|
+
* letters and seven digits is the number format given for the 2013 ordinary
|
|
8
|
+
* passport in the EU's PRADO register
|
|
9
|
+
* (https://www.consilium.europa.eu/prado/en/PAK-AO-02003/index.html) and fits
|
|
10
|
+
* the 9-character document-number field of ICAO Doc 9303
|
|
11
|
+
* (https://www.icao.int/publications/Documents/9303_p4_cons_en.pdf). No source
|
|
12
|
+
* was found for later models (2017, 2022 e-passport) or for diplomatic and
|
|
13
|
+
* official passports, which may differ, so treat `false` as "unusual", not
|
|
14
|
+
* "fake". The letters' meaning is not documented and is not checked; the MRZ
|
|
15
|
+
* check digit is not part of the number.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* validatePassport('AB1234567'); // true
|
|
19
|
+
* validatePassport('ab 1234567'); // true
|
|
20
|
+
* validatePassport('A12345678'); // false
|
|
21
|
+
*
|
|
22
|
+
* @param passport - Passport number to validate
|
|
23
|
+
* @returns `true` if the format is valid
|
|
24
|
+
*/
|
|
25
|
+
declare function validatePassport(passport: string): boolean;
|
|
26
|
+
|
|
27
|
+
export { validatePassport };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates the format of a Pakistani passport number: two letters followed by
|
|
3
|
+
* seven digits, e.g. `AB1234567`. Case, surrounding spaces and spaces or
|
|
4
|
+
* dashes between the letters and digits are ignored.
|
|
5
|
+
*
|
|
6
|
+
* DGIP does not publish the format, so this checks the common shape only. Two
|
|
7
|
+
* letters and seven digits is the number format given for the 2013 ordinary
|
|
8
|
+
* passport in the EU's PRADO register
|
|
9
|
+
* (https://www.consilium.europa.eu/prado/en/PAK-AO-02003/index.html) and fits
|
|
10
|
+
* the 9-character document-number field of ICAO Doc 9303
|
|
11
|
+
* (https://www.icao.int/publications/Documents/9303_p4_cons_en.pdf). No source
|
|
12
|
+
* was found for later models (2017, 2022 e-passport) or for diplomatic and
|
|
13
|
+
* official passports, which may differ, so treat `false` as "unusual", not
|
|
14
|
+
* "fake". The letters' meaning is not documented and is not checked; the MRZ
|
|
15
|
+
* check digit is not part of the number.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* validatePassport('AB1234567'); // true
|
|
19
|
+
* validatePassport('ab 1234567'); // true
|
|
20
|
+
* validatePassport('A12345678'); // false
|
|
21
|
+
*
|
|
22
|
+
* @param passport - Passport number to validate
|
|
23
|
+
* @returns `true` if the format is valid
|
|
24
|
+
*/
|
|
25
|
+
declare function validatePassport(passport: string): boolean;
|
|
26
|
+
|
|
27
|
+
export { validatePassport };
|
package/dist/passport.js
ADDED
package/dist/phone.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
var
|
|
3
|
+
var chunkESKXG7Y6_cjs = require('./chunk-ESKXG7Y6.cjs');
|
|
4
|
+
require('./chunk-MTS6SVNP.cjs');
|
|
5
|
+
var chunkYTLE5K7G_cjs = require('./chunk-YTLE5K7G.cjs');
|
|
6
6
|
require('./chunk-VPBMIYO2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "analyzePhone", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkESKXG7Y6_cjs.analyzePhone; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "formatPhone", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkESKXG7Y6_cjs.formatPhone; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "validatePhone", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkESKXG7Y6_cjs.validatePhone; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "getPhonePrefix", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkYTLE5K7G_cjs.getPhonePrefix; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "normalizePhoneDigits", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkYTLE5K7G_cjs.normalizePhoneDigits; }
|
|
29
29
|
});
|
package/dist/phone.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { analyzePhone, formatPhone, validatePhone } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
export { getPhonePrefix, normalizePhoneDigits } from './chunk-
|
|
1
|
+
export { analyzePhone, formatPhone, validatePhone } from './chunk-S274QFFB.js';
|
|
2
|
+
import './chunk-V2XE3NCG.js';
|
|
3
|
+
export { getPhonePrefix, normalizePhoneDigits } from './chunk-P7LVE2TF.js';
|
|
4
4
|
import './chunk-ENQ7O7VW.js';
|
package/dist/postal.cjs
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkI7UUPD3G_cjs = require('./chunk-I7UUPD3G.cjs');
|
|
4
4
|
require('./chunk-VPBMIYO2.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "getCityByPostalCode", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkI7UUPD3G_cjs.getCityByPostalCode; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getPostOffice", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkI7UUPD3G_cjs.getPostOffice; }
|
|
11
15
|
});
|
|
12
16
|
Object.defineProperty(exports, "getPostalAreas", {
|
|
13
17
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkI7UUPD3G_cjs.getPostalAreas; }
|
|
15
19
|
});
|
|
16
20
|
Object.defineProperty(exports, "getPostalCode", {
|
|
17
21
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkI7UUPD3G_cjs.getPostalCode; }
|
|
19
23
|
});
|
|
20
24
|
Object.defineProperty(exports, "getPostalCodes", {
|
|
21
25
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkI7UUPD3G_cjs.getPostalCodes; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "searchPostOffices", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkI7UUPD3G_cjs.searchPostOffices; }
|
|
23
31
|
});
|
|
24
32
|
Object.defineProperty(exports, "searchPostalCodes", {
|
|
25
33
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkI7UUPD3G_cjs.searchPostalCodes; }
|
|
27
35
|
});
|
package/dist/postal.d.cts
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
|
+
/** A delivery post office from Pakistan Post's post code directory. */
|
|
2
|
+
interface PostOffice {
|
|
3
|
+
/** 5-digit post code, e.g. `48330`. */
|
|
4
|
+
code: string;
|
|
5
|
+
/** Office name as the directory gives it, in title case, e.g. `Dulmial`. */
|
|
6
|
+
office: string;
|
|
7
|
+
/**
|
|
8
|
+
* The city the office belongs to when that is known (`Lahore` for an office
|
|
9
|
+
* in Lahore); otherwise the office's own name, which for most offices is
|
|
10
|
+
* its town or village.
|
|
11
|
+
*/
|
|
12
|
+
town: string;
|
|
13
|
+
/**
|
|
14
|
+
* The district, when the town is the headquarters a district is named
|
|
15
|
+
* after; otherwise `null`. The directory has no district column.
|
|
16
|
+
*/
|
|
17
|
+
district: string | null;
|
|
18
|
+
/** Province or territory. */
|
|
19
|
+
province: string;
|
|
20
|
+
}
|
|
1
21
|
/**
|
|
2
|
-
* Returns the
|
|
22
|
+
* Returns the delivery post office for a post code, from Pakistan Post's
|
|
23
|
+
* directory of about 2,560 offices.
|
|
24
|
+
*
|
|
25
|
+
* Unlike `getCityByPostalCode`, which only answers for codes in the cities
|
|
26
|
+
* pakdatakit lists, this knows every delivery office, including those in
|
|
27
|
+
* towns and villages.
|
|
28
|
+
*
|
|
29
|
+
* @param code - Post code (whitespace is ignored)
|
|
30
|
+
* @returns The post office, or `null` if the code is not in the directory
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* getPostOffice('48330');
|
|
34
|
+
* // { code: '48330', office: 'Dulmial', town: 'Dulmial', district: null, province: 'Punjab' }
|
|
35
|
+
*/
|
|
36
|
+
declare function getPostOffice(code: string): PostOffice | null;
|
|
37
|
+
/**
|
|
38
|
+
* Searches Pakistan Post's directory by office name, town or post code.
|
|
39
|
+
*
|
|
40
|
+
* Matching is case-insensitive: an office matches when its name or town
|
|
41
|
+
* contains the query, or its code starts with it.
|
|
42
|
+
*
|
|
43
|
+
* @param query - Partial office name, town or post code
|
|
44
|
+
* @returns Matching post offices, sorted by post code
|
|
45
|
+
*/
|
|
46
|
+
declare function searchPostOffices(query: string): PostOffice[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns the city for a Pakistani postal code.
|
|
50
|
+
*
|
|
51
|
+
* Only codes of post offices in a city on pakdatakit's city list return a
|
|
52
|
+
* city (`54660` → `Lahore`). The code of a post office in a town or village
|
|
53
|
+
* that is not on the list returns `null`; use `getPostOffice` for those.
|
|
3
54
|
*
|
|
4
55
|
* @param postalCode - Postal code to look up (whitespace is ignored)
|
|
5
56
|
* @returns City name or `null` if not found
|
|
@@ -37,4 +88,5 @@ declare function searchPostalCodes(query: string): string[];
|
|
|
37
88
|
*/
|
|
38
89
|
declare function getPostalAreas(city: string): string[];
|
|
39
90
|
|
|
40
|
-
export { getCityByPostalCode, getPostalAreas, getPostalCode, getPostalCodes, searchPostalCodes };
|
|
91
|
+
export { getCityByPostalCode, getPostOffice, getPostalAreas, getPostalCode, getPostalCodes, searchPostOffices, searchPostalCodes };
|
|
92
|
+
export type { PostOffice };
|
package/dist/postal.d.ts
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
|
+
/** A delivery post office from Pakistan Post's post code directory. */
|
|
2
|
+
interface PostOffice {
|
|
3
|
+
/** 5-digit post code, e.g. `48330`. */
|
|
4
|
+
code: string;
|
|
5
|
+
/** Office name as the directory gives it, in title case, e.g. `Dulmial`. */
|
|
6
|
+
office: string;
|
|
7
|
+
/**
|
|
8
|
+
* The city the office belongs to when that is known (`Lahore` for an office
|
|
9
|
+
* in Lahore); otherwise the office's own name, which for most offices is
|
|
10
|
+
* its town or village.
|
|
11
|
+
*/
|
|
12
|
+
town: string;
|
|
13
|
+
/**
|
|
14
|
+
* The district, when the town is the headquarters a district is named
|
|
15
|
+
* after; otherwise `null`. The directory has no district column.
|
|
16
|
+
*/
|
|
17
|
+
district: string | null;
|
|
18
|
+
/** Province or territory. */
|
|
19
|
+
province: string;
|
|
20
|
+
}
|
|
1
21
|
/**
|
|
2
|
-
* Returns the
|
|
22
|
+
* Returns the delivery post office for a post code, from Pakistan Post's
|
|
23
|
+
* directory of about 2,560 offices.
|
|
24
|
+
*
|
|
25
|
+
* Unlike `getCityByPostalCode`, which only answers for codes in the cities
|
|
26
|
+
* pakdatakit lists, this knows every delivery office, including those in
|
|
27
|
+
* towns and villages.
|
|
28
|
+
*
|
|
29
|
+
* @param code - Post code (whitespace is ignored)
|
|
30
|
+
* @returns The post office, or `null` if the code is not in the directory
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* getPostOffice('48330');
|
|
34
|
+
* // { code: '48330', office: 'Dulmial', town: 'Dulmial', district: null, province: 'Punjab' }
|
|
35
|
+
*/
|
|
36
|
+
declare function getPostOffice(code: string): PostOffice | null;
|
|
37
|
+
/**
|
|
38
|
+
* Searches Pakistan Post's directory by office name, town or post code.
|
|
39
|
+
*
|
|
40
|
+
* Matching is case-insensitive: an office matches when its name or town
|
|
41
|
+
* contains the query, or its code starts with it.
|
|
42
|
+
*
|
|
43
|
+
* @param query - Partial office name, town or post code
|
|
44
|
+
* @returns Matching post offices, sorted by post code
|
|
45
|
+
*/
|
|
46
|
+
declare function searchPostOffices(query: string): PostOffice[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns the city for a Pakistani postal code.
|
|
50
|
+
*
|
|
51
|
+
* Only codes of post offices in a city on pakdatakit's city list return a
|
|
52
|
+
* city (`54660` → `Lahore`). The code of a post office in a town or village
|
|
53
|
+
* that is not on the list returns `null`; use `getPostOffice` for those.
|
|
3
54
|
*
|
|
4
55
|
* @param postalCode - Postal code to look up (whitespace is ignored)
|
|
5
56
|
* @returns City name or `null` if not found
|
|
@@ -37,4 +88,5 @@ declare function searchPostalCodes(query: string): string[];
|
|
|
37
88
|
*/
|
|
38
89
|
declare function getPostalAreas(city: string): string[];
|
|
39
90
|
|
|
40
|
-
export { getCityByPostalCode, getPostalAreas, getPostalCode, getPostalCodes, searchPostalCodes };
|
|
91
|
+
export { getCityByPostalCode, getPostOffice, getPostalAreas, getPostalCode, getPostalCodes, searchPostOffices, searchPostalCodes };
|
|
92
|
+
export type { PostOffice };
|
package/dist/postal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getCityByPostalCode, getPostalAreas, getPostalCode, getPostalCodes, searchPostalCodes } from './chunk-
|
|
1
|
+
export { getCityByPostalCode, getPostOffice, getPostalAreas, getPostalCode, getPostalCodes, searchPostOffices, searchPostalCodes } from './chunk-33QMFE2Z.js';
|
|
2
2
|
import './chunk-ENQ7O7VW.js';
|
package/dist/raast.cjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk2OBKPYJZ_cjs = require('./chunk-2OBKPYJZ.cjs');
|
|
4
|
+
require('./chunk-DHOP7LQX.cjs');
|
|
5
5
|
require('./chunk-VPBMIYO2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "createMerchantQr", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk2OBKPYJZ_cjs.createMerchantQr; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "createRaastP2PQr", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk2OBKPYJZ_cjs.createRaastP2PQr; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "parseRaastQr", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk2OBKPYJZ_cjs.parseRaastQr; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "validateRaastQr", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunk2OBKPYJZ_cjs.validateRaastQr; }
|
|
24
24
|
});
|
package/dist/raast.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr } from './chunk-KRYHLYN2.js';
|
|
2
|
+
import './chunk-IBZPJS4H.js';
|
|
3
3
|
import './chunk-ENQ7O7VW.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTBTWZC74_cjs = require('./chunk-TBTWZC74.cjs');
|
|
4
|
+
require('./chunk-SQIHFEXI.cjs');
|
|
5
|
+
require('./chunk-AUQFA7EE.cjs');
|
|
6
|
+
require('./chunk-7E7L3NYS.cjs');
|
|
7
|
+
require('./chunk-ESKXG7Y6.cjs');
|
|
8
|
+
require('./chunk-MTS6SVNP.cjs');
|
|
9
|
+
require('./chunk-YTLE5K7G.cjs');
|
|
10
|
+
require('./chunk-H6M6L26S.cjs');
|
|
11
|
+
require('./chunk-HTCSHHOR.cjs');
|
|
12
|
+
require('./chunk-DHOP7LQX.cjs');
|
|
13
|
+
require('./chunk-VPBMIYO2.cjs');
|
|
14
|
+
var superstruct = require('superstruct');
|
|
15
|
+
|
|
16
|
+
function schema(name) {
|
|
17
|
+
const rule = chunkTBTWZC74_cjs.RULES[name];
|
|
18
|
+
return (options = {}) => superstruct.refine(
|
|
19
|
+
superstruct.string(),
|
|
20
|
+
`pk-${name}`,
|
|
21
|
+
(value) => rule.test(value) || (options.message ?? rule.message)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
var pk = {
|
|
25
|
+
cnic: schema("cnic"),
|
|
26
|
+
phone: schema("phone"),
|
|
27
|
+
iban: schema("iban"),
|
|
28
|
+
ntn: schema("ntn"),
|
|
29
|
+
strn: schema("strn"),
|
|
30
|
+
landline: schema("landline"),
|
|
31
|
+
passport: schema("passport"),
|
|
32
|
+
vehiclePlate: schema("vehiclePlate")
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.pk = pk;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as superstruct from 'superstruct';
|
|
2
|
+
import { A as AdapterOptions } from './rules-GxgPiVws.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Superstruct structs for Pakistani identifiers.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { object, optional } from 'superstruct';
|
|
9
|
+
* import { pk } from 'pakdatakit/superstruct';
|
|
10
|
+
*
|
|
11
|
+
* const form = object({ cnic: pk.cnic(), phone: optional(pk.phone()) });
|
|
12
|
+
*/
|
|
13
|
+
declare const pk: {
|
|
14
|
+
cnic: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
15
|
+
phone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
16
|
+
iban: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
17
|
+
ntn: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
18
|
+
strn: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
19
|
+
landline: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
20
|
+
passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
21
|
+
vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { AdapterOptions, pk };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as superstruct from 'superstruct';
|
|
2
|
+
import { A as AdapterOptions } from './rules-GxgPiVws.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Superstruct structs for Pakistani identifiers.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { object, optional } from 'superstruct';
|
|
9
|
+
* import { pk } from 'pakdatakit/superstruct';
|
|
10
|
+
*
|
|
11
|
+
* const form = object({ cnic: pk.cnic(), phone: optional(pk.phone()) });
|
|
12
|
+
*/
|
|
13
|
+
declare const pk: {
|
|
14
|
+
cnic: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
15
|
+
phone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
16
|
+
iban: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
17
|
+
ntn: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
18
|
+
strn: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
19
|
+
landline: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
20
|
+
passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
21
|
+
vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { AdapterOptions, pk };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RULES } from './chunk-YTSMFGTW.js';
|
|
2
|
+
import './chunk-RZQJAZKC.js';
|
|
3
|
+
import './chunk-LQHM3ADX.js';
|
|
4
|
+
import './chunk-E6HSKRAE.js';
|
|
5
|
+
import './chunk-S274QFFB.js';
|
|
6
|
+
import './chunk-V2XE3NCG.js';
|
|
7
|
+
import './chunk-P7LVE2TF.js';
|
|
8
|
+
import './chunk-CEPNSHIC.js';
|
|
9
|
+
import './chunk-EEVNLTB4.js';
|
|
10
|
+
import './chunk-IBZPJS4H.js';
|
|
11
|
+
import './chunk-ENQ7O7VW.js';
|
|
12
|
+
import { refine, string } from 'superstruct';
|
|
13
|
+
|
|
14
|
+
function schema(name) {
|
|
15
|
+
const rule = RULES[name];
|
|
16
|
+
return (options = {}) => refine(
|
|
17
|
+
string(),
|
|
18
|
+
`pk-${name}`,
|
|
19
|
+
(value) => rule.test(value) || (options.message ?? rule.message)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
var pk = {
|
|
23
|
+
cnic: schema("cnic"),
|
|
24
|
+
phone: schema("phone"),
|
|
25
|
+
iban: schema("iban"),
|
|
26
|
+
ntn: schema("ntn"),
|
|
27
|
+
strn: schema("strn"),
|
|
28
|
+
landline: schema("landline"),
|
|
29
|
+
passport: schema("passport"),
|
|
30
|
+
vehiclePlate: schema("vehiclePlate")
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { pk };
|
package/dist/valibot.cjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
3
|
+
var chunkTBTWZC74_cjs = require('./chunk-TBTWZC74.cjs');
|
|
4
|
+
require('./chunk-SQIHFEXI.cjs');
|
|
5
|
+
require('./chunk-AUQFA7EE.cjs');
|
|
6
|
+
require('./chunk-7E7L3NYS.cjs');
|
|
7
|
+
require('./chunk-ESKXG7Y6.cjs');
|
|
8
|
+
require('./chunk-MTS6SVNP.cjs');
|
|
9
|
+
require('./chunk-YTLE5K7G.cjs');
|
|
8
10
|
require('./chunk-H6M6L26S.cjs');
|
|
9
11
|
require('./chunk-HTCSHHOR.cjs');
|
|
10
|
-
require('./chunk-
|
|
12
|
+
require('./chunk-DHOP7LQX.cjs');
|
|
11
13
|
require('./chunk-VPBMIYO2.cjs');
|
|
12
14
|
var v = require('valibot');
|
|
13
15
|
|
|
@@ -32,7 +34,7 @@ function _interopNamespace(e) {
|
|
|
32
34
|
var v__namespace = /*#__PURE__*/_interopNamespace(v);
|
|
33
35
|
|
|
34
36
|
function schema(name) {
|
|
35
|
-
const rule =
|
|
37
|
+
const rule = chunkTBTWZC74_cjs.RULES[name];
|
|
36
38
|
return (options = {}) => v__namespace.pipe(v__namespace.string(), v__namespace.check(rule.test, options.message ?? rule.message));
|
|
37
39
|
}
|
|
38
40
|
var pk = {
|
|
@@ -41,7 +43,9 @@ var pk = {
|
|
|
41
43
|
iban: schema("iban"),
|
|
42
44
|
ntn: schema("ntn"),
|
|
43
45
|
strn: schema("strn"),
|
|
44
|
-
landline: schema("landline")
|
|
46
|
+
landline: schema("landline"),
|
|
47
|
+
passport: schema("passport"),
|
|
48
|
+
vehiclePlate: schema("vehiclePlate")
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
exports.pk = pk;
|
package/dist/valibot.d.cts
CHANGED
|
@@ -17,6 +17,8 @@ declare const pk: {
|
|
|
17
17
|
ntn: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
18
18
|
strn: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
19
19
|
landline: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
20
|
+
passport: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
21
|
+
vehiclePlate: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export { AdapterOptions, pk };
|
package/dist/valibot.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ declare const pk: {
|
|
|
17
17
|
ntn: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
18
18
|
strn: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
19
19
|
landline: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
20
|
+
passport: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
21
|
+
vehiclePlate: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export { AdapterOptions, pk };
|