@code-plate/iran-cities 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.
@@ -1,25 +1,43 @@
1
+ type CityId = number;
2
+ type ProvinceId = number;
3
+ interface Coordinates {
4
+ lat: number;
5
+ lng: number;
6
+ }
1
7
  interface City {
8
+ id: CityId;
9
+ isCapital: boolean;
10
+ coordinates?: Coordinates;
2
11
  slug: CityKey;
3
- /** شناسه انگلیسی/لاتین شهر (kebab-case) - یکتا در سطح کل کشور نیست، در سطح استان یکتاست */
4
12
  en: string;
5
- /** نام فارسی شهر */
6
13
  fa: string;
7
14
  }
8
15
  interface Province {
9
- /** شناسه انگلیسی/لاتین استان (kebab-case) - یکتا در سطح کشور */
16
+ id: ProvinceId;
10
17
  en: string;
11
- /** نام فارسی استان */
12
18
  fa: string;
19
+ phoneCode: string;
20
+ capitalId: CityId;
13
21
  cities: City[];
14
22
  }
15
- /** خروجی مسطح‌شده؛ برای جستجو و لیست‌های ساده مفید است */
23
+ interface ProvinceListItem {
24
+ id: ProvinceId;
25
+ en: string;
26
+ fa: string;
27
+ phoneCode: string;
28
+ capitalId: CityId;
29
+ }
16
30
  interface FlatCity extends City {
31
+ provinceId: ProvinceId;
17
32
  provinceEn: string;
18
33
  provinceFa: string;
34
+ phoneCode: string;
19
35
  }
20
36
  type Locale = 'en' | 'fa';
21
37
  /** کلید پایدار برای ارجاع به یک شهر (همان City.slug) - برای استفاده در پکیج‌های وابسته */
22
38
  type CityKey = string;
39
+ /** ورودی توابع lookup: id عددی، یا نام انگلیسی/فارسی */
40
+ type Query = string | number;
23
41
  interface SearchOptions {
24
42
  /** تعداد بیشینه نتایج (پیش‌فرض: بدون محدودیت) */
25
43
  limit?: number;
@@ -31,4 +49,4 @@ interface SearchOptions {
31
49
  maxDistance?: number;
32
50
  }
33
51
 
34
- export type { City as C, FlatCity as F, Locale as L, Province as P, SearchOptions as S, CityKey as a };
52
+ export type { City as C, FlatCity as F, Locale as L, Province as P, Query as Q, SearchOptions as S, CityId as a, CityKey as b, ProvinceId as c, ProvinceListItem as d, Coordinates as e };
@@ -1,25 +1,43 @@
1
+ type CityId = number;
2
+ type ProvinceId = number;
3
+ interface Coordinates {
4
+ lat: number;
5
+ lng: number;
6
+ }
1
7
  interface City {
8
+ id: CityId;
9
+ isCapital: boolean;
10
+ coordinates?: Coordinates;
2
11
  slug: CityKey;
3
- /** شناسه انگلیسی/لاتین شهر (kebab-case) - یکتا در سطح کل کشور نیست، در سطح استان یکتاست */
4
12
  en: string;
5
- /** نام فارسی شهر */
6
13
  fa: string;
7
14
  }
8
15
  interface Province {
9
- /** شناسه انگلیسی/لاتین استان (kebab-case) - یکتا در سطح کشور */
16
+ id: ProvinceId;
10
17
  en: string;
11
- /** نام فارسی استان */
12
18
  fa: string;
19
+ phoneCode: string;
20
+ capitalId: CityId;
13
21
  cities: City[];
14
22
  }
15
- /** خروجی مسطح‌شده؛ برای جستجو و لیست‌های ساده مفید است */
23
+ interface ProvinceListItem {
24
+ id: ProvinceId;
25
+ en: string;
26
+ fa: string;
27
+ phoneCode: string;
28
+ capitalId: CityId;
29
+ }
16
30
  interface FlatCity extends City {
31
+ provinceId: ProvinceId;
17
32
  provinceEn: string;
18
33
  provinceFa: string;
34
+ phoneCode: string;
19
35
  }
20
36
  type Locale = 'en' | 'fa';
21
37
  /** کلید پایدار برای ارجاع به یک شهر (همان City.slug) - برای استفاده در پکیج‌های وابسته */
22
38
  type CityKey = string;
39
+ /** ورودی توابع lookup: id عددی، یا نام انگلیسی/فارسی */
40
+ type Query = string | number;
23
41
  interface SearchOptions {
24
42
  /** تعداد بیشینه نتایج (پیش‌فرض: بدون محدودیت) */
25
43
  limit?: number;
@@ -31,4 +49,4 @@ interface SearchOptions {
31
49
  maxDistance?: number;
32
50
  }
33
51
 
34
- export type { City as C, FlatCity as F, Locale as L, Province as P, SearchOptions as S, CityKey as a };
52
+ export type { City as C, FlatCity as F, Locale as L, Province as P, Query as Q, SearchOptions as S, CityId as a, CityKey as b, ProvinceId as c, ProvinceListItem as d, Coordinates as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-plate/iran-cities",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "لیست کامل استان‌ها و شهرهای ایران (فارسی/انگلیسی) به‌همراه ابزارهای جستجو - بدون وابستگی، سازگار با هر فریمورک جاوااسکریپتی (React, Next.js, Vue, Angular, Node.js/Express و ...)",
5
5
  "keywords": [
6
6
  "iran",
@@ -45,8 +45,23 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "files": [
48
- "dist"
48
+ "dist",
49
+ "NOTICE.md"
49
50
  ],
51
+ "devDependencies": {
52
+ "@types/react": "^19.3.0",
53
+ "react": "^19.3.0",
54
+ "tsup": "^8.5.1",
55
+ "typescript": "^5"
56
+ },
57
+ "scripts": {
58
+ "build": "tsup",
59
+ "dev": "tsup --watch",
60
+ "typecheck": "tsc --noEmit",
61
+ "validate": "node scripts/validate-data.mjs",
62
+ "test": "npm run validate && npm run typecheck",
63
+ "prepublishOnly": "npm test && npm run build"
64
+ },
50
65
  "peerDependencies": {
51
66
  "react": ">=16.8.0"
52
67
  },
@@ -55,17 +70,6 @@
55
70
  "optional": true
56
71
  }
57
72
  },
58
- "devDependencies": {
59
- "@types/react": "^19.2.18",
60
- "react": "^19.2.8",
61
- "tsup": "^8.5.1",
62
- "typescript": "^5.9.3"
63
- },
64
- "scripts": {
65
- "build": "tsup",
66
- "dev": "tsup --watch",
67
- "typecheck": "tsc --noEmit"
68
- },
69
73
  "engines": {
70
74
  "node": ">=14"
71
75
  },
@@ -73,6 +77,6 @@
73
77
  "access": "public"
74
78
  },
75
79
  "allowScripts": {
76
- "esbuild@0.27.7": true
80
+ "esbuild@0.28.2": true
77
81
  }
78
82
  }