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.
- package/DATA.md +512 -34
- package/LICENSE +1 -1
- package/NOTICE +14 -0
- package/README.md +472 -28
- package/dist/address.cjs +6 -5
- package/dist/address.js +4 -3
- package/dist/bills.cjs +19 -0
- package/dist/bills.d.cts +63 -0
- package/dist/bills.d.ts +63 -0
- package/dist/bills.js +2 -0
- package/dist/{chunk-4VSGCQ6K.cjs → chunk-2OBKPYJZ.cjs} +3 -3
- package/dist/chunk-33GOK7EE.cjs +5312 -0
- package/dist/chunk-33QMFE2Z.js +21244 -0
- package/dist/chunk-34U2ZMHR.js +194 -0
- package/dist/chunk-4GSBHJX6.js +165 -0
- package/dist/chunk-5DDHO5Z7.cjs +565 -0
- package/dist/chunk-5EY5DQS7.js +51 -0
- package/dist/chunk-5RGX4DWF.js +559 -0
- package/dist/chunk-5UCRHVI4.cjs +302 -0
- package/dist/{chunk-TTARJWGT.js → chunk-7DY26QPN.js} +2 -2
- package/dist/chunk-7E7L3NYS.cjs +11 -0
- package/dist/{chunk-3ZA265SK.cjs → chunk-AUQFA7EE.cjs} +172 -4
- package/dist/{chunk-QKH7W2CC.js → chunk-B7DOQ5QF.js} +6 -5
- package/dist/{chunk-HBOZIITD.js → chunk-CADQM4ZN.js} +14 -14
- package/dist/chunk-CF6AMRBU.cjs +198 -0
- package/dist/chunk-CZOZB4K3.js +61 -0
- package/dist/{chunk-3IARSCO6.cjs → chunk-DHOP7LQX.cjs} +25 -14
- package/dist/chunk-E2XU6NOW.js +909 -0
- package/dist/chunk-E6GWBOKV.cjs +911 -0
- package/dist/chunk-E6HSKRAE.js +9 -0
- package/dist/chunk-EA3SIHYT.js +313 -0
- package/dist/{chunk-33FXHM2E.cjs → chunk-ESKXG7Y6.cjs} +5 -5
- package/dist/chunk-I7UUPD3G.cjs +21252 -0
- package/dist/{chunk-YPPKY5XZ.js → chunk-IBZPJS4H.js} +26 -15
- package/dist/chunk-IDTRFOQW.js +35 -0
- 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-OTI7HY55.js +297 -0
- package/dist/{chunk-6IPPANNX.js → chunk-P7LVE2TF.js} +2 -2
- package/dist/{chunk-47P7HILD.cjs → chunk-QFPEFD67.cjs} +9 -8
- package/dist/chunk-RZQJAZKC.js +22 -0
- package/dist/{chunk-PLDVGOKZ.js → chunk-S274QFFB.js} +2 -2
- package/dist/chunk-SF4ECUZ6.cjs +56 -0
- package/dist/chunk-SQIHFEXI.cjs +25 -0
- package/dist/{chunk-NAJGGUAM.cjs → chunk-TC3VRWZV.cjs} +2 -2
- package/dist/{chunk-U7MWHXMF.cjs → chunk-TVL6RDAU.cjs} +4 -4
- package/dist/chunk-UYFTXD4P.js +168 -0
- package/dist/{chunk-AZV45DMG.js → chunk-V2XE3NCG.js} +2 -2
- package/dist/chunk-XCFZKCV2.cjs +37 -0
- package/dist/chunk-XOTCIXY6.js +5301 -0
- package/dist/chunk-XVEG53NN.cjs +322 -0
- package/dist/chunk-YDUXIENX.cjs +172 -0
- package/dist/chunk-YPAWNWFD.cjs +168 -0
- package/dist/chunk-YQFI7W3I.cjs +65 -0
- package/dist/{chunk-NTD4JLDW.cjs → chunk-YTLE5K7G.cjs} +1 -1
- package/dist/{chunk-EMH4IP2U.js → chunk-ZRONAQBV.js} +1 -1
- package/dist/class-validator.cjs +65 -0
- package/dist/class-validator.d.cts +63 -0
- package/dist/class-validator.d.ts +63 -0
- package/dist/class-validator.js +54 -0
- package/dist/cli.js +1 -1
- package/dist/courier.cjs +16 -0
- package/dist/courier.d.cts +51 -0
- package/dist/courier.d.ts +51 -0
- package/dist/courier.js +3 -0
- package/dist/fbr-invoice.cjs +25 -0
- package/dist/fbr-invoice.d.cts +170 -0
- package/dist/fbr-invoice.d.ts +170 -0
- package/dist/fbr-invoice.js +4 -0
- package/dist/geo.cjs +23 -6
- package/dist/geo.d.cts +56 -1
- package/dist/geo.d.ts +56 -1
- package/dist/geo.js +2 -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/incometax.cjs +27 -0
- package/dist/incometax.d.cts +91 -0
- package/dist/incometax.d.ts +91 -0
- package/dist/incometax.js +2 -0
- package/dist/index.cjs +253 -111
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +25 -15
- package/dist/input.cjs +9 -9
- package/dist/input.js +3 -3
- package/dist/joi.cjs +43 -0
- package/dist/joi.d.cts +25 -0
- package/dist/joi.d.ts +25 -0
- package/dist/joi.js +37 -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/quality.cjs +25 -0
- package/dist/quality.d.cts +62 -0
- package/dist/quality.d.ts +62 -0
- package/dist/quality.js +8 -0
- package/dist/raast.cjs +6 -6
- package/dist/raast.js +2 -2
- package/dist/salestax.cjs +20 -0
- package/dist/salestax.d.cts +106 -0
- package/dist/salestax.d.ts +106 -0
- package/dist/salestax.js +3 -0
- package/dist/superstruct.cjs +41 -0
- package/dist/superstruct.d.cts +25 -0
- package/dist/superstruct.d.ts +25 -0
- package/dist/superstruct.js +39 -0
- package/dist/text.cjs +21 -5
- package/dist/text.d.cts +90 -1
- package/dist/text.d.ts +90 -1
- package/dist/text.js +1 -1
- package/dist/valibot.cjs +18 -8
- package/dist/valibot.d.cts +3 -0
- package/dist/valibot.d.ts +3 -0
- package/dist/valibot.js +17 -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 +18 -8
- package/dist/yup.d.cts +3 -0
- package/dist/yup.d.ts +3 -0
- package/dist/yup.js +17 -7
- package/dist/zod.cjs +18 -8
- package/dist/zod.d.cts +3 -0
- package/dist/zod.d.ts +3 -0
- package/dist/zod.js +17 -7
- package/package.json +167 -6
- 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-HUQY2WR5.js +0 -20
- package/dist/chunk-JKE4AMSZ.js +0 -47
- package/dist/chunk-KEHCTYLO.cjs +0 -52
- package/dist/chunk-LIYNKIKS.js +0 -709
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/** Version of PRAL's technical specification this module follows. */
|
|
2
|
+
declare const FBR_DI_SPEC_VERSION = "1.12";
|
|
3
|
+
/** `invoiceType` values in the specification. */
|
|
4
|
+
type FbrInvoiceType = 'Sale Invoice' | 'Debit Note';
|
|
5
|
+
/** `buyerRegistrationType` values in the specification. */
|
|
6
|
+
type FbrRegistrationType = 'Registered' | 'Unregistered';
|
|
7
|
+
/** One line of an invoice (spec §4.1, `items`). Amounts are in rupees. */
|
|
8
|
+
interface FbrInvoiceItem {
|
|
9
|
+
/** HS code, e.g. `0101.2100`. */
|
|
10
|
+
hsCode: string;
|
|
11
|
+
productDescription: string;
|
|
12
|
+
/** Rate as FBR's SaleTypeToRate API describes it: `18%`, `Rs.3`, `Exempt` … */
|
|
13
|
+
rate: string;
|
|
14
|
+
/** Unit of measure as in FBR's UoM API, e.g. `Numbers, pieces, units`. */
|
|
15
|
+
uoM: string;
|
|
16
|
+
/** Up to 4 decimals. */
|
|
17
|
+
quantity: number;
|
|
18
|
+
/** "Total Sales Value (Including Tax)". FBR's own samples send 0. */
|
|
19
|
+
totalValues: number;
|
|
20
|
+
valueSalesExcludingST: number;
|
|
21
|
+
/** Notified or retail price; required for Third Schedule goods. */
|
|
22
|
+
fixedNotifiedValueOrRetailPrice: number;
|
|
23
|
+
salesTaxApplicable: number;
|
|
24
|
+
salesTaxWithheldAtSource: number;
|
|
25
|
+
extraTax?: number;
|
|
26
|
+
furtherTax?: number;
|
|
27
|
+
/** Required when the rate is not 18% (error 0077). */
|
|
28
|
+
sroScheduleNo?: string;
|
|
29
|
+
fedPayable?: number;
|
|
30
|
+
discount?: number;
|
|
31
|
+
/** Sale type as in FBR's transaction type API, e.g. `Goods at standard rate (default)`. */
|
|
32
|
+
saleType: string;
|
|
33
|
+
/** Required when `sroScheduleNo` is given (error 0078). */
|
|
34
|
+
sroItemSerialNo?: string;
|
|
35
|
+
}
|
|
36
|
+
/** The invoice body for `postinvoicedata` and `validateinvoicedata` (spec §4.1, §4.2). */
|
|
37
|
+
interface FbrInvoice {
|
|
38
|
+
invoiceType: FbrInvoiceType;
|
|
39
|
+
/** `YYYY-MM-DD`. */
|
|
40
|
+
invoiceDate: string;
|
|
41
|
+
/** 7-digit NTN or 13-digit CNIC. */
|
|
42
|
+
sellerNTNCNIC: string;
|
|
43
|
+
sellerBusinessName: string;
|
|
44
|
+
sellerProvince: string;
|
|
45
|
+
sellerAddress: string;
|
|
46
|
+
/** 7-digit NTN or 13-digit CNIC; may be empty for an unregistered buyer. */
|
|
47
|
+
buyerNTNCNIC: string;
|
|
48
|
+
buyerBusinessName: string;
|
|
49
|
+
buyerProvince: string;
|
|
50
|
+
buyerAddress: string;
|
|
51
|
+
buyerRegistrationType: FbrRegistrationType;
|
|
52
|
+
/** FBR invoice number of the original invoice; required for a debit note. */
|
|
53
|
+
invoiceRefNo: string;
|
|
54
|
+
/** Sandbox only: `SN001` to `SN028`. */
|
|
55
|
+
scenarioId?: string;
|
|
56
|
+
items: FbrInvoiceItem[];
|
|
57
|
+
}
|
|
58
|
+
/** An item for {@link buildFbrInvoice}: the tax may be left out. */
|
|
59
|
+
type FbrInvoiceItemInput = Omit<FbrInvoiceItem, 'salesTaxApplicable' | 'salesTaxWithheldAtSource' | 'totalValues' | 'fixedNotifiedValueOrRetailPrice'> & {
|
|
60
|
+
salesTaxApplicable?: number;
|
|
61
|
+
salesTaxWithheldAtSource?: number;
|
|
62
|
+
totalValues?: number;
|
|
63
|
+
fixedNotifiedValueOrRetailPrice?: number;
|
|
64
|
+
};
|
|
65
|
+
/** Input for {@link buildFbrInvoice}. */
|
|
66
|
+
type FbrInvoiceInput = Omit<FbrInvoice, 'items' | 'invoiceRefNo' | 'buyerNTNCNIC'> & {
|
|
67
|
+
invoiceRefNo?: string;
|
|
68
|
+
buyerNTNCNIC?: string;
|
|
69
|
+
items: FbrInvoiceItemInput[];
|
|
70
|
+
};
|
|
71
|
+
/** Column totals of an invoice, in rupees. Not sent to FBR. */
|
|
72
|
+
interface FbrInvoiceTotals {
|
|
73
|
+
quantity: number;
|
|
74
|
+
valueSalesExcludingST: number;
|
|
75
|
+
salesTaxApplicable: number;
|
|
76
|
+
salesTaxWithheldAtSource: number;
|
|
77
|
+
extraTax: number;
|
|
78
|
+
furtherTax: number;
|
|
79
|
+
fedPayable: number;
|
|
80
|
+
discount: number;
|
|
81
|
+
}
|
|
82
|
+
/** Result of {@link buildFbrInvoice}. */
|
|
83
|
+
interface FbrInvoiceBuild {
|
|
84
|
+
invoice: FbrInvoice;
|
|
85
|
+
totals: FbrInvoiceTotals;
|
|
86
|
+
}
|
|
87
|
+
/** One problem found by {@link validateFbrInvoice}. */
|
|
88
|
+
interface FbrInvoiceError {
|
|
89
|
+
/**
|
|
90
|
+
* FBR's error code (spec §7 and the Error Message Guide), or `null` for a
|
|
91
|
+
* required field the specification gives no code for.
|
|
92
|
+
*/
|
|
93
|
+
code: string | null;
|
|
94
|
+
/** Where: `invoiceDate`, `items[0].rate` … */
|
|
95
|
+
field: string;
|
|
96
|
+
message: string;
|
|
97
|
+
}
|
|
98
|
+
/** Result of {@link validateFbrInvoice}. */
|
|
99
|
+
interface FbrInvoiceValidation {
|
|
100
|
+
valid: boolean;
|
|
101
|
+
errors: FbrInvoiceError[];
|
|
102
|
+
}
|
|
103
|
+
/** Options for {@link validateFbrInvoice}. */
|
|
104
|
+
interface FbrInvoiceValidationOptions {
|
|
105
|
+
/** Today as `YYYY-MM-DD`, to reject invoices dated later (error 0043). Not checked when left out. */
|
|
106
|
+
today?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The sales tax FBR expects on a line, in rupees, or `null` when the rate is
|
|
110
|
+
* not a plain percentage or per-unit amount (spec §7, errors 0102, 0104,
|
|
111
|
+
* 0105):
|
|
112
|
+
*
|
|
113
|
+
* - `N%` on Third Schedule goods: retail price × rate (0102);
|
|
114
|
+
* - `N%` otherwise: value excluding sales tax × rate (0104);
|
|
115
|
+
* - `Rs.N`: quantity × N (0105).
|
|
116
|
+
*
|
|
117
|
+
* Rounded half up to the paisa (the specification allows 2 decimals and
|
|
118
|
+
* gives no rounding rule).
|
|
119
|
+
*/
|
|
120
|
+
declare function expectedSalesTax(item: {
|
|
121
|
+
rate: string;
|
|
122
|
+
saleType?: string;
|
|
123
|
+
quantity?: number;
|
|
124
|
+
valueSalesExcludingST?: number;
|
|
125
|
+
fixedNotifiedValueOrRetailPrice?: number;
|
|
126
|
+
}): number | null;
|
|
127
|
+
/**
|
|
128
|
+
* Builds an FBR digital invoice from your own fields, working out
|
|
129
|
+
* `salesTaxApplicable` on each line where you leave it out (see
|
|
130
|
+
* {@link expectedSalesTax}; uses `calculateSalesTax`). Lines with a rate
|
|
131
|
+
* that is neither `N%` nor `Rs.N` (`Exempt`, combined rates) get 0 unless you
|
|
132
|
+
* give the tax.
|
|
133
|
+
*
|
|
134
|
+
* `salesTaxWithheldAtSource`, `totalValues` and
|
|
135
|
+
* `fixedNotifiedValueOrRetailPrice` default to 0, and `invoiceRefNo` and
|
|
136
|
+
* `buyerNTNCNIC` to `""`, as in FBR's samples. Nothing else is filled in or
|
|
137
|
+
* changed; check the result with {@link validateFbrInvoice}.
|
|
138
|
+
*
|
|
139
|
+
* Also returns column totals, which are for your own records: the
|
|
140
|
+
* specification has no invoice-level totals.
|
|
141
|
+
*
|
|
142
|
+
* @returns The invoice and totals, or `null` if `input` is not an object
|
|
143
|
+
* with an `items` array. Never throws.
|
|
144
|
+
*/
|
|
145
|
+
declare function buildFbrInvoice(input: FbrInvoiceInput): FbrInvoiceBuild | null;
|
|
146
|
+
/**
|
|
147
|
+
* Checks an FBR digital invoice against the rules of PRAL's specification
|
|
148
|
+
* (v1.12) and Error Message Guide that need no call to FBR, and returns every
|
|
149
|
+
* problem with FBR's error code.
|
|
150
|
+
*
|
|
151
|
+
* Checked: invoice type (0003, 0011), date format (0005, 0042, 0113) and,
|
|
152
|
+
* with `options.today`, a future date (0043); seller and buyer NTN/CNIC
|
|
153
|
+
* (0401, 0402, 0009), self-invoicing (0058), names, provinces (0073, 0074),
|
|
154
|
+
* addresses, buyer registration type (0012), the reference number of a debit
|
|
155
|
+
* note (0026), the sandbox scenario, and on each line: HS code (0044), rate
|
|
156
|
+
* (0020), unit, sale type (0013), required and valid amounts (0021, 0023,
|
|
157
|
+
* 0024, 0098, 0300, 0302), SRO schedule and serial (0077, 0078), Third
|
|
158
|
+
* Schedule retail price (0090), extra tax on reduced-rate goods (0091) and
|
|
159
|
+
* the sales tax arithmetic (0102, 0104, 0105, to within one paisa).
|
|
160
|
+
*
|
|
161
|
+
* Not checked, because they need FBR's data: registration status, whether a
|
|
162
|
+
* province, HS code, unit, rate, sale type or SRO is in FBR's lists or fits
|
|
163
|
+
* the others, and the original invoice of a debit note.
|
|
164
|
+
*
|
|
165
|
+
* @returns `{ valid, errors }`. Never throws.
|
|
166
|
+
*/
|
|
167
|
+
declare function validateFbrInvoice(invoice: FbrInvoice, options?: FbrInvoiceValidationOptions): FbrInvoiceValidation;
|
|
168
|
+
|
|
169
|
+
export { FBR_DI_SPEC_VERSION, buildFbrInvoice, expectedSalesTax, validateFbrInvoice };
|
|
170
|
+
export type { FbrInvoice, FbrInvoiceBuild, FbrInvoiceError, FbrInvoiceInput, FbrInvoiceItem, FbrInvoiceItemInput, FbrInvoiceTotals, FbrInvoiceType, FbrInvoiceValidation, FbrInvoiceValidationOptions, FbrRegistrationType };
|
package/dist/geo.cjs
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk33GOK7EE_cjs = require('./chunk-33GOK7EE.cjs');
|
|
4
|
+
require('./chunk-E6GWBOKV.cjs');
|
|
4
5
|
require('./chunk-VPBMIYO2.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
Object.defineProperty(exports, "getDistrictProvince", {
|
|
9
10
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk33GOK7EE_cjs.getDistrictProvince; }
|
|
11
12
|
});
|
|
12
13
|
Object.defineProperty(exports, "getDistrictsByProvince", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk33GOK7EE_cjs.getDistrictsByProvince; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getDivisionOfDistrict", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk33GOK7EE_cjs.getDivisionOfDistrict; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "getDivisions", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunk33GOK7EE_cjs.getDivisions; }
|
|
15
24
|
});
|
|
16
25
|
Object.defineProperty(exports, "getProvince", {
|
|
17
26
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk33GOK7EE_cjs.getProvince; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "getTehsilDistrict", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunk33GOK7EE_cjs.getTehsilDistrict; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "getTehsils", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunk33GOK7EE_cjs.getTehsils; }
|
|
19
36
|
});
|
|
20
37
|
Object.defineProperty(exports, "searchCities", {
|
|
21
38
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunk33GOK7EE_cjs.searchCities; }
|
|
23
40
|
});
|
|
24
41
|
Object.defineProperty(exports, "searchDistricts", {
|
|
25
42
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunk33GOK7EE_cjs.searchDistricts; }
|
|
27
44
|
});
|
package/dist/geo.d.cts
CHANGED
|
@@ -39,5 +39,60 @@ declare function searchDistricts(query: string): string[];
|
|
|
39
39
|
* @returns Alphabetically sorted district names
|
|
40
40
|
*/
|
|
41
41
|
declare function getDistrictsByProvince(province: string): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns the administrative divisions of Pakistan, or of one province.
|
|
44
|
+
*
|
|
45
|
+
* The list is the 30 divisions of the 2023 census: Punjab 9, Sindh 6, Khyber
|
|
46
|
+
* Pakhtunkhwa 7 and Balochistan 8. Islamabad has no division, and the census
|
|
47
|
+
* tables do not cover Azad Jammu and Kashmir or Gilgit-Baltistan. Divisions
|
|
48
|
+
* created since the census (such as Gujrat in Punjab) are not included.
|
|
49
|
+
*
|
|
50
|
+
* @param province - Optional province name (case-insensitive)
|
|
51
|
+
* @returns Alphabetically sorted division names
|
|
52
|
+
*/
|
|
53
|
+
declare function getDivisions(province?: string): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Returns the division a district belonged to in the 2023 census.
|
|
56
|
+
*
|
|
57
|
+
* Census-district caveat: only the 136 districts of the 2023 census have a
|
|
58
|
+
* division here, under the name they had then (so `Quetta`, `Dera Bugti` and
|
|
59
|
+
* `South Waziristan` work, and their successors do not). Districts created
|
|
60
|
+
* after the census, and those of Azad Jammu and Kashmir, Gilgit-Baltistan and
|
|
61
|
+
* Islamabad, return `null`.
|
|
62
|
+
*
|
|
63
|
+
* @param district - District name (case-insensitive)
|
|
64
|
+
* @returns Division name or `null` if not known
|
|
65
|
+
*/
|
|
66
|
+
declare function getDivisionOfDistrict(district: string): string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the tehsils (talukas, sub-divisions) of a district.
|
|
69
|
+
*
|
|
70
|
+
* Census-district caveat: the data is the 591 tehsil-level units of the 2023
|
|
71
|
+
* census, each recorded under the district it was in then. For a district of
|
|
72
|
+
* the 2023 census this returns its census tehsils, even if some have since
|
|
73
|
+
* moved to a new district (so `Rawalpindi` still lists Murree). For a
|
|
74
|
+
* district created after the census it returns only the tehsils an official
|
|
75
|
+
* source places in it, which can be an empty list. Azad Jammu and Kashmir
|
|
76
|
+
* and Gilgit-Baltistan are not covered.
|
|
77
|
+
*
|
|
78
|
+
* @param district - District name (case-insensitive); former names such as
|
|
79
|
+
* `Quetta` and `South Waziristan` work
|
|
80
|
+
* @returns Alphabetically sorted tehsil names
|
|
81
|
+
*/
|
|
82
|
+
declare function getTehsils(district: string): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Returns the district a tehsil was in at the 2023 census.
|
|
85
|
+
*
|
|
86
|
+
* Census-district caveat: the result is the census district, which may have
|
|
87
|
+
* been split since (a tehsil of `Quetta` is now in Quetta East or Quetta
|
|
88
|
+
* West). A few names are shared by tehsils in different districts (`Saddar`,
|
|
89
|
+
* `Sahiwal`, `Khanpur`); pass the province to tell them apart. Returns
|
|
90
|
+
* `null` when the name is unknown or still matches more than one district.
|
|
91
|
+
*
|
|
92
|
+
* @param tehsil - Tehsil, taluka or sub-division name (case-insensitive)
|
|
93
|
+
* @param province - Optional province to narrow the search
|
|
94
|
+
* @returns District name or `null`
|
|
95
|
+
*/
|
|
96
|
+
declare function getTehsilDistrict(tehsil: string, province?: string): string | null;
|
|
42
97
|
|
|
43
|
-
export { getDistrictProvince, getDistrictsByProvince, getProvince, searchCities, searchDistricts };
|
|
98
|
+
export { getDistrictProvince, getDistrictsByProvince, getDivisionOfDistrict, getDivisions, getProvince, getTehsilDistrict, getTehsils, searchCities, searchDistricts };
|
package/dist/geo.d.ts
CHANGED
|
@@ -39,5 +39,60 @@ declare function searchDistricts(query: string): string[];
|
|
|
39
39
|
* @returns Alphabetically sorted district names
|
|
40
40
|
*/
|
|
41
41
|
declare function getDistrictsByProvince(province: string): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns the administrative divisions of Pakistan, or of one province.
|
|
44
|
+
*
|
|
45
|
+
* The list is the 30 divisions of the 2023 census: Punjab 9, Sindh 6, Khyber
|
|
46
|
+
* Pakhtunkhwa 7 and Balochistan 8. Islamabad has no division, and the census
|
|
47
|
+
* tables do not cover Azad Jammu and Kashmir or Gilgit-Baltistan. Divisions
|
|
48
|
+
* created since the census (such as Gujrat in Punjab) are not included.
|
|
49
|
+
*
|
|
50
|
+
* @param province - Optional province name (case-insensitive)
|
|
51
|
+
* @returns Alphabetically sorted division names
|
|
52
|
+
*/
|
|
53
|
+
declare function getDivisions(province?: string): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Returns the division a district belonged to in the 2023 census.
|
|
56
|
+
*
|
|
57
|
+
* Census-district caveat: only the 136 districts of the 2023 census have a
|
|
58
|
+
* division here, under the name they had then (so `Quetta`, `Dera Bugti` and
|
|
59
|
+
* `South Waziristan` work, and their successors do not). Districts created
|
|
60
|
+
* after the census, and those of Azad Jammu and Kashmir, Gilgit-Baltistan and
|
|
61
|
+
* Islamabad, return `null`.
|
|
62
|
+
*
|
|
63
|
+
* @param district - District name (case-insensitive)
|
|
64
|
+
* @returns Division name or `null` if not known
|
|
65
|
+
*/
|
|
66
|
+
declare function getDivisionOfDistrict(district: string): string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the tehsils (talukas, sub-divisions) of a district.
|
|
69
|
+
*
|
|
70
|
+
* Census-district caveat: the data is the 591 tehsil-level units of the 2023
|
|
71
|
+
* census, each recorded under the district it was in then. For a district of
|
|
72
|
+
* the 2023 census this returns its census tehsils, even if some have since
|
|
73
|
+
* moved to a new district (so `Rawalpindi` still lists Murree). For a
|
|
74
|
+
* district created after the census it returns only the tehsils an official
|
|
75
|
+
* source places in it, which can be an empty list. Azad Jammu and Kashmir
|
|
76
|
+
* and Gilgit-Baltistan are not covered.
|
|
77
|
+
*
|
|
78
|
+
* @param district - District name (case-insensitive); former names such as
|
|
79
|
+
* `Quetta` and `South Waziristan` work
|
|
80
|
+
* @returns Alphabetically sorted tehsil names
|
|
81
|
+
*/
|
|
82
|
+
declare function getTehsils(district: string): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Returns the district a tehsil was in at the 2023 census.
|
|
85
|
+
*
|
|
86
|
+
* Census-district caveat: the result is the census district, which may have
|
|
87
|
+
* been split since (a tehsil of `Quetta` is now in Quetta East or Quetta
|
|
88
|
+
* West). A few names are shared by tehsils in different districts (`Saddar`,
|
|
89
|
+
* `Sahiwal`, `Khanpur`); pass the province to tell them apart. Returns
|
|
90
|
+
* `null` when the name is unknown or still matches more than one district.
|
|
91
|
+
*
|
|
92
|
+
* @param tehsil - Tehsil, taluka or sub-division name (case-insensitive)
|
|
93
|
+
* @param province - Optional province to narrow the search
|
|
94
|
+
* @returns District name or `null`
|
|
95
|
+
*/
|
|
96
|
+
declare function getTehsilDistrict(tehsil: string, province?: string): string | null;
|
|
42
97
|
|
|
43
|
-
export { getDistrictProvince, getDistrictsByProvince, getProvince, searchCities, searchDistricts };
|
|
98
|
+
export { getDistrictProvince, getDistrictsByProvince, getDivisionOfDistrict, getDivisions, getProvince, getTehsilDistrict, getTehsils, searchCities, searchDistricts };
|
package/dist/geo.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { getDistrictProvince, getDistrictsByProvince, getProvince, searchCities, searchDistricts } from './chunk-
|
|
1
|
+
export { getDistrictProvince, getDistrictsByProvince, getDivisionOfDistrict, getDivisions, getProvince, getTehsilDistrict, getTehsils, searchCities, searchDistricts } from './chunk-XOTCIXY6.js';
|
|
2
|
+
import './chunk-E2XU6NOW.js';
|
|
2
3
|
import './chunk-ENQ7O7VW.js';
|
package/dist/holidays.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ5ZF46NZ_cjs = require('./chunk-J5ZF46NZ.cjs');
|
|
4
4
|
require('./chunk-CYJJ7KGC.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "getHolidaysOn", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkJ5ZF46NZ_cjs.getHolidaysOn; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "getPakistanHolidays", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkJ5ZF46NZ_cjs.getPakistanHolidays; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "isPakistanHoliday", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkJ5ZF46NZ_cjs.isPakistanHoliday; }
|
|
19
19
|
});
|
package/dist/holidays.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getHolidaysOn, getPakistanHolidays, isPakistanHoliday } from './chunk-
|
|
1
|
+
export { getHolidaysOn, getPakistanHolidays, isPakistanHoliday } from './chunk-CADQM4ZN.js';
|
|
2
2
|
import './chunk-Z5JEIQVW.js';
|
package/dist/iban.cjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDHOP7LQX_cjs = require('./chunk-DHOP7LQX.cjs');
|
|
4
4
|
require('./chunk-VPBMIYO2.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "getBankFromIBAN", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkDHOP7LQX_cjs.getBankFromIBAN; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "getBankInfo", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkDHOP7LQX_cjs.getBankInfo; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "getBanks", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkDHOP7LQX_cjs.getBanks; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "validateIBAN", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkDHOP7LQX_cjs.validateIBAN; }
|
|
23
23
|
});
|
package/dist/iban.d.cts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/** Kind of institution, following the State Bank of Pakistan's grouping. */
|
|
2
|
-
type BankType = 'commercial' | 'islamic' | 'microfinance' | 'digital' | 'emi' | 'foreign' | 'specialized' | 'central';
|
|
2
|
+
type BankType = 'commercial' | 'public-sector' | 'islamic' | 'microfinance' | 'digital' | 'emi' | 'foreign' | 'specialized' | 'central';
|
|
3
3
|
/** A bank (or other institution) that issues Pakistani IBANs. */
|
|
4
4
|
interface BankInfo {
|
|
5
5
|
/** 4-letter IBAN bank code (characters 5–8 of the IBAN). */
|
|
6
6
|
code: string;
|
|
7
7
|
name: string;
|
|
8
8
|
/**
|
|
9
|
-
* `commercial
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
9
|
+
* `commercial` (a private commercial bank), `public-sector` (a public
|
|
10
|
+
* sector commercial bank, such as National Bank of Pakistan), `islamic`
|
|
11
|
+
* (full-fledged Islamic bank), `microfinance`, `digital` (digital retail
|
|
12
|
+
* bank), `emi` (electronic money institution such as a wallet), `foreign`
|
|
13
|
+
* (branch of a foreign bank), `specialized` or `central` (State Bank of
|
|
14
|
+
* Pakistan). The groups are the State Bank's.
|
|
13
15
|
*/
|
|
14
16
|
type: BankType;
|
|
15
|
-
/** `false` for banks that merged into another
|
|
17
|
+
/** `false` for banks that merged into another or have closed. */
|
|
16
18
|
active: boolean;
|
|
17
19
|
/** Code of the bank this one merged into, if it no longer exists. */
|
|
18
20
|
mergedInto: string | null;
|
package/dist/iban.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/** Kind of institution, following the State Bank of Pakistan's grouping. */
|
|
2
|
-
type BankType = 'commercial' | 'islamic' | 'microfinance' | 'digital' | 'emi' | 'foreign' | 'specialized' | 'central';
|
|
2
|
+
type BankType = 'commercial' | 'public-sector' | 'islamic' | 'microfinance' | 'digital' | 'emi' | 'foreign' | 'specialized' | 'central';
|
|
3
3
|
/** A bank (or other institution) that issues Pakistani IBANs. */
|
|
4
4
|
interface BankInfo {
|
|
5
5
|
/** 4-letter IBAN bank code (characters 5–8 of the IBAN). */
|
|
6
6
|
code: string;
|
|
7
7
|
name: string;
|
|
8
8
|
/**
|
|
9
|
-
* `commercial
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
9
|
+
* `commercial` (a private commercial bank), `public-sector` (a public
|
|
10
|
+
* sector commercial bank, such as National Bank of Pakistan), `islamic`
|
|
11
|
+
* (full-fledged Islamic bank), `microfinance`, `digital` (digital retail
|
|
12
|
+
* bank), `emi` (electronic money institution such as a wallet), `foreign`
|
|
13
|
+
* (branch of a foreign bank), `specialized` or `central` (State Bank of
|
|
14
|
+
* Pakistan). The groups are the State Bank's.
|
|
13
15
|
*/
|
|
14
16
|
type: BankType;
|
|
15
|
-
/** `false` for banks that merged into another
|
|
17
|
+
/** `false` for banks that merged into another or have closed. */
|
|
16
18
|
active: boolean;
|
|
17
19
|
/** Code of the bank this one merged into, if it no longer exists. */
|
|
18
20
|
mergedInto: string | null;
|
package/dist/iban.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getBankFromIBAN, getBankInfo, getBanks, validateIBAN } from './chunk-
|
|
1
|
+
export { getBankFromIBAN, getBankInfo, getBanks, validateIBAN } from './chunk-IBZPJS4H.js';
|
|
2
2
|
import './chunk-ENQ7O7VW.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5DDHO5Z7_cjs = require('./chunk-5DDHO5Z7.cjs');
|
|
4
|
+
require('./chunk-SF4ECUZ6.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "calculateMonthlySalaryTax", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk5DDHO5Z7_cjs.calculateMonthlySalaryTax; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "calculateSalaryTax", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk5DDHO5Z7_cjs.calculateSalaryTax; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "getSalaryTaxSlabs", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunk5DDHO5Z7_cjs.getSalaryTaxSlabs; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "getSalaryTaxYears", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunk5DDHO5Z7_cjs.getSalaryTaxYears; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getTaxYear", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunk5DDHO5Z7_cjs.getTaxYear; }
|
|
27
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One band of the salaried rate table: income above `over` (and up to
|
|
3
|
+
* `upTo`) pays `fixed` plus `rate` percent of the amount above `over`.
|
|
4
|
+
*/
|
|
5
|
+
interface SalaryTaxSlab {
|
|
6
|
+
/** Lower bound in rupees (income must exceed it). */
|
|
7
|
+
over: number;
|
|
8
|
+
/** Upper bound in rupees, or `null` for the top band. */
|
|
9
|
+
upTo: number | null;
|
|
10
|
+
/** Tax on the income up to `over`, in rupees. */
|
|
11
|
+
fixed: number;
|
|
12
|
+
/** Percent of the income above `over`. */
|
|
13
|
+
rate: number;
|
|
14
|
+
}
|
|
15
|
+
/** The salaried rate table for one tax year (1 July to 30 June). */
|
|
16
|
+
interface SalaryTaxYear {
|
|
17
|
+
/** The tax year, named after the June it ends in: 2026 is 1 July 2025 to 30 June 2026. */
|
|
18
|
+
taxYear: number;
|
|
19
|
+
/** `YYYY-MM-DD`, always 1 July. */
|
|
20
|
+
from: string;
|
|
21
|
+
/** `YYYY-MM-DD`, always 30 June. */
|
|
22
|
+
to: string;
|
|
23
|
+
/** The law that sets the table. */
|
|
24
|
+
law: string;
|
|
25
|
+
/** Official document. */
|
|
26
|
+
source: string;
|
|
27
|
+
slabs: SalaryTaxSlab[];
|
|
28
|
+
}
|
|
29
|
+
/** Options for {@link calculateSalaryTax} and {@link calculateMonthlySalaryTax}. */
|
|
30
|
+
interface SalaryTaxOptions {
|
|
31
|
+
/** Tax year, e.g. `2026`. Takes precedence over `date`. */
|
|
32
|
+
taxYear?: number;
|
|
33
|
+
/** A day in the tax year (`YYYY-MM-DD` or a `Date`). Defaults to today. */
|
|
34
|
+
date?: string | Date;
|
|
35
|
+
}
|
|
36
|
+
/** Result of {@link calculateSalaryTax}. */
|
|
37
|
+
interface SalaryTax {
|
|
38
|
+
/** Tax for the year, in rupees, rounded half up to the paisa. */
|
|
39
|
+
tax: number;
|
|
40
|
+
/** `tax / 12`, rounded half up to the paisa. */
|
|
41
|
+
monthly: number;
|
|
42
|
+
/** `tax` as a percent of the income, rounded half up to 2 decimals. */
|
|
43
|
+
effectiveRate: number;
|
|
44
|
+
/** The band the income falls in. */
|
|
45
|
+
slab: SalaryTaxSlab;
|
|
46
|
+
taxYear: number;
|
|
47
|
+
}
|
|
48
|
+
/** The tax year (July to June) that contains a date, or `null` for an invalid date. */
|
|
49
|
+
declare function getTaxYear(date?: string | Date): number | null;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the salaried rate table for a tax year: Division I of Part I of
|
|
52
|
+
* the First Schedule to the Income Tax Ordinance 2001, clause (2), which
|
|
53
|
+
* applies when salary is more than 75% of taxable income.
|
|
54
|
+
*
|
|
55
|
+
* Covers tax years 2020 to 2027, each from FBR's consolidated Ordinance.
|
|
56
|
+
*
|
|
57
|
+
* @param taxYear - e.g. `2026` (1 July 2025 to 30 June 2026). Defaults to
|
|
58
|
+
* the current tax year.
|
|
59
|
+
* @returns The table, or `null` for a year that is not covered. Never throws.
|
|
60
|
+
*/
|
|
61
|
+
declare function getSalaryTaxSlabs(taxYear?: number): SalaryTaxYear | null;
|
|
62
|
+
/** Which tax years {@link getSalaryTaxSlabs} covers, oldest first. */
|
|
63
|
+
declare function getSalaryTaxYears(): number[];
|
|
64
|
+
/**
|
|
65
|
+
* Income tax on a salaried individual's taxable income for a tax year, from
|
|
66
|
+
* the salaried rate table (see {@link getSalaryTaxSlabs}).
|
|
67
|
+
*
|
|
68
|
+
* The rate table only: the surcharge, tax credits, exemptions, the separate
|
|
69
|
+
* pension rate and withholding adjustments are not applied.
|
|
70
|
+
*
|
|
71
|
+
* @param annualIncome - Taxable income for the year in rupees, 0 to 1
|
|
72
|
+
* trillion (at most 2 decimals count)
|
|
73
|
+
* @returns The tax, or `null` for an invalid amount or a tax year that is
|
|
74
|
+
* not covered. Never throws.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* calculateSalaryTax(1_800_000, { taxYear: 2026 });
|
|
78
|
+
* // { tax: 72000, monthly: 6000, effectiveRate: 4, slab: { over: 1200000, … }, taxYear: 2026 }
|
|
79
|
+
*/
|
|
80
|
+
declare function calculateSalaryTax(annualIncome: number, options?: SalaryTaxOptions): SalaryTax | null;
|
|
81
|
+
/**
|
|
82
|
+
* {@link calculateSalaryTax} for a monthly salary: the income is
|
|
83
|
+
* `monthlySalary × 12`, and `monthly` is the tax to withhold each month.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* calculateMonthlySalaryTax(150_000, { taxYear: 2026 })?.monthly; // 6000
|
|
87
|
+
*/
|
|
88
|
+
declare function calculateMonthlySalaryTax(monthlySalary: number, options?: SalaryTaxOptions): SalaryTax | null;
|
|
89
|
+
|
|
90
|
+
export { calculateMonthlySalaryTax, calculateSalaryTax, getSalaryTaxSlabs, getSalaryTaxYears, getTaxYear };
|
|
91
|
+
export type { SalaryTax, SalaryTaxOptions, SalaryTaxSlab, SalaryTaxYear };
|