bd-geo-address 0.1.1
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/CHANGELOG.md +77 -0
- package/LICENSE +21 -0
- package/README.md +622 -0
- package/db/mongodb/bangladesh-address.json +29584 -0
- package/db/mysql/bangladesh-address.sql +3036 -0
- package/db/postgresql/bangladesh-address.sql +3034 -0
- package/db/sqlite/bangladesh-address.db +0 -0
- package/dist/index.d.mts +667 -0
- package/dist/index.d.ts +667 -0
- package/dist/index.js +29008 -0
- package/dist/index.mjs +28933 -0
- package/package.json +383 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `bd-geo-address` are documented here.
|
|
4
|
+
This project follows [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — 2024-06-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### Name-Based API
|
|
13
|
+
- `allDivision()` / `allDivisionBn()` — all 8 division names (English & Bangla)
|
|
14
|
+
- `divisionalDataOf()` / `divisionalDataOfBn()` — districts + upazilas of a division
|
|
15
|
+
- `isValidDivision()` / `isValidDivisionBn()` — division name validation
|
|
16
|
+
- `allDistricts()` / `allDistrictsBn()` — all 64 district names
|
|
17
|
+
- `districtsOf()` / `districtsOfBn()` — districts of a division
|
|
18
|
+
- `isValidDistrict()` / `isValidDistrictBn()` — district name validation
|
|
19
|
+
- `getDivisionOfDistrict()` / `getDivisionOfDistrictBn()` — parent division lookup
|
|
20
|
+
- `allUpazila()` / `allUpazilaNames()` / `allUpazilaNamesBn()` — all 595 upazilas
|
|
21
|
+
- `upazilasOf()` / `upazilasOfBn()` — upazilas of a district
|
|
22
|
+
- `upazilaNamesOf()` / `upazilaNamesOfBn()` — upazila name strings
|
|
23
|
+
- `upazilasOfDivision()` / `upazilasOfDivisionBn()` — upazilas of a division
|
|
24
|
+
- `upazilaNamesOfDivision()` / `upazilaNamesOfDivisionBn()` — names only
|
|
25
|
+
- `isUpazila()` / `isUpazilabn()` — correctly excludes metropolitan thanas
|
|
26
|
+
- `getUpazila()` / `getUpazilabn()` — upazila object lookup with disambiguation
|
|
27
|
+
- `getDistrictOfUpazila()` / `getDistrictOfUpazilabn()` — parent district
|
|
28
|
+
- `upazilaData` — raw Upazila[] constant
|
|
29
|
+
- `allThana()` / `allThanaNames()` — 26 metropolitan thanas
|
|
30
|
+
- `thanasOf()` / `thanasOfBn()` — thanas of a city district
|
|
31
|
+
- `thanaNamesOf()` / `thanaNamesOfBn()` — thana name strings
|
|
32
|
+
- `isThana()` / `isThanabn()` — thana name check with optional district disambiguation
|
|
33
|
+
- `getThana()` / `getThanabn()` — thana object lookup
|
|
34
|
+
- `thanaData` — raw Thana[] constant
|
|
35
|
+
- `searchLocations()` — cross-level partial English/Bangla search
|
|
36
|
+
|
|
37
|
+
#### FHIR Code-Based API
|
|
38
|
+
- `resolveCode()` — FHIR geocode → full BDAddress hierarchy
|
|
39
|
+
- `resolveCodes()` — bulk resolution
|
|
40
|
+
- `toAddressString()` — full formatted address string (en/bn)
|
|
41
|
+
- `toShortAddress()` — short address (lowest level + district)
|
|
42
|
+
- `toCustomAddress()` — custom level selection
|
|
43
|
+
- `getByCode()` — BDLocation by FHIR code
|
|
44
|
+
- `findByName()` / `findByNameBn()` — lookup by English/Bangla name
|
|
45
|
+
- `search()` — English-first then Bangla fallback search
|
|
46
|
+
- `getAllByLevel()` — all locations at a given level
|
|
47
|
+
- `getParent()` — immediate parent in hierarchy
|
|
48
|
+
- `getChildren()` — direct children in hierarchy
|
|
49
|
+
- `getAllDescendants()` — all descendants with optional level filter
|
|
50
|
+
- `getHierarchy()` — hierarchy without formatted strings
|
|
51
|
+
- `isValidCode()` — code existence check
|
|
52
|
+
- `isValidName()` / `isValidNameBn()` — name existence check
|
|
53
|
+
- `isChildOf()` — ancestry check
|
|
54
|
+
- `getLevel()` — administrative level of a code
|
|
55
|
+
- `getByPostalCode()` — postal entry lookup
|
|
56
|
+
- `getPostalCode()` / `getPostalCodeBn()` — postal code by post office name
|
|
57
|
+
- `getPostalCodesByArea()` / `getPostalCodesByAreaBn()` — postal codes by area
|
|
58
|
+
- `getFhirCodeFromPostal()` — linked FHIR code from postal code
|
|
59
|
+
- `resolvePostalCode()` — postal code → full BDAddress
|
|
60
|
+
- `getCoordinates()` — lat/lng of a location
|
|
61
|
+
- `getNearestLocation()` — nearest location to a point (Haversine)
|
|
62
|
+
- `getLocationsWithinRadius()` — locations within a radius
|
|
63
|
+
|
|
64
|
+
#### Data & Exports
|
|
65
|
+
- `DivisionName` enum for autocomplete-friendly division names
|
|
66
|
+
- `DistrictName` string literal union (all 64 districts)
|
|
67
|
+
- `BDLocation`, `BDAddress`, `BDPostalEntry`, `Upazila`, `Thana`, `SearchResult` interfaces
|
|
68
|
+
- `LocationLevel` type
|
|
69
|
+
- Bundled dataset: 8 divisions, 64 districts, 595 upazilas, 26 metropolitan thanas, 848 unions, 1343 postal codes
|
|
70
|
+
- Database dumps: MySQL, PostgreSQL, SQLite, MongoDB
|
|
71
|
+
|
|
72
|
+
#### Build
|
|
73
|
+
- CJS + ESM dual output via `tsup`
|
|
74
|
+
- TypeScript declaration files (`.d.ts` + `.d.ts.map`)
|
|
75
|
+
- `npm run build:data` — rebuild `bd-geodata.json` from raw sources
|
|
76
|
+
- `npm run build:db` — regenerate all 4 database dump files
|
|
77
|
+
- `npm run build:coords` — extract centroids from HDX shapefiles
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 bd-geo-address contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|