rwanda-geo-data 0.1.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/LICENSE +21 -0
- package/README.md +110 -0
- package/dist/index.cjs +17614 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +17597 -0
- package/package.json +61 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rwanda's administrative hierarchy, top to bottom:
|
|
3
|
+
* Province -> District -> Sector -> Cell -> Village
|
|
4
|
+
*
|
|
5
|
+
* Every level below Province carries an explicit foreign key to its
|
|
6
|
+
* direct parent (e.g. a District carries `provinceId`). Lookups are
|
|
7
|
+
* built off these FKs rather than by parsing structure out of the
|
|
8
|
+
* numeric IDs, so the API stays correct even if the ID scheme changes.
|
|
9
|
+
*/
|
|
10
|
+
interface Province {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface District {
|
|
15
|
+
id: number;
|
|
16
|
+
name: string;
|
|
17
|
+
provinceId: number;
|
|
18
|
+
}
|
|
19
|
+
interface Sector {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
districtId: number;
|
|
23
|
+
}
|
|
24
|
+
interface Cell {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
sectorId: number;
|
|
28
|
+
}
|
|
29
|
+
interface Village {
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
cellId: number;
|
|
33
|
+
}
|
|
34
|
+
/** Full resolved chain from a village up to its province. */
|
|
35
|
+
interface LocationPath {
|
|
36
|
+
village: Village;
|
|
37
|
+
cell: Cell;
|
|
38
|
+
sector: Sector;
|
|
39
|
+
district: District;
|
|
40
|
+
province: Province;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare function getProvinces(): readonly Province[];
|
|
44
|
+
declare function getProvinceById(id: number): Province | undefined;
|
|
45
|
+
declare function findProvinceByName(name: string): Province | undefined;
|
|
46
|
+
declare function getDistricts(provinceId?: number): readonly District[];
|
|
47
|
+
declare function getDistrictById(id: number): District | undefined;
|
|
48
|
+
declare function findDistrictByName(name: string, provinceId?: number): District | undefined;
|
|
49
|
+
declare function getSectors(districtId?: number): readonly Sector[];
|
|
50
|
+
declare function getSectorById(id: number): Sector | undefined;
|
|
51
|
+
declare function findSectorByName(name: string, districtId?: number): Sector | undefined;
|
|
52
|
+
declare function getCells(sectorId?: number): readonly Cell[];
|
|
53
|
+
declare function getCellById(id: number): Cell | undefined;
|
|
54
|
+
declare function findCellByName(name: string, sectorId?: number): Cell | undefined;
|
|
55
|
+
declare function getVillages(cellId?: number): readonly Village[];
|
|
56
|
+
declare function getVillageById(id: number): Village | undefined;
|
|
57
|
+
declare function findVillageByName(name: string, cellId?: number): Village | undefined;
|
|
58
|
+
/** Resolve a village all the way up to its province in one call. */
|
|
59
|
+
declare function getLocationPath(villageId: number): LocationPath | undefined;
|
|
60
|
+
|
|
61
|
+
export { type Cell, type District, type LocationPath, type Province, type Sector, type Village, findCellByName, findDistrictByName, findProvinceByName, findSectorByName, findVillageByName, getCellById, getCells, getDistrictById, getDistricts, getLocationPath, getProvinceById, getProvinces, getSectorById, getSectors, getVillageById, getVillages };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rwanda's administrative hierarchy, top to bottom:
|
|
3
|
+
* Province -> District -> Sector -> Cell -> Village
|
|
4
|
+
*
|
|
5
|
+
* Every level below Province carries an explicit foreign key to its
|
|
6
|
+
* direct parent (e.g. a District carries `provinceId`). Lookups are
|
|
7
|
+
* built off these FKs rather than by parsing structure out of the
|
|
8
|
+
* numeric IDs, so the API stays correct even if the ID scheme changes.
|
|
9
|
+
*/
|
|
10
|
+
interface Province {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface District {
|
|
15
|
+
id: number;
|
|
16
|
+
name: string;
|
|
17
|
+
provinceId: number;
|
|
18
|
+
}
|
|
19
|
+
interface Sector {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
districtId: number;
|
|
23
|
+
}
|
|
24
|
+
interface Cell {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
sectorId: number;
|
|
28
|
+
}
|
|
29
|
+
interface Village {
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
cellId: number;
|
|
33
|
+
}
|
|
34
|
+
/** Full resolved chain from a village up to its province. */
|
|
35
|
+
interface LocationPath {
|
|
36
|
+
village: Village;
|
|
37
|
+
cell: Cell;
|
|
38
|
+
sector: Sector;
|
|
39
|
+
district: District;
|
|
40
|
+
province: Province;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare function getProvinces(): readonly Province[];
|
|
44
|
+
declare function getProvinceById(id: number): Province | undefined;
|
|
45
|
+
declare function findProvinceByName(name: string): Province | undefined;
|
|
46
|
+
declare function getDistricts(provinceId?: number): readonly District[];
|
|
47
|
+
declare function getDistrictById(id: number): District | undefined;
|
|
48
|
+
declare function findDistrictByName(name: string, provinceId?: number): District | undefined;
|
|
49
|
+
declare function getSectors(districtId?: number): readonly Sector[];
|
|
50
|
+
declare function getSectorById(id: number): Sector | undefined;
|
|
51
|
+
declare function findSectorByName(name: string, districtId?: number): Sector | undefined;
|
|
52
|
+
declare function getCells(sectorId?: number): readonly Cell[];
|
|
53
|
+
declare function getCellById(id: number): Cell | undefined;
|
|
54
|
+
declare function findCellByName(name: string, sectorId?: number): Cell | undefined;
|
|
55
|
+
declare function getVillages(cellId?: number): readonly Village[];
|
|
56
|
+
declare function getVillageById(id: number): Village | undefined;
|
|
57
|
+
declare function findVillageByName(name: string, cellId?: number): Village | undefined;
|
|
58
|
+
/** Resolve a village all the way up to its province in one call. */
|
|
59
|
+
declare function getLocationPath(villageId: number): LocationPath | undefined;
|
|
60
|
+
|
|
61
|
+
export { type Cell, type District, type LocationPath, type Province, type Sector, type Village, findCellByName, findDistrictByName, findProvinceByName, findSectorByName, findVillageByName, getCellById, getCells, getDistrictById, getDistricts, getLocationPath, getProvinceById, getProvinces, getSectorById, getSectors, getVillageById, getVillages };
|