@geoalgeria/poste 1.0.2 → 1.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/README.md CHANGED
@@ -52,6 +52,13 @@ import offices from "@geoalgeria/poste/data/postoffices.json" with { type: "json
52
52
  // https://cdn.jsdelivr.net/npm/@geoalgeria/poste/data/postoffices.json
53
53
  ```
54
54
 
55
+ The loaders and record shapes are fully **typed** — TypeScript definitions ship in the package:
56
+
57
+ ```ts
58
+ import poste, { type PostOffice, type Atm } from "@geoalgeria/poste";
59
+ const offices: PostOffice[] = poste.postOffices();
60
+ ```
61
+
55
62
  **CSV and GeoJSON** are in the repo under [`data/`](data) and bundled in every
56
63
  [GitHub Release](https://github.com/yasserstudio/geoalgeria/releases):
57
64
 
package/package.json CHANGED
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "name": "@geoalgeria/poste",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Algeria post offices (3908) and ATMs (2026) — real postal codes, bilingual names, coordinates, commune/wilaya linkage. Sourced from Algérie Poste (baridimap.poste.dz). JSON, CSV, GeoJSON.",
6
6
  "main": "index.js",
7
+ "types": "types/index.d.ts",
7
8
  "exports": {
8
- ".": "./index.js",
9
+ ".": {
10
+ "types": "./types/index.d.ts",
11
+ "default": "./index.js"
12
+ },
9
13
  "./data/*": "./data/*"
10
14
  },
11
15
  "files": [
12
16
  "data/**/*.json",
17
+ "types/",
13
18
  "index.js"
14
19
  ],
15
20
  "scripts": {
16
- "fetch": "node scripts/fetch.mjs"
21
+ "fetch": "node scripts/fetch.mjs",
22
+ "test": "node ../../scripts/validate-packages.mjs poste"
17
23
  },
18
24
  "keywords": [
19
25
  "algeria",
@@ -0,0 +1,93 @@
1
+ // Type definitions for @geoalgeria/poste
2
+ // Data sourced from Algérie Poste (baridimap.poste.dz).
3
+
4
+ /** A post office (bureau de poste). */
5
+ export interface PostOffice {
6
+ /** Numeric office id. */
7
+ id: number;
8
+ /** Office name (French / transliterated). */
9
+ name: string;
10
+ /** Office name in Arabic. */
11
+ name_ar: string;
12
+ /** Office class/category (e.g. "RP"). */
13
+ class: string;
14
+ /** 5-digit postal code. */
15
+ postal_code: string;
16
+ /** Previous postal code, if the office was renumbered. */
17
+ postal_code_old: string | null;
18
+ /** Street address. */
19
+ address: string;
20
+ /** 4-digit zero-padded commune code; links to geoalgeria communes. */
21
+ commune_code: string;
22
+ /** Commune name in French. */
23
+ commune_fr: string;
24
+ /** Commune name in Arabic. */
25
+ commune_ar: string;
26
+ /** Wilaya code as a string ("1".."58"). */
27
+ wilaya_code: string;
28
+ /** Wilaya name in French. */
29
+ wilaya_fr: string;
30
+ /** Wilaya name in Arabic. */
31
+ wilaya_ar: string;
32
+ /** Latitude, or null when the office is not geocoded. */
33
+ lat: number | null;
34
+ /** Longitude, or null when the office is not geocoded. */
35
+ lng: number | null;
36
+ }
37
+
38
+ /** An ATM (distributeur automatique). */
39
+ export interface Atm {
40
+ /** ATM id. */
41
+ id: string;
42
+ /** ATM name/label. */
43
+ name: string;
44
+ /** Operational status. */
45
+ status: string;
46
+ /** 5-digit postal code of the hosting office. */
47
+ postal_code: string;
48
+ /** Previous postal code, if renumbered. */
49
+ postal_code_old: string | null;
50
+ /** Street address. Currently null for every ATM (the source omits it); typed
51
+ * as `string | null` so a future populated value is not a breaking change. */
52
+ address: string | null;
53
+ /** Commune name in French. */
54
+ commune_fr: string;
55
+ /** Commune name in Arabic. */
56
+ commune_ar: string;
57
+ /** Wilaya code as a string ("1".."58"). */
58
+ wilaya_code: string;
59
+ /** Wilaya name in French. */
60
+ wilaya_fr: string;
61
+ /** Wilaya name in Arabic. */
62
+ wilaya_ar: string;
63
+ /** Latitude, or null when not geocoded. */
64
+ lat: number | null;
65
+ /** Longitude, or null when not geocoded. */
66
+ lng: number | null;
67
+ }
68
+
69
+ /** Dataset metadata (data/metadata.json). */
70
+ export interface Metadata {
71
+ source: string;
72
+ api: string;
73
+ license: string;
74
+ postoffices: number;
75
+ atms: number;
76
+ distinct_postal_codes: number;
77
+ /** ISO date (YYYY-MM-DD) the snapshot was generated. */
78
+ generated_at: string;
79
+ }
80
+
81
+ /** All post offices. */
82
+ export function postOffices(): PostOffice[];
83
+ /** All ATMs. */
84
+ export function atms(): Atm[];
85
+ /** Dataset metadata. */
86
+ export function metadata(): Metadata;
87
+
88
+ declare const _default: {
89
+ postOffices: typeof postOffices;
90
+ atms: typeof atms;
91
+ metadata: typeof metadata;
92
+ };
93
+ export default _default;