founder-schema 0.18.0 → 0.20.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 +110 -3
- package/dist/access/permissions.d.ts +3 -3
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js.map +1 -1
- package/dist/core/common.d.ts +49 -28
- package/dist/core/common.d.ts.map +1 -1
- package/dist/core/common.js +65 -26
- package/dist/core/common.js.map +1 -1
- package/dist/core/deletion.d.ts +40 -0
- package/dist/core/deletion.d.ts.map +1 -0
- package/dist/core/deletion.js +39 -0
- package/dist/core/deletion.js.map +1 -0
- package/dist/core/limits.d.ts +25 -0
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +25 -0
- package/dist/core/limits.js.map +1 -1
- package/dist/core/validation.d.ts +13 -0
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +13 -0
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +36 -12
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +9 -10
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +29 -13
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +2 -3
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/chat/chat.d.ts +19 -5
- package/dist/domains/chat/chat.d.ts.map +1 -1
- package/dist/domains/chat/chat.js +10 -10
- package/dist/domains/chat/chat.js.map +1 -1
- package/dist/domains/communities/communities.d.ts +95 -57
- package/dist/domains/communities/communities.d.ts.map +1 -1
- package/dist/domains/contributions/contributions.d.ts +28 -12
- package/dist/domains/contributions/contributions.d.ts.map +1 -1
- package/dist/domains/contributions/contributions.js +3 -0
- package/dist/domains/contributions/contributions.js.map +1 -1
- package/dist/domains/discover/discover.d.ts +2 -2
- package/dist/domains/feed/feed.d.ts +111 -63
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +3 -0
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/location/areas.d.ts +338 -0
- package/dist/domains/location/areas.d.ts.map +1 -0
- package/dist/domains/location/areas.js +241 -0
- package/dist/domains/location/areas.js.map +1 -0
- package/dist/domains/location/india.d.ts +31 -123
- package/dist/domains/location/india.d.ts.map +1 -1
- package/dist/domains/location/india.js +98 -64
- package/dist/domains/location/india.js.map +1 -1
- package/dist/domains/media/media.d.ts +22 -0
- package/dist/domains/media/media.d.ts.map +1 -1
- package/dist/domains/media/media.js +20 -0
- package/dist/domains/media/media.js.map +1 -1
- package/dist/domains/members/members.d.ts +26 -9
- package/dist/domains/members/members.d.ts.map +1 -1
- package/dist/domains/members/members.js +9 -10
- package/dist/domains/members/members.js.map +1 -1
- package/dist/domains/membership/membership.d.ts +19 -0
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +10 -0
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +8 -2
- package/dist/domains/moderation/moderation.d.ts.map +1 -1
- package/dist/domains/moderation/moderation.js +3 -6
- package/dist/domains/moderation/moderation.js.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +10 -6
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.d.ts +9 -12
- package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.js +12 -19
- package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +121 -98
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +30 -28
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/people/person.d.ts +54 -0
- package/dist/domains/people/person.d.ts.map +1 -0
- package/dist/domains/people/person.js +73 -0
- package/dist/domains/people/person.js.map +1 -0
- package/dist/domains/products/products.d.ts +62 -33
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +3 -0
- package/dist/domains/products/products.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +93 -60
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +55 -25
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/reviews/reviews.d.ts +25 -15
- package/dist/domains/reviews/reviews.d.ts.map +1 -1
- package/dist/domains/support/support.d.ts +47 -10
- package/dist/domains/support/support.d.ts.map +1 -1
- package/dist/domains/support/support.js +4 -2
- package/dist/domains/support/support.js.map +1 -1
- package/dist/domains/team/team.d.ts +9 -3
- package/dist/domains/team/team.d.ts.map +1 -1
- package/dist/domains/team/team.js +3 -6
- package/dist/domains/team/team.js.map +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/account.d.ts +0 -40
- package/dist/account.d.ts.map +0 -1
- package/dist/account.js +0 -39
- package/dist/account.js.map +0 -1
- package/dist/chat.d.ts +0 -187
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -189
- package/dist/chat.js.map +0 -1
- package/dist/common.d.ts +0 -304
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -340
- package/dist/common.js.map +0 -1
- package/dist/discover.d.ts +0 -245
- package/dist/discover.d.ts.map +0 -1
- package/dist/discover.js +0 -68
- package/dist/discover.js.map +0 -1
- package/dist/errors.d.ts +0 -85
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -89
- package/dist/errors.js.map +0 -1
- package/dist/feed.d.ts +0 -1658
- package/dist/feed.d.ts.map +0 -1
- package/dist/feed.js +0 -623
- package/dist/feed.js.map +0 -1
- package/dist/founder-profile.d.ts +0 -387
- package/dist/founder-profile.d.ts.map +0 -1
- package/dist/founder-profile.js +0 -180
- package/dist/founder-profile.js.map +0 -1
- package/dist/limits.d.ts +0 -76
- package/dist/limits.d.ts.map +0 -1
- package/dist/limits.js +0 -84
- package/dist/limits.js.map +0 -1
- package/dist/onboarding.d.ts +0 -1018
- package/dist/onboarding.d.ts.map +0 -1
- package/dist/onboarding.js +0 -717
- package/dist/onboarding.js.map +0 -1
- package/dist/responses/common.d.ts +0 -167
- package/dist/responses/common.d.ts.map +0 -1
- package/dist/responses/common.js +0 -67
- package/dist/responses/common.js.map +0 -1
- package/dist/responses/index.d.ts +0 -7
- package/dist/responses/index.d.ts.map +0 -1
- package/dist/responses/index.js +0 -7
- package/dist/responses/index.js.map +0 -1
- package/dist/uploads.d.ts +0 -113
- package/dist/uploads.d.ts.map +0 -1
- package/dist/uploads.js +0 -106
- package/dist/uploads.js.map +0 -1
- package/dist/validation.d.ts +0 -136
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -142
- package/dist/validation.js.map +0 -1
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* and cities (0.17.0, moved here from the web client, where the location step's
|
|
4
4
|
* lists lived in the screen).
|
|
5
5
|
*
|
|
6
|
-
* Founder Circle is in India for now (the user, 2026-10-18
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Founder Circle is in India for now (the user, 2026-10-18). Since 0.19.0 a
|
|
7
|
+
* member's location is picked from `master_db`'s area tree (`./areas.ts`), so
|
|
8
|
+
* this file no longer holds a write rule; it is the data that names a place
|
|
9
|
+
* the way members say it, read by every side:
|
|
9
10
|
*
|
|
10
11
|
* states all 28 states and 8 union territories, by their current names: a
|
|
11
12
|
* CLOSED list, so a state is one of these or refused (`stateUnknown`)
|
|
12
|
-
* cities per state, the larger cities first, the rest A to Z
|
|
13
|
-
*
|
|
14
|
-
* text, so the list spares members the typing and the spelling
|
|
15
|
-
* variants, and the picker also takes a town it does not hold
|
|
13
|
+
* cities per state, the larger cities first, the rest A to Z: the
|
|
14
|
+
* spellings Discover's city filter and a stored city are matched in
|
|
16
15
|
* aliases older or other names a member may search by ("Bangalore" finds
|
|
17
16
|
* Bengaluru), and the district names the location lookup answers
|
|
18
|
-
* with ("Bengaluru Urban"), so
|
|
17
|
+
* with ("Bengaluru Urban"), so a district's public city and a member's
|
|
19
18
|
* search land on the list's own spelling
|
|
20
19
|
*
|
|
21
20
|
* Written for this product from public knowledge of India's cities; no
|
|
@@ -23,7 +22,6 @@
|
|
|
23
22
|
*
|
|
24
23
|
* @module founder-schema/domains/location/india
|
|
25
24
|
*/
|
|
26
|
-
import { z } from 'zod';
|
|
27
25
|
import type { GST_STATES } from '../billing/gst.js';
|
|
28
26
|
/**
|
|
29
27
|
* A state or union territory, by the ONE list of their names: GST's
|
|
@@ -78,6 +76,30 @@ export declare function listedCityName(state: IndiaState | undefined, name: stri
|
|
|
78
76
|
* the list, India's unless a test hands it another.
|
|
79
77
|
*/
|
|
80
78
|
export declare function canonicalCityName(name: string, states?: readonly Pick<IndiaState, 'cities'>[]): string;
|
|
79
|
+
/**
|
|
80
|
+
* The town an urban body is, from the area tree's name for its council
|
|
81
|
+
* (0.19.0): "Gangtok (M Corp.)", "Kohima Municipal Council", "City Corporation
|
|
82
|
+
* Panaji", "Municipal Committee Akhnoor", "Rajgarh (Alwar)" (a bracket that
|
|
83
|
+
* tells two towns apart) are Gangtok, Kohima, Panaji, Akhnoor, Rajgarh. What
|
|
84
|
+
* is left is the town's own name; one the tree wrote in capitals ("MAUGANJ")
|
|
85
|
+
* reads like the rest (Mauganj).
|
|
86
|
+
*/
|
|
87
|
+
export declare function townName(council: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* The PUBLIC city of a place picked from the area tree (0.19.0): what cards
|
|
90
|
+
* show and Discover's city filter and facets match. A member in a town (they
|
|
91
|
+
* picked the town, or a ward in it) is in that town; anyone else is in their
|
|
92
|
+
* district (a village, a block, the whole district). Either way in the
|
|
93
|
+
* state's own spelling (`listedCityName`: "Bbmp" is Bengaluru, "Greater
|
|
94
|
+
* Mumbai" is Mumbai), else the name as the tree has it, cleaned
|
|
95
|
+
* (`townName`; "Lakshadweep District" is Lakshadweep). A town or district
|
|
96
|
+
* this list does not hold is still a real place, shown as it is.
|
|
97
|
+
*
|
|
98
|
+
* Always fits a stored city (`CITY_MAX`): a town named longer is shown as its
|
|
99
|
+
* district, and a district longer still is cut at a word. The all-India tree
|
|
100
|
+
* has none (its longest town or district is 35, 2026-10-22); a later tree may.
|
|
101
|
+
*/
|
|
102
|
+
export declare function publicCityOf(stateName: string, district: string, town?: string | null): string;
|
|
81
103
|
/**
|
|
82
104
|
* A place as the list writes it, from however it arrived: a member's older
|
|
83
105
|
* draft ("karnataka"), the location lookup ("Bengaluru Urban" in "KARNATAKA"),
|
|
@@ -98,118 +120,4 @@ export declare function canonicalIndiaLocation(place: {
|
|
|
98
120
|
state: string;
|
|
99
121
|
country: typeof INDIA;
|
|
100
122
|
};
|
|
101
|
-
/**
|
|
102
|
-
* A location as it is WRITTEN (0.17.0): onboarding's finish, the Me tab's
|
|
103
|
-
* personal details, and the server's own suggestion. India only, one of its
|
|
104
|
-
* states and union territories, and a city of any name within it.
|
|
105
|
-
*
|
|
106
|
-
* Until 0.17.0 the schema took any country and any state text while the web
|
|
107
|
-
* locked the country to India and chose the state from this list, so another
|
|
108
|
-
* client could store what no screen can show. The read side keeps
|
|
109
|
-
* `locationSchema`: a location stored before this rule is still read as it is.
|
|
110
|
-
*
|
|
111
|
-
* The STATE is required: every Indian city has one, and the picker lists a
|
|
112
|
-
* state's cities only once it is chosen. It is read the way people and the
|
|
113
|
-
* location lookup write it ("KARNATAKA", "Orissa", "Jammu & Kashmir" are the
|
|
114
|
-
* list's Karnataka, Odisha, Jammu and Kashmir: `findIndiaState`), so any client
|
|
115
|
-
* may send another spelling and the list's name is what is kept. Left empty it
|
|
116
|
-
* is `stateRequired`; one the list does not know is `stateUnknown`.
|
|
117
|
-
*/
|
|
118
|
-
export declare const indiaLocationSchema: z.ZodObject<{
|
|
119
|
-
city: z.ZodString;
|
|
120
|
-
state: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
121
|
-
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
122
|
-
"Himachal Pradesh": "Himachal Pradesh";
|
|
123
|
-
Punjab: "Punjab";
|
|
124
|
-
Chandigarh: "Chandigarh";
|
|
125
|
-
Uttarakhand: "Uttarakhand";
|
|
126
|
-
Haryana: "Haryana";
|
|
127
|
-
Delhi: "Delhi";
|
|
128
|
-
Rajasthan: "Rajasthan";
|
|
129
|
-
"Uttar Pradesh": "Uttar Pradesh";
|
|
130
|
-
Bihar: "Bihar";
|
|
131
|
-
Sikkim: "Sikkim";
|
|
132
|
-
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
133
|
-
Nagaland: "Nagaland";
|
|
134
|
-
Manipur: "Manipur";
|
|
135
|
-
Mizoram: "Mizoram";
|
|
136
|
-
Tripura: "Tripura";
|
|
137
|
-
Meghalaya: "Meghalaya";
|
|
138
|
-
Assam: "Assam";
|
|
139
|
-
"West Bengal": "West Bengal";
|
|
140
|
-
Jharkhand: "Jharkhand";
|
|
141
|
-
Odisha: "Odisha";
|
|
142
|
-
Chhattisgarh: "Chhattisgarh";
|
|
143
|
-
"Madhya Pradesh": "Madhya Pradesh";
|
|
144
|
-
Gujarat: "Gujarat";
|
|
145
|
-
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
146
|
-
Maharashtra: "Maharashtra";
|
|
147
|
-
Karnataka: "Karnataka";
|
|
148
|
-
Goa: "Goa";
|
|
149
|
-
Lakshadweep: "Lakshadweep";
|
|
150
|
-
Kerala: "Kerala";
|
|
151
|
-
"Tamil Nadu": "Tamil Nadu";
|
|
152
|
-
Puducherry: "Puducherry";
|
|
153
|
-
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
154
|
-
Telangana: "Telangana";
|
|
155
|
-
"Andhra Pradesh": "Andhra Pradesh";
|
|
156
|
-
Ladakh: "Ladakh";
|
|
157
|
-
}>>;
|
|
158
|
-
country: z.ZodLiteral<"India">;
|
|
159
|
-
}, z.core.$strip>;
|
|
160
|
-
export type IndiaLocation = z.infer<typeof indiaLocationSchema>;
|
|
161
|
-
/**
|
|
162
|
-
* The city these coordinates look like, for the member to CONFIRM, or `null`
|
|
163
|
-
* when the lookup could not place them confidently (or they are outside India,
|
|
164
|
-
* whose area data is all there is). A suggestion, never a write: only what the
|
|
165
|
-
* member then submits becomes their location.
|
|
166
|
-
*
|
|
167
|
-
* In the WRITE shape (0.17.0): the server names the state and city the way
|
|
168
|
-
* this list does (`findIndiaState`, `listedCityName`: the lookup's "Bengaluru
|
|
169
|
-
* Urban" is Bengaluru), so what it suggests is what the member could have
|
|
170
|
-
* picked, and saving it unchanged can never be refused.
|
|
171
|
-
*/
|
|
172
|
-
export declare const suggestedLocationSchema: z.ZodNullable<z.ZodObject<{
|
|
173
|
-
city: z.ZodString;
|
|
174
|
-
state: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>, z.ZodEnum<{
|
|
175
|
-
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
176
|
-
"Himachal Pradesh": "Himachal Pradesh";
|
|
177
|
-
Punjab: "Punjab";
|
|
178
|
-
Chandigarh: "Chandigarh";
|
|
179
|
-
Uttarakhand: "Uttarakhand";
|
|
180
|
-
Haryana: "Haryana";
|
|
181
|
-
Delhi: "Delhi";
|
|
182
|
-
Rajasthan: "Rajasthan";
|
|
183
|
-
"Uttar Pradesh": "Uttar Pradesh";
|
|
184
|
-
Bihar: "Bihar";
|
|
185
|
-
Sikkim: "Sikkim";
|
|
186
|
-
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
187
|
-
Nagaland: "Nagaland";
|
|
188
|
-
Manipur: "Manipur";
|
|
189
|
-
Mizoram: "Mizoram";
|
|
190
|
-
Tripura: "Tripura";
|
|
191
|
-
Meghalaya: "Meghalaya";
|
|
192
|
-
Assam: "Assam";
|
|
193
|
-
"West Bengal": "West Bengal";
|
|
194
|
-
Jharkhand: "Jharkhand";
|
|
195
|
-
Odisha: "Odisha";
|
|
196
|
-
Chhattisgarh: "Chhattisgarh";
|
|
197
|
-
"Madhya Pradesh": "Madhya Pradesh";
|
|
198
|
-
Gujarat: "Gujarat";
|
|
199
|
-
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
200
|
-
Maharashtra: "Maharashtra";
|
|
201
|
-
Karnataka: "Karnataka";
|
|
202
|
-
Goa: "Goa";
|
|
203
|
-
Lakshadweep: "Lakshadweep";
|
|
204
|
-
Kerala: "Kerala";
|
|
205
|
-
"Tamil Nadu": "Tamil Nadu";
|
|
206
|
-
Puducherry: "Puducherry";
|
|
207
|
-
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
208
|
-
Telangana: "Telangana";
|
|
209
|
-
"Andhra Pradesh": "Andhra Pradesh";
|
|
210
|
-
Ladakh: "Ladakh";
|
|
211
|
-
}>>;
|
|
212
|
-
country: z.ZodLiteral<"India">;
|
|
213
|
-
}, z.core.$strip>>;
|
|
214
|
-
export type SuggestedLocation = z.infer<typeof suggestedLocationSchema>;
|
|
215
123
|
//# sourceMappingURL=india.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"india.d.ts","sourceRoot":"","sources":["../../../src/domains/location/india.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"india.d.ts","sourceRoot":"","sources":["../../../src/domains/location/india.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED,qDAAqD;AACrD,eAAO,MAAM,KAAK,EAAG,OAAgB,CAAC;AAEtC,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,EAAG,KAAc,CAAC;AAEjD,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAy6B7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAqGpE,CAAC;AAUF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAOtF;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAyD,SAAS,CAC9F,cAAc,EACd,GAAG,cAAc,EAAE,CACpB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAErE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,SAAS,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAiB,GAC3D,MAAM,CAYR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuBhD;AAaD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAQ9F;AAqBD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,CAOA"}
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* and cities (0.17.0, moved here from the web client, where the location step's
|
|
4
4
|
* lists lived in the screen).
|
|
5
5
|
*
|
|
6
|
-
* Founder Circle is in India for now (the user, 2026-10-18
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Founder Circle is in India for now (the user, 2026-10-18). Since 0.19.0 a
|
|
7
|
+
* member's location is picked from `master_db`'s area tree (`./areas.ts`), so
|
|
8
|
+
* this file no longer holds a write rule; it is the data that names a place
|
|
9
|
+
* the way members say it, read by every side:
|
|
9
10
|
*
|
|
10
11
|
* states all 28 states and 8 union territories, by their current names: a
|
|
11
12
|
* CLOSED list, so a state is one of these or refused (`stateUnknown`)
|
|
12
|
-
* cities per state, the larger cities first, the rest A to Z
|
|
13
|
-
*
|
|
14
|
-
* text, so the list spares members the typing and the spelling
|
|
15
|
-
* variants, and the picker also takes a town it does not hold
|
|
13
|
+
* cities per state, the larger cities first, the rest A to Z: the
|
|
14
|
+
* spellings Discover's city filter and a stored city are matched in
|
|
16
15
|
* aliases older or other names a member may search by ("Bangalore" finds
|
|
17
16
|
* Bengaluru), and the district names the location lookup answers
|
|
18
|
-
* with ("Bengaluru Urban"), so
|
|
17
|
+
* with ("Bengaluru Urban"), so a district's public city and a member's
|
|
19
18
|
* search land on the list's own spelling
|
|
20
19
|
*
|
|
21
20
|
* Written for this product from public knowledge of India's cities; no
|
|
@@ -23,9 +22,7 @@
|
|
|
23
22
|
*
|
|
24
23
|
* @module founder-schema/domains/location/india
|
|
25
24
|
*/
|
|
26
|
-
import { z } from 'zod';
|
|
27
25
|
import { CITY_MAX } from '../../core/limits.js';
|
|
28
|
-
import { VALIDATION_MESSAGE } from '../../core/validation.js';
|
|
29
26
|
/** The one country a location may be in, for now. */
|
|
30
27
|
export const INDIA = 'India';
|
|
31
28
|
/** India's international dialing code: what a phone number is shown with (the stored number has none). */
|
|
@@ -154,6 +151,7 @@ export const INDIA_STATES = [
|
|
|
154
151
|
'Durg',
|
|
155
152
|
'Ambikapur',
|
|
156
153
|
'Bhatapara',
|
|
154
|
+
'Bijapur',
|
|
157
155
|
'Chirmiri',
|
|
158
156
|
'Dhamtari',
|
|
159
157
|
'Jagdalpur',
|
|
@@ -973,9 +971,12 @@ export const INDIA_STATES = [
|
|
|
973
971
|
* any of them shows the city as the list writes it.
|
|
974
972
|
*/
|
|
975
973
|
export const CITY_ALIASES = {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
974
|
+
// `Bbmp`: how the area tree names Bengaluru's council (0.19.0).
|
|
975
|
+
Bengaluru: ['Bangalore', 'Bengaluru Urban', 'Bangalore Urban', 'Bbmp', 'Bruhat Bengaluru'],
|
|
976
|
+
Mumbai: ['Bombay', 'Mumbai Suburban', 'Mumbai City', 'Greater Mumbai'],
|
|
977
|
+
Chennai: ['Madras', 'Greater Chennai'],
|
|
978
|
+
// The area tree's spelling (LGD).
|
|
979
|
+
Ahmedabad: ['Ahmadabad'],
|
|
979
980
|
Kolkata: ['Calcutta'],
|
|
980
981
|
Gurugram: ['Gurgaon'],
|
|
981
982
|
Noida: ['Gautam Buddha Nagar'],
|
|
@@ -1030,8 +1031,8 @@ export const CITY_ALIASES = {
|
|
|
1030
1031
|
Baharampur: ['Berhampore'],
|
|
1031
1032
|
Bardhaman: ['Burdwan', 'Purba Bardhaman'],
|
|
1032
1033
|
Sohra: ['Cherrapunji'],
|
|
1033
|
-
'Sri Vijaya Puram': ['Port Blair', 'South Andaman'],
|
|
1034
|
-
Mohali: ['SAS Nagar', 'Sahibzada Ajit Singh Nagar'],
|
|
1034
|
+
'Sri Vijaya Puram': ['Port Blair', 'South Andaman', 'South Andamans'],
|
|
1035
|
+
Mohali: ['SAS Nagar', 'Sahibzada Ajit Singh Nagar', 'S.A.S Nagar'],
|
|
1035
1036
|
Kurukshetra: ['Thanesar'],
|
|
1036
1037
|
Gyalshing: ['Geyzing'],
|
|
1037
1038
|
Siaha: ['Saiha'],
|
|
@@ -1073,7 +1074,7 @@ export const CITY_ALIASES = {
|
|
|
1073
1074
|
};
|
|
1074
1075
|
const key = (text) => text
|
|
1075
1076
|
.toLowerCase()
|
|
1076
|
-
.replace(/[.\s
|
|
1077
|
+
.replace(/[.\s&-]+/g, ' ')
|
|
1077
1078
|
.replace(/\band\b/g, ' ')
|
|
1078
1079
|
.replace(/\s+/g, ' ')
|
|
1079
1080
|
.trim();
|
|
@@ -1132,6 +1133,87 @@ export function canonicalCityName(name, states = INDIA_STATES) {
|
|
|
1132
1133
|
const [only] = found;
|
|
1133
1134
|
return found.size === 1 && only ? only : name;
|
|
1134
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* The town an urban body is, from the area tree's name for its council
|
|
1138
|
+
* (0.19.0): "Gangtok (M Corp.)", "Kohima Municipal Council", "City Corporation
|
|
1139
|
+
* Panaji", "Municipal Committee Akhnoor", "Rajgarh (Alwar)" (a bracket that
|
|
1140
|
+
* tells two towns apart) are Gangtok, Kohima, Panaji, Akhnoor, Rajgarh. What
|
|
1141
|
+
* is left is the town's own name; one the tree wrote in capitals ("MAUGANJ")
|
|
1142
|
+
* reads like the rest (Mauganj).
|
|
1143
|
+
*/
|
|
1144
|
+
export function townName(council) {
|
|
1145
|
+
const name = council
|
|
1146
|
+
.replace(/\([^)]*\)/g, ' ')
|
|
1147
|
+
.replace(/\.{2,}/g, ' ')
|
|
1148
|
+
.replace(/^\s*(city corporation|municipal committee|municipal council|municipal board|notified area committee|town area committee|nagar palika,)\s*/i, '')
|
|
1149
|
+
.replace(/\s+(municipal corporation|municipal council|municipal committee|municipal board|municipal co-?operation|muncipal council|town council|town committee|town area committee|notified area committee|cantonment board|corporation|municipality|nagar nigam|nagar palika parishad|nagar palika|nagar parishad|nagar panchayat|nagarpanchayat|mahanagara palike|mahanagar palika|mahanagarpalika)\s*$/i, '')
|
|
1150
|
+
// A twin town is one hyphen however the tree spaced it ("Murwara - Katni" is
|
|
1151
|
+
// Murwara-Katni), as the list writes its own (Pimpri-Chinchwad, Vasai-Virar).
|
|
1152
|
+
.replace(/\s*-\s*/g, '-')
|
|
1153
|
+
.replace(/\s+/g, ' ')
|
|
1154
|
+
.trim()
|
|
1155
|
+
.replace(/\.+$/, '');
|
|
1156
|
+
return /\p{Ll}/u.test(name)
|
|
1157
|
+
? name
|
|
1158
|
+
: name
|
|
1159
|
+
.toLowerCase()
|
|
1160
|
+
.replace(/(^|[\s-])(\p{L})/gu, (_, gap, c) => gap + c.toUpperCase());
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* States that are one city for the public (0.19.0): the area tree splits
|
|
1164
|
+
* Delhi into districts named by compass point ("South", "Central North"),
|
|
1165
|
+
* which no one calls their city. Any district not itself a listed city (New
|
|
1166
|
+
* Delhi is) is the state's city.
|
|
1167
|
+
*/
|
|
1168
|
+
const ONE_CITY_STATES = {
|
|
1169
|
+
Delhi: 'Delhi',
|
|
1170
|
+
Chandigarh: 'Chandigarh',
|
|
1171
|
+
};
|
|
1172
|
+
/**
|
|
1173
|
+
* The PUBLIC city of a place picked from the area tree (0.19.0): what cards
|
|
1174
|
+
* show and Discover's city filter and facets match. A member in a town (they
|
|
1175
|
+
* picked the town, or a ward in it) is in that town; anyone else is in their
|
|
1176
|
+
* district (a village, a block, the whole district). Either way in the
|
|
1177
|
+
* state's own spelling (`listedCityName`: "Bbmp" is Bengaluru, "Greater
|
|
1178
|
+
* Mumbai" is Mumbai), else the name as the tree has it, cleaned
|
|
1179
|
+
* (`townName`; "Lakshadweep District" is Lakshadweep). A town or district
|
|
1180
|
+
* this list does not hold is still a real place, shown as it is.
|
|
1181
|
+
*
|
|
1182
|
+
* Always fits a stored city (`CITY_MAX`): a town named longer is shown as its
|
|
1183
|
+
* district, and a district longer still is cut at a word. The all-India tree
|
|
1184
|
+
* has none (its longest town or district is 35, 2026-10-22); a later tree may.
|
|
1185
|
+
*/
|
|
1186
|
+
export function publicCityOf(stateName, district, town) {
|
|
1187
|
+
const city = cityOf(stateName, district, town);
|
|
1188
|
+
if (city.length <= CITY_MAX)
|
|
1189
|
+
return city;
|
|
1190
|
+
if (town)
|
|
1191
|
+
return publicCityOf(stateName, district);
|
|
1192
|
+
return city
|
|
1193
|
+
.slice(0, CITY_MAX + 1)
|
|
1194
|
+
.replace(/\s+\S*$/, '')
|
|
1195
|
+
.slice(0, CITY_MAX);
|
|
1196
|
+
}
|
|
1197
|
+
function cityOf(stateName, district, town) {
|
|
1198
|
+
const state = findIndiaState(stateName);
|
|
1199
|
+
const listed = (name) => listedCityName(state, name);
|
|
1200
|
+
const onList = (name) => Boolean(state?.cities.includes(name));
|
|
1201
|
+
const townCity = town ? townName(town) : '';
|
|
1202
|
+
if (townCity) {
|
|
1203
|
+
const named = listed(townCity);
|
|
1204
|
+
if (onList(named))
|
|
1205
|
+
return named;
|
|
1206
|
+
const oneCity = state ? ONE_CITY_STATES[state.name] : undefined;
|
|
1207
|
+
// A Delhi council named by compass ("East Delhi") is Delhi: listed above.
|
|
1208
|
+
return oneCity && /delhi/i.test(townCity) ? oneCity : named;
|
|
1209
|
+
}
|
|
1210
|
+
// A district's own brackets too ("Khandwa (East Nimar)" is Khandwa).
|
|
1211
|
+
const districtCity = listed(townName(district.replace(/\s+district\s*$/i, '')));
|
|
1212
|
+
if (onList(districtCity))
|
|
1213
|
+
return districtCity;
|
|
1214
|
+
const oneCity = state ? ONE_CITY_STATES[state.name] : undefined;
|
|
1215
|
+
return oneCity ?? districtCity;
|
|
1216
|
+
}
|
|
1135
1217
|
/**
|
|
1136
1218
|
* A place as the list writes it, from however it arrived: a member's older
|
|
1137
1219
|
* draft ("karnataka"), the location lookup ("Bengaluru Urban" in "KARNATAKA"),
|
|
@@ -1152,52 +1234,4 @@ export function canonicalIndiaLocation(place) {
|
|
|
1152
1234
|
country: INDIA,
|
|
1153
1235
|
};
|
|
1154
1236
|
}
|
|
1155
|
-
// ─── The rule ────────────────────────────────────────────────────────────────
|
|
1156
|
-
/**
|
|
1157
|
-
* A location as it is WRITTEN (0.17.0): onboarding's finish, the Me tab's
|
|
1158
|
-
* personal details, and the server's own suggestion. India only, one of its
|
|
1159
|
-
* states and union territories, and a city of any name within it.
|
|
1160
|
-
*
|
|
1161
|
-
* Until 0.17.0 the schema took any country and any state text while the web
|
|
1162
|
-
* locked the country to India and chose the state from this list, so another
|
|
1163
|
-
* client could store what no screen can show. The read side keeps
|
|
1164
|
-
* `locationSchema`: a location stored before this rule is still read as it is.
|
|
1165
|
-
*
|
|
1166
|
-
* The STATE is required: every Indian city has one, and the picker lists a
|
|
1167
|
-
* state's cities only once it is chosen. It is read the way people and the
|
|
1168
|
-
* location lookup write it ("KARNATAKA", "Orissa", "Jammu & Kashmir" are the
|
|
1169
|
-
* list's Karnataka, Odisha, Jammu and Kashmir: `findIndiaState`), so any client
|
|
1170
|
-
* may send another spelling and the list's name is what is kept. Left empty it
|
|
1171
|
-
* is `stateRequired`; one the list does not know is `stateUnknown`.
|
|
1172
|
-
*/
|
|
1173
|
-
export const indiaLocationSchema = z.object({
|
|
1174
|
-
city: z.string().trim().min(1).max(CITY_MAX),
|
|
1175
|
-
// A typed string in, the list's name out: never a preprocess (0.18.0: its
|
|
1176
|
-
// input read as `unknown`, so a caller typing the body by `z.input` could
|
|
1177
|
-
// send anything and still compile).
|
|
1178
|
-
// Missing, blank and unknown all reach the CHOICE (`invalid_value`, as a
|
|
1179
|
-
// picker's refusal always was): a form words an unchosen state "Choose your
|
|
1180
|
-
// state", not "fill this in" (0.18.0, ram's suite: a length check, then a
|
|
1181
|
-
// missing key, each changed that). Typed in: a string, or left out.
|
|
1182
|
-
state: z
|
|
1183
|
-
.string({ error: VALIDATION_MESSAGE.stateUnknown })
|
|
1184
|
-
.default('')
|
|
1185
|
-
.transform((given) => findIndiaState(given)?.name ?? given.trim())
|
|
1186
|
-
.pipe(z.enum(INDIA_STATE_NAMES, {
|
|
1187
|
-
error: (issue) => issue.input === '' ? VALIDATION_MESSAGE.stateRequired : VALIDATION_MESSAGE.stateUnknown,
|
|
1188
|
-
})),
|
|
1189
|
-
country: z.literal(INDIA),
|
|
1190
|
-
});
|
|
1191
|
-
/**
|
|
1192
|
-
* The city these coordinates look like, for the member to CONFIRM, or `null`
|
|
1193
|
-
* when the lookup could not place them confidently (or they are outside India,
|
|
1194
|
-
* whose area data is all there is). A suggestion, never a write: only what the
|
|
1195
|
-
* member then submits becomes their location.
|
|
1196
|
-
*
|
|
1197
|
-
* In the WRITE shape (0.17.0): the server names the state and city the way
|
|
1198
|
-
* this list does (`findIndiaState`, `listedCityName`: the lookup's "Bengaluru
|
|
1199
|
-
* Urban" is Bengaluru), so what it suggests is what the member could have
|
|
1200
|
-
* picked, and saving it unchanged can never be refused.
|
|
1201
|
-
*/
|
|
1202
|
-
export const suggestedLocationSchema = indiaLocationSchema.nullable();
|
|
1203
1237
|
//# sourceMappingURL=india.js.map
|