jansathi-community-schema 0.18.0 → 0.19.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.
@@ -27,6 +27,63 @@
27
27
  * @module community-schema/community
28
28
  */
29
29
  import { z } from 'zod';
30
+ /**
31
+ * Two fundamentally different community shapes share the same wire
32
+ * schema:
33
+ *
34
+ * user — topic-of-interest community a regular user creates and
35
+ * owns (Reddit subreddit / Facebook group analogue). Owner
36
+ * + admins manage; members join. The default kind.
37
+ * official — area-based civic community for a specific administrative
38
+ * area (village / block / district / urban body / ... up
39
+ * to state). Created by the elected area leader; has NO
40
+ * owner. Permission is computed at read time from the
41
+ * current area-leader binding:
42
+ * - admin role = whoever is the area's leader right now
43
+ * (falls back to platform superadmin when no leader is
44
+ * appointed)
45
+ * - representative role = the elected official the area
46
+ * leader names (Pradhan / Mayor / MLA / ...); replaced
47
+ * on each new political election
48
+ * - moderator role = community-scoped; can hide reported
49
+ * posts. Representative can override moderator
50
+ * decisions from settings.
51
+ * Always auto-verified (the leader's act of creating it IS
52
+ * the verification) and immune to delete from anyone
53
+ * except platform superadmin / manager.
54
+ */
55
+ export declare const COMMUNITY_KIND_VALUES: readonly ["user", "official"];
56
+ export type CommunityKind = (typeof COMMUNITY_KIND_VALUES)[number];
57
+ export declare const communityKindSchema: z.ZodEnum<{
58
+ user: "user";
59
+ official: "official";
60
+ }>;
61
+ /**
62
+ * Administrative area levels that can host an official community.
63
+ *
64
+ * Mirrors a subset of the reform-backend `JURISDICTION_LEVEL` enum —
65
+ * NATIONAL and GLOBAL are intentionally excluded because they are
66
+ * virtual tiers (no `Area` row) and don't fit the "community for THIS
67
+ * area" model. If we ever want national / global civic communities
68
+ * they should be a separate concept.
69
+ *
70
+ * The leader-jurisdiction → area-kind binding is 1:1:
71
+ * leader.jurisdictionLevel === community.officialAreaKind AND
72
+ * leader.jurisdictionAreaId === community.officialAreaId
73
+ * is the gate for who can create / admin the community.
74
+ */
75
+ export declare const OFFICIAL_COMMUNITY_AREA_KIND_VALUES: readonly ["STATE", "DISTRICT", "BLOCK", "GRAM_PANCHAYAT", "VILLAGE", "URBAN_BODY", "URBAN_WARD", "LOCALITY"];
76
+ export type OfficialCommunityAreaKind = (typeof OFFICIAL_COMMUNITY_AREA_KIND_VALUES)[number];
77
+ export declare const officialCommunityAreaKindSchema: z.ZodEnum<{
78
+ STATE: "STATE";
79
+ DISTRICT: "DISTRICT";
80
+ BLOCK: "BLOCK";
81
+ GRAM_PANCHAYAT: "GRAM_PANCHAYAT";
82
+ VILLAGE: "VILLAGE";
83
+ URBAN_BODY: "URBAN_BODY";
84
+ URBAN_WARD: "URBAN_WARD";
85
+ LOCALITY: "LOCALITY";
86
+ }>;
30
87
  /**
31
88
  * public — anyone can read + post.
32
89
  * restricted — anyone can read; only approved members can post. The
@@ -411,17 +468,37 @@ export declare const communityCenterCoordsSchema: z.ZodObject<{
411
468
  export type CommunityCenterCoords = z.infer<typeof communityCenterCoordsSchema>;
412
469
  /** Role hierarchy within a single community.
413
470
  *
414
- * owner — creator; cannot be demoted by anyone, can transfer
415
- * ownership (deferred for v1) and delete the community.
416
- * admin — granted by owner; can edit metadata, kick members,
417
- * soft-delete posts authored in the community.
418
- * member — joined; can post and comment, can leave at any time.
471
+ * The role set is shared across `user` and `official` communities, but
472
+ * not every role is valid for every kind:
473
+ *
474
+ * owner — `kind: 'user'` only. The creator; can edit
475
+ * metadata, transfer ownership (deferred), and
476
+ * delete the community.
477
+ * admin — `kind: 'user'`: granted by the owner; can edit
478
+ * metadata, kick members, soft-delete posts.
479
+ * `kind: 'official'`: computed from the current
480
+ * area-leader binding (never stored on a membership
481
+ * row); platform superadmin fills the slot when no
482
+ * leader is appointed.
483
+ * representative — `kind: 'official'` only. The elected official the
484
+ * area leader names (Pradhan / Mayor / ...).
485
+ * Replaced on every new political election. Can
486
+ * override moderator decisions from the community
487
+ * settings page.
488
+ * moderator — `kind: 'official'` only. Community-scoped; can
489
+ * hide reported posts. Multiple moderators allowed
490
+ * per community. The current admin (area leader)
491
+ * grants and revokes.
492
+ * member — joined; can post and comment, can leave at any
493
+ * time. Valid for both kinds.
419
494
  */
420
- export declare const COMMUNITY_ROLE_VALUES: readonly ["owner", "admin", "member"];
495
+ export declare const COMMUNITY_ROLE_VALUES: readonly ["owner", "admin", "representative", "moderator", "member"];
421
496
  export type CommunityRole = (typeof COMMUNITY_ROLE_VALUES)[number];
422
497
  export declare const communityRoleSchema: z.ZodEnum<{
423
498
  owner: "owner";
424
499
  admin: "admin";
500
+ representative: "representative";
501
+ moderator: "moderator";
425
502
  member: "member";
426
503
  }>;
427
504
  /** Membership lifecycle.
@@ -456,7 +533,12 @@ export declare const communityWireSchema: z.ZodObject<{
456
533
  restricted: "restricted";
457
534
  }>;
458
535
  coverImageUrl: z.ZodOptional<z.ZodString>;
459
- ownerUserId: z.ZodString;
536
+ kind: z.ZodEnum<{
537
+ user: "user";
538
+ official: "official";
539
+ }>;
540
+ ownerUserId: z.ZodNullable<z.ZodString>;
541
+ createdBy: z.ZodNullable<z.ZodString>;
460
542
  memberCount: z.ZodNumber;
461
543
  postCount: z.ZodNumber;
462
544
  groupId: z.ZodString;
@@ -703,10 +785,23 @@ export declare const communityWireSchema: z.ZodObject<{
703
785
  national: "national";
704
786
  global: "global";
705
787
  }>>;
788
+ officialAreaKind: z.ZodNullable<z.ZodEnum<{
789
+ STATE: "STATE";
790
+ DISTRICT: "DISTRICT";
791
+ BLOCK: "BLOCK";
792
+ GRAM_PANCHAYAT: "GRAM_PANCHAYAT";
793
+ VILLAGE: "VILLAGE";
794
+ URBAN_BODY: "URBAN_BODY";
795
+ URBAN_WARD: "URBAN_WARD";
796
+ LOCALITY: "LOCALITY";
797
+ }>>;
798
+ officialAreaId: z.ZodNullable<z.ZodString>;
706
799
  viewer: z.ZodOptional<z.ZodObject<{
707
800
  role: z.ZodNullable<z.ZodEnum<{
708
801
  owner: "owner";
709
802
  admin: "admin";
803
+ representative: "representative";
804
+ moderator: "moderator";
710
805
  member: "member";
711
806
  }>>;
712
807
  status: z.ZodNullable<z.ZodEnum<{
@@ -750,6 +845,8 @@ export declare const communityMemberWireSchema: z.ZodObject<{
750
845
  role: z.ZodEnum<{
751
846
  owner: "owner";
752
847
  admin: "admin";
848
+ representative: "representative";
849
+ moderator: "moderator";
753
850
  member: "member";
754
851
  }>;
755
852
  status: z.ZodEnum<{
@@ -1368,7 +1465,12 @@ export declare const communityListResponseSchema: z.ZodObject<{
1368
1465
  restricted: "restricted";
1369
1466
  }>;
1370
1467
  coverImageUrl: z.ZodOptional<z.ZodString>;
1371
- ownerUserId: z.ZodString;
1468
+ kind: z.ZodEnum<{
1469
+ user: "user";
1470
+ official: "official";
1471
+ }>;
1472
+ ownerUserId: z.ZodNullable<z.ZodString>;
1473
+ createdBy: z.ZodNullable<z.ZodString>;
1372
1474
  memberCount: z.ZodNumber;
1373
1475
  postCount: z.ZodNumber;
1374
1476
  groupId: z.ZodString;
@@ -1615,10 +1717,23 @@ export declare const communityListResponseSchema: z.ZodObject<{
1615
1717
  national: "national";
1616
1718
  global: "global";
1617
1719
  }>>;
1720
+ officialAreaKind: z.ZodNullable<z.ZodEnum<{
1721
+ STATE: "STATE";
1722
+ DISTRICT: "DISTRICT";
1723
+ BLOCK: "BLOCK";
1724
+ GRAM_PANCHAYAT: "GRAM_PANCHAYAT";
1725
+ VILLAGE: "VILLAGE";
1726
+ URBAN_BODY: "URBAN_BODY";
1727
+ URBAN_WARD: "URBAN_WARD";
1728
+ LOCALITY: "LOCALITY";
1729
+ }>>;
1730
+ officialAreaId: z.ZodNullable<z.ZodString>;
1618
1731
  viewer: z.ZodOptional<z.ZodObject<{
1619
1732
  role: z.ZodNullable<z.ZodEnum<{
1620
1733
  owner: "owner";
1621
1734
  admin: "admin";
1735
+ representative: "representative";
1736
+ moderator: "moderator";
1622
1737
  member: "member";
1623
1738
  }>>;
1624
1739
  status: z.ZodNullable<z.ZodEnum<{
@@ -1673,6 +1788,8 @@ export declare const joinCommunityResponseSchema: z.ZodObject<{
1673
1788
  role: z.ZodNullable<z.ZodEnum<{
1674
1789
  owner: "owner";
1675
1790
  admin: "admin";
1791
+ representative: "representative";
1792
+ moderator: "moderator";
1676
1793
  member: "member";
1677
1794
  }>>;
1678
1795
  joinedAt: z.ZodNullable<z.ZodString>;
@@ -1687,6 +1804,8 @@ export declare const communityMembersListResponseSchema: z.ZodObject<{
1687
1804
  role: z.ZodEnum<{
1688
1805
  owner: "owner";
1689
1806
  admin: "admin";
1807
+ representative: "representative";
1808
+ moderator: "moderator";
1690
1809
  member: "member";
1691
1810
  }>;
1692
1811
  status: z.ZodEnum<{
@@ -1836,4 +1955,96 @@ export declare const areaPickerResponseSchema: z.ZodObject<{
1836
1955
  }, z.core.$strip>>;
1837
1956
  }, z.core.$strip>;
1838
1957
  export type AreaPickerResponse = z.infer<typeof areaPickerResponseSchema>;
1958
+ /**
1959
+ * `POST /communities/official` body. Single-step flow.
1960
+ *
1961
+ * The area-leader binding gates the call: the caller's elevated
1962
+ * `serviceRoles['reform']` must include `leader` AND their
1963
+ * `jurisdictionLevel + jurisdictionAreaId` must exactly equal the
1964
+ * `areaKind + areaId` supplied here. Backend resolves the rest:
1965
+ *
1966
+ * • `name` and `slug` are derived server-side from the area name +
1967
+ * kind (e.g. "Pataudi Block Community" / `pataudi-block`). The
1968
+ * caller may override `description` and pick a cover image.
1969
+ * • `kind` is fixed to `'official'`; no need to send it.
1970
+ * • `reach`, `category`, `tags`, `mature`, `areaLineage`,
1971
+ * `centerCoords` are derived from the picked area.
1972
+ * • `verifiedAt`, `verifiedBy` are auto-set at create time (the
1973
+ * leader's act of creating it IS the verification).
1974
+ *
1975
+ * Re-creating after an area-level community has been soft-deleted by
1976
+ * superadmin is allowed because the partial unique index excludes
1977
+ * soft-deleted rows.
1978
+ */
1979
+ export declare const createOfficialCommunityBodySchema: z.ZodObject<{
1980
+ areaKind: z.ZodEnum<{
1981
+ STATE: "STATE";
1982
+ DISTRICT: "DISTRICT";
1983
+ BLOCK: "BLOCK";
1984
+ GRAM_PANCHAYAT: "GRAM_PANCHAYAT";
1985
+ VILLAGE: "VILLAGE";
1986
+ URBAN_BODY: "URBAN_BODY";
1987
+ URBAN_WARD: "URBAN_WARD";
1988
+ LOCALITY: "LOCALITY";
1989
+ }>;
1990
+ areaId: z.ZodString;
1991
+ description: z.ZodOptional<z.ZodString>;
1992
+ coverImageUrl: z.ZodOptional<z.ZodString>;
1993
+ }, z.core.$strip>;
1994
+ export type CreateOfficialCommunityBody = z.infer<typeof createOfficialCommunityBodySchema>;
1995
+ /**
1996
+ * Body for `POST /communities/:slug/moderators` — assign a moderator.
1997
+ * The target user must already be an active member of the community.
1998
+ *
1999
+ * Caller authority:
2000
+ * - `kind: 'official'` admin (the current area leader, or the
2001
+ * platform superadmin when no leader is appointed) can add or
2002
+ * remove a moderator. The representative cannot (representative
2003
+ * can override moderator decisions but does not manage the
2004
+ * moderator roster).
2005
+ *
2006
+ * To remove a moderator use `DELETE /communities/:slug/moderators/:userId`.
2007
+ */
2008
+ export declare const addOfficialModeratorBodySchema: z.ZodObject<{
2009
+ userId: z.ZodString;
2010
+ }, z.core.$strip>;
2011
+ export type AddOfficialModeratorBody = z.infer<typeof addOfficialModeratorBodySchema>;
2012
+ /**
2013
+ * Body for `PUT /communities/:slug/representative` — set or replace
2014
+ * the community's named elected representative (Pradhan / Mayor / ...).
2015
+ *
2016
+ * The representative slot is single-valued: writing a new user ID
2017
+ * replaces whoever held it before (matching the "new election → new
2018
+ * person" lifecycle). Use `DELETE /communities/:slug/representative`
2019
+ * to clear the slot between elections.
2020
+ *
2021
+ * The target user must already be an active member of the community;
2022
+ * the backend will auto-add them as a member if they're not.
2023
+ *
2024
+ * Caller authority: `kind: 'official'` admin only.
2025
+ */
2026
+ export declare const setOfficialRepresentativeBodySchema: z.ZodObject<{
2027
+ userId: z.ZodString;
2028
+ }, z.core.$strip>;
2029
+ export type SetOfficialRepresentativeBody = z.infer<typeof setOfficialRepresentativeBodySchema>;
2030
+ /**
2031
+ * Body for `POST /communities/:slug/posts/:postId/hide`.
2032
+ *
2033
+ * Hides a post from the community feed for everyone except the author
2034
+ * (who still sees their own post, marked as "hidden by moderator").
2035
+ *
2036
+ * Caller authority on `kind: 'official'`:
2037
+ * - moderator — can hide a post that has at least one open report.
2038
+ * - representative — can hide or unhide ANY post (including overriding
2039
+ * a moderator's hide). The override is what makes
2040
+ * the representative's "settings" page useful.
2041
+ * - admin — same authority as representative.
2042
+ *
2043
+ * On `kind: 'user'` the existing soft-delete by owner / admin path
2044
+ * continues to apply; this endpoint is `official`-only.
2045
+ */
2046
+ export declare const hidePostBodySchema: z.ZodObject<{
2047
+ reason: z.ZodOptional<z.ZodString>;
2048
+ }, z.core.$strip>;
2049
+ export type HidePostBody = z.infer<typeof hidePostBodySchema>;
1839
2050
  //# sourceMappingURL=community.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../src/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,8CAA+C,CAAC;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACnE,eAAO,MAAM,mBAAmB;;;;EAAgC,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,kEAMzB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACrE,eAAO,MAAM,oBAAoB;;;;;;EAAiC,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,0CAA2C,CAAC;AACxF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;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;GAeG;AACH,eAAO,MAAM,kBAAkB;;iBAI7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/dist/community.js CHANGED
@@ -30,6 +30,58 @@ import { z } from 'zod';
30
30
  import { areaLineageSnapshotSchema } from './area.js';
31
31
  import { COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS, COMMUNITY_DESIGNATION_CUSTOM_PATTERN, COMMUNITY_MAX_TAGS, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, } from './constants.js';
32
32
  // ─── Enums ──────────────────────────────────────────────────────────────────
33
+ /**
34
+ * Two fundamentally different community shapes share the same wire
35
+ * schema:
36
+ *
37
+ * user — topic-of-interest community a regular user creates and
38
+ * owns (Reddit subreddit / Facebook group analogue). Owner
39
+ * + admins manage; members join. The default kind.
40
+ * official — area-based civic community for a specific administrative
41
+ * area (village / block / district / urban body / ... up
42
+ * to state). Created by the elected area leader; has NO
43
+ * owner. Permission is computed at read time from the
44
+ * current area-leader binding:
45
+ * - admin role = whoever is the area's leader right now
46
+ * (falls back to platform superadmin when no leader is
47
+ * appointed)
48
+ * - representative role = the elected official the area
49
+ * leader names (Pradhan / Mayor / MLA / ...); replaced
50
+ * on each new political election
51
+ * - moderator role = community-scoped; can hide reported
52
+ * posts. Representative can override moderator
53
+ * decisions from settings.
54
+ * Always auto-verified (the leader's act of creating it IS
55
+ * the verification) and immune to delete from anyone
56
+ * except platform superadmin / manager.
57
+ */
58
+ export const COMMUNITY_KIND_VALUES = ['user', 'official'];
59
+ export const communityKindSchema = z.enum(COMMUNITY_KIND_VALUES);
60
+ /**
61
+ * Administrative area levels that can host an official community.
62
+ *
63
+ * Mirrors a subset of the reform-backend `JURISDICTION_LEVEL` enum —
64
+ * NATIONAL and GLOBAL are intentionally excluded because they are
65
+ * virtual tiers (no `Area` row) and don't fit the "community for THIS
66
+ * area" model. If we ever want national / global civic communities
67
+ * they should be a separate concept.
68
+ *
69
+ * The leader-jurisdiction → area-kind binding is 1:1:
70
+ * leader.jurisdictionLevel === community.officialAreaKind AND
71
+ * leader.jurisdictionAreaId === community.officialAreaId
72
+ * is the gate for who can create / admin the community.
73
+ */
74
+ export const OFFICIAL_COMMUNITY_AREA_KIND_VALUES = [
75
+ 'STATE',
76
+ 'DISTRICT',
77
+ 'BLOCK',
78
+ 'GRAM_PANCHAYAT',
79
+ 'VILLAGE',
80
+ 'URBAN_BODY',
81
+ 'URBAN_WARD',
82
+ 'LOCALITY',
83
+ ];
84
+ export const officialCommunityAreaKindSchema = z.enum(OFFICIAL_COMMUNITY_AREA_KIND_VALUES);
33
85
  /**
34
86
  * public — anyone can read + post.
35
87
  * restricted — anyone can read; only approved members can post. The
@@ -404,13 +456,37 @@ export const communityCenterCoordsSchema = z.object({
404
456
  });
405
457
  /** Role hierarchy within a single community.
406
458
  *
407
- * owner — creator; cannot be demoted by anyone, can transfer
408
- * ownership (deferred for v1) and delete the community.
409
- * admin — granted by owner; can edit metadata, kick members,
410
- * soft-delete posts authored in the community.
411
- * member — joined; can post and comment, can leave at any time.
459
+ * The role set is shared across `user` and `official` communities, but
460
+ * not every role is valid for every kind:
461
+ *
462
+ * owner — `kind: 'user'` only. The creator; can edit
463
+ * metadata, transfer ownership (deferred), and
464
+ * delete the community.
465
+ * admin — `kind: 'user'`: granted by the owner; can edit
466
+ * metadata, kick members, soft-delete posts.
467
+ * `kind: 'official'`: computed from the current
468
+ * area-leader binding (never stored on a membership
469
+ * row); platform superadmin fills the slot when no
470
+ * leader is appointed.
471
+ * representative — `kind: 'official'` only. The elected official the
472
+ * area leader names (Pradhan / Mayor / ...).
473
+ * Replaced on every new political election. Can
474
+ * override moderator decisions from the community
475
+ * settings page.
476
+ * moderator — `kind: 'official'` only. Community-scoped; can
477
+ * hide reported posts. Multiple moderators allowed
478
+ * per community. The current admin (area leader)
479
+ * grants and revokes.
480
+ * member — joined; can post and comment, can leave at any
481
+ * time. Valid for both kinds.
412
482
  */
413
- export const COMMUNITY_ROLE_VALUES = ['owner', 'admin', 'member'];
483
+ export const COMMUNITY_ROLE_VALUES = [
484
+ 'owner',
485
+ 'admin',
486
+ 'representative',
487
+ 'moderator',
488
+ 'member',
489
+ ];
414
490
  export const communityRoleSchema = z.enum(COMMUNITY_ROLE_VALUES);
415
491
  /** Membership lifecycle.
416
492
  *
@@ -437,7 +513,18 @@ export const communityWireSchema = z.object({
437
513
  description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),
438
514
  type: communityTypeSchema,
439
515
  coverImageUrl: z.string().url().optional(),
440
- ownerUserId: z.string(),
516
+ /** Discriminator. `user` = topical / interest community; `official`
517
+ * = area-based civic community owned by an area leader. Default at
518
+ * read time when omitted by a pre-v3 backend is `user`. */
519
+ kind: communityKindSchema,
520
+ /** User communities only — the creator. Null for `kind: 'official'`
521
+ * (those have no owner; admin is computed from the area-leader
522
+ * binding). */
523
+ ownerUserId: z.string().nullable(),
524
+ /** Audit-only userId of whoever created the community. Carries no
525
+ * permission on its own — present on both kinds so the wire shape
526
+ * stays uniform. For `kind: 'user'` this equals `ownerUserId`. */
527
+ createdBy: z.string().nullable(),
441
528
  /** Active members only. Pending join-requests don't count. */
442
529
  memberCount: z.number().int().nonnegative(),
443
530
  /** Denormalised post count. Increments on create, decrements on
@@ -468,13 +555,28 @@ export const communityWireSchema = z.object({
468
555
  * the `?nearMe=true` 5 km geospatial filter on discovery. */
469
556
  centerCoords: communityCenterCoordsSchema.nullable(),
470
557
  /** ISO timestamp set by a state+ leader when verifying the
471
- * community. Null until verified; clearing reverts to null. */
558
+ * community. Null until verified; clearing reverts to null. For
559
+ * `kind: 'official'` this is auto-set at create time (the leader's
560
+ * act of creating it IS the verification). */
472
561
  verifiedAt: z.string().datetime().nullable(),
473
- /** UserId of the leader who verified. */
562
+ /** UserId of the leader who verified. For `kind: 'official'` this
563
+ * is the leader who created it (same as `createdBy`). */
474
564
  verifiedBy: z.string().nullable(),
475
565
  /** Which leader tier vouched — drives the badge tooltip ("verified
476
- * by a state leader" vs "by a national leader"). */
566
+ * by a state leader" vs "by a national leader"). For
567
+ * `kind: 'official'` this is null because the "official" badge
568
+ * itself communicates authority. */
477
569
  verifiedScope: communityVerifiedScopeSchema.nullable(),
570
+ // ─── Official community fields ──────────────────────────────────────
571
+ /** Administrative level of the area this official community is
572
+ * bound to. Null for `kind: 'user'`. */
573
+ officialAreaKind: officialCommunityAreaKindSchema.nullable(),
574
+ /** ObjectId of the specific Area entity this official community
575
+ * represents. Null for `kind: 'user'`. Combined with
576
+ * `officialAreaKind`, the pair `(officialAreaKind, officialAreaId)`
577
+ * is unique among non-deleted official communities — one official
578
+ * community per area, ever. */
579
+ officialAreaId: z.string().nullable(),
478
580
  viewer: z
479
581
  .object({
480
582
  role: communityRoleSchema.nullable(),
@@ -703,4 +805,93 @@ export const areaPickerItemSchema = z.object({
703
805
  export const areaPickerResponseSchema = z.object({
704
806
  items: z.array(areaPickerItemSchema),
705
807
  });
808
+ // ─── Official community — create + manage ──────────────────────────────────
809
+ /**
810
+ * `POST /communities/official` body. Single-step flow.
811
+ *
812
+ * The area-leader binding gates the call: the caller's elevated
813
+ * `serviceRoles['reform']` must include `leader` AND their
814
+ * `jurisdictionLevel + jurisdictionAreaId` must exactly equal the
815
+ * `areaKind + areaId` supplied here. Backend resolves the rest:
816
+ *
817
+ * • `name` and `slug` are derived server-side from the area name +
818
+ * kind (e.g. "Pataudi Block Community" / `pataudi-block`). The
819
+ * caller may override `description` and pick a cover image.
820
+ * • `kind` is fixed to `'official'`; no need to send it.
821
+ * • `reach`, `category`, `tags`, `mature`, `areaLineage`,
822
+ * `centerCoords` are derived from the picked area.
823
+ * • `verifiedAt`, `verifiedBy` are auto-set at create time (the
824
+ * leader's act of creating it IS the verification).
825
+ *
826
+ * Re-creating after an area-level community has been soft-deleted by
827
+ * superadmin is allowed because the partial unique index excludes
828
+ * soft-deleted rows.
829
+ */
830
+ export const createOfficialCommunityBodySchema = z.object({
831
+ /** Administrative level of the picked area. Must equal the caller's
832
+ * jurisdictionLevel. */
833
+ areaKind: officialCommunityAreaKindSchema,
834
+ /** ObjectId of the picked Area entity. Must equal the caller's
835
+ * jurisdictionAreaId. */
836
+ areaId: z.string(),
837
+ /** Optional one-line description shown on the community card. */
838
+ description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),
839
+ /** Optional cover image. */
840
+ coverImageUrl: z.string().url().optional(),
841
+ });
842
+ /**
843
+ * Body for `POST /communities/:slug/moderators` — assign a moderator.
844
+ * The target user must already be an active member of the community.
845
+ *
846
+ * Caller authority:
847
+ * - `kind: 'official'` admin (the current area leader, or the
848
+ * platform superadmin when no leader is appointed) can add or
849
+ * remove a moderator. The representative cannot (representative
850
+ * can override moderator decisions but does not manage the
851
+ * moderator roster).
852
+ *
853
+ * To remove a moderator use `DELETE /communities/:slug/moderators/:userId`.
854
+ */
855
+ export const addOfficialModeratorBodySchema = z.object({
856
+ userId: z.string(),
857
+ });
858
+ /**
859
+ * Body for `PUT /communities/:slug/representative` — set or replace
860
+ * the community's named elected representative (Pradhan / Mayor / ...).
861
+ *
862
+ * The representative slot is single-valued: writing a new user ID
863
+ * replaces whoever held it before (matching the "new election → new
864
+ * person" lifecycle). Use `DELETE /communities/:slug/representative`
865
+ * to clear the slot between elections.
866
+ *
867
+ * The target user must already be an active member of the community;
868
+ * the backend will auto-add them as a member if they're not.
869
+ *
870
+ * Caller authority: `kind: 'official'` admin only.
871
+ */
872
+ export const setOfficialRepresentativeBodySchema = z.object({
873
+ userId: z.string(),
874
+ });
875
+ // ─── Post moderation (hide / unhide for moderator + representative) ────────
876
+ /**
877
+ * Body for `POST /communities/:slug/posts/:postId/hide`.
878
+ *
879
+ * Hides a post from the community feed for everyone except the author
880
+ * (who still sees their own post, marked as "hidden by moderator").
881
+ *
882
+ * Caller authority on `kind: 'official'`:
883
+ * - moderator — can hide a post that has at least one open report.
884
+ * - representative — can hide or unhide ANY post (including overriding
885
+ * a moderator's hide). The override is what makes
886
+ * the representative's "settings" page useful.
887
+ * - admin — same authority as representative.
888
+ *
889
+ * On `kind: 'user'` the existing soft-delete by owner / admin path
890
+ * continues to apply; this endpoint is `official`-only.
891
+ */
892
+ export const hidePostBodySchema = z.object({
893
+ /** Optional moderator note (visible only to other moderators + the
894
+ * representative + admin on the moderation log). Capped at 500. */
895
+ reason: z.string().max(500).optional(),
896
+ });
706
897
  //# sourceMappingURL=community.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"community.js","sourceRoot":"","sources":["../src/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,oCAAoC,EACpC,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAU,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc;IACd,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;CACA,CAAC;AAEX,MAAM,CAAC,MA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AAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,qBAAqB;IAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACrC,CAAC,CAAC","sourcesContent":["/**\n * Topical Community wire shapes.\n *\n * A Community is a Reddit-subreddit / Facebook-group style surface: a\n * named topic users can discover, join, and post into. Distinct from\n * the user-created `Group` (chat-bound, small, private) — each\n * Community auto-owns its own bound `Group` (so members get a\n * Community chat room for free) but they're conceptually different\n * objects with their own roster + permissions.\n *\n * Visibility model\n * ----------------\n * - `public` — anyone can join one-tap; posts are visible to all\n * viewers in the community feed.\n * - `private` — joining requires owner / admin approval; posts and\n * member list are hidden from non-members. Discovery\n * still lists the community card (name + description +\n * member count + join button) so users can request to\n * join.\n *\n * Posts inside a community do NOT participate in the geo cascade —\n * they live and die inside the community surface. Posts authored\n * from the global composer continue to flow through the geo\n * area-proximity cascade ranked by `tierBoost` (see\n * `reform-backend/src/services/community/services/visibility.service.ts`).\n *\n * @module community-schema/community\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport {\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_PATTERN,\n COMMUNITY_MAX_TAGS,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n} from './constants.js';\n\n// ─── Enums ──────────────────────────────────────────────────────────────────\n\n/**\n * public — anyone can read + post.\n * restricted — anyone can read; only approved members can post. The\n * middle option Reddit added so communities can be open\n * to browse but moderated on the write side.\n * private — only approved members can read or post. The roster\n * + post bodies are hidden from non-members.\n */\nexport const COMMUNITY_TYPE_VALUES = ['public', 'restricted', 'private'] as const;\nexport type CommunityType = (typeof COMMUNITY_TYPE_VALUES)[number];\nexport const communityTypeSchema = z.enum(COMMUNITY_TYPE_VALUES);\n\n/**\n * Geographic scope a community claims. Maps onto the existing\n * area-lineage tiers so discovery can match a viewer's `areaLineage`\n * one tier at a time.\n *\n * neighborhood — hyperlocal; carries `areaLineage.localId` +\n * `centerCoords`. Discovery uses the 5 km radius from\n * `COMMUNITY_HYPERLOCAL_RADIUS_KM`.\n * city — district-scoped; carries `areaLineage.districtId`.\n * state — carries `areaLineage.stateId`.\n * national — carries `areaLineage.countryId`.\n * global — area-agnostic; `areaLineage` is null.\n */\nexport const COMMUNITY_REACH_VALUES = [\n 'neighborhood',\n 'city',\n 'state',\n 'national',\n 'global',\n] as const;\nexport type CommunityReach = (typeof COMMUNITY_REACH_VALUES)[number];\nexport const communityReachSchema = z.enum(COMMUNITY_REACH_VALUES);\n\n/**\n * Verification scope on a verified community — which leader-tier\n * vouched for it.\n *\n * state — a state-level leader verified within their own state.\n * national — a national-level leader (or higher).\n * global — a global / platform-level leader.\n */\nexport const COMMUNITY_VERIFIED_SCOPE_VALUES = ['state', 'national', 'global'] as const;\nexport type CommunityVerifiedScope = (typeof COMMUNITY_VERIFIED_SCOPE_VALUES)[number];\nexport const communityVerifiedScopeSchema = z.enum(COMMUNITY_VERIFIED_SCOPE_VALUES);\n\n/**\n * Curated category enum. Slugs are **stable English keys** (snake_case);\n * the visible label is i18n'd on the frontend (en/hi message files).\n * Never store culturally-specific or transliterated names here — the\n * locale layer owns presentation.\n *\n * First 12 slugs are weighted toward the Indian civic / hyperlocal\n * context that Jansathi serves (Women's / Men's / Youth groups, RWA,\n * Social Welfare, Civic Reform). Remaining 30 are general-interest\n * categories adapted from Reddit's curated topic set + Facebook\n * Groups' top discovery categories.\n *\n * See `docs/community-create-v2.md` §2 in the jansathi-frontend repo\n * for the full label table.\n */\nexport const COMMUNITY_CATEGORY_VALUES = [\n // Indian civic / community (12)\n 'womens_group',\n 'mens_group',\n 'youth_group',\n 'senior_citizens',\n 'parenting_children',\n 'resident_welfare',\n 'social_welfare',\n 'social_awareness',\n 'volunteering',\n 'civic_reform',\n 'local_news_issues',\n 'environment',\n // Civic & legal (3)\n 'legal_law',\n 'politics_government',\n 'real_estate_housing',\n // Faith & culture (3)\n 'religion_spirituality',\n 'festivals_culture',\n 'devotional',\n // Education & sciences (5)\n 'education',\n 'competitive_exams',\n 'books_literature',\n 'language_learning',\n 'science',\n // Health & wellness (4)\n 'health_wellness',\n 'yoga_meditation',\n 'fitness',\n 'mental_health',\n // Identity & society (2)\n 'lgbtq_identity',\n 'mature_topics',\n // Lifestyle (7)\n 'food_cooking',\n 'travel',\n 'photography',\n 'fashion_beauty',\n 'home_garden',\n 'pets_animals',\n 'vehicles_automotive',\n // Sports & arts (5)\n 'sports',\n 'cricket',\n 'arts_crafts',\n 'music',\n 'dance',\n // Entertainment (4)\n 'movies_tv',\n 'gaming',\n 'entertainment',\n 'anime_cosplay',\n // Professional (5)\n 'business_career',\n 'entrepreneurship',\n 'technology',\n 'finance_investing',\n 'agriculture',\n // Information (1) + fallback (1)\n 'news_current_affairs',\n 'other',\n] as const;\nexport type CommunityCategory = (typeof COMMUNITY_CATEGORY_VALUES)[number];\nexport const communityCategorySchema = z.enum(COMMUNITY_CATEGORY_VALUES);\n\n/**\n * Curated tag enum. A community picks 0–`COMMUNITY_MAX_TAGS` from\n * this list. Tags are stable English snake_case slugs; the visible\n * label is i18n'd. The tag picker UI groups them by theme via a\n * separate theme-map on the frontend; the stored enum is flat.\n *\n * Total: 112 tags spanning civic, health, education, sports, food,\n * arts/music/faith, business/tech, local issues, and lifestyle.\n */\nexport const COMMUNITY_TAG_VALUES = [\n // Civic & social (29)\n 'volunteer',\n 'donation_drive',\n 'blood_donation',\n 'anti_corruption',\n 'women_safety',\n 'child_safety',\n 'senior_care',\n 'disability_support',\n 'lgbtq_support',\n 'environment',\n 'cleanliness',\n 'plant_trees',\n 'waste_management',\n 'legal_aid',\n 'rti',\n 'voter_awareness',\n 'government_schemes',\n 'ngo',\n 'charity',\n 'relief_work',\n 'public_service',\n 'fundraising',\n 'awareness_campaign',\n 'social_justice',\n 'women_empowerment',\n 'rural_development',\n 'tribal_welfare',\n 'homeless_support',\n 'street_children',\n // Community & neighborhood (8) — new theme\n 'community_growth',\n 'residents_association',\n 'housing_society',\n 'gated_community',\n 'apartment_living',\n 'mohalla_committee',\n 'newcomers_welcome',\n 'neighborhood_safety',\n // Health & wellness (19)\n 'yoga',\n 'meditation',\n 'fitness',\n 'running',\n 'cycling',\n 'walking',\n 'nutrition',\n 'mental_health',\n 'ayurveda',\n 'weight_loss',\n 'womens_health',\n 'mens_health',\n 'dental_health',\n 'eye_care',\n 'diabetes_support',\n 'cancer_support',\n 'heart_health',\n 'addiction_recovery',\n 'pregnancy_support',\n // Education (16)\n 'jee',\n 'neet',\n 'upsc',\n 'ssc',\n 'ielts',\n 'school_support',\n 'college_support',\n 'scholarship',\n 'career_guidance',\n 'coding',\n 'mathematics',\n 'science',\n 'languages',\n 'spoken_english',\n 'tutoring',\n 'study_abroad',\n // Sports (9)\n 'cricket',\n 'football',\n 'badminton',\n 'tennis',\n 'kabaddi',\n 'hockey',\n 'chess',\n 'swimming',\n 'marathon',\n // Food (10)\n 'street_food',\n 'home_cooking',\n 'vegetarian',\n 'vegan',\n 'jain_food',\n 'fasting_recipes',\n 'north_indian',\n 'south_indian',\n 'baking',\n 'desserts',\n // Arts, music, faith (21)\n 'classical_music',\n 'hindustani',\n 'carnatic',\n 'bhajan',\n 'kirtan',\n 'bollywood',\n 'dance_classical',\n 'dance_folk',\n 'painting',\n 'photography',\n 'craft',\n 'satsang',\n 'festivals',\n 'pilgrimage',\n 'gita_study',\n 'ramayan',\n 'bhagwat',\n 'vedanta',\n 'sikh_satsang',\n 'christian_fellowship',\n 'jain_swadhyay',\n // Business & tech (19)\n 'entrepreneurship',\n 'startup',\n 'small_business',\n 'freelancing',\n 'real_estate',\n 'stocks_investing',\n 'mutual_funds',\n 'agriculture',\n 'handicrafts',\n 'job_postings',\n 'web_development',\n 'artificial_intelligence',\n 'data_science',\n 'cybersecurity',\n 'app_development',\n 'ui_ux_design',\n 'social_media_marketing',\n 'content_creation',\n 'gaming',\n // Local issues (9)\n 'water_supply',\n 'electricity',\n 'road_repair',\n 'garbage_collection',\n 'drainage',\n 'public_transport',\n 'traffic',\n 'parking',\n 'local_healthcare',\n // Skills & trades (6) — new theme\n 'tailoring',\n 'carpentry',\n 'electrical_work',\n 'plumbing',\n 'beauty_skills',\n 'driving',\n // Pets & animals (5) — new theme\n 'pets',\n 'dog_lovers',\n 'cat_lovers',\n 'stray_animal_care',\n 'veterinary_help',\n // Lifestyle (9)\n 'movies',\n 'tv_shows',\n 'books_club',\n 'trekking',\n 'parenting',\n 'gardening',\n 'pottery',\n 'diy',\n 'home_decor',\n] as const;\nexport type CommunityTag = (typeof COMMUNITY_TAG_VALUES)[number];\nexport const communityTagSchema = z.enum(COMMUNITY_TAG_VALUES);\n\n/**\n * Preset designation labels — purely **representation** (not\n * permission-bearing). Renders in brackets after a member's display\n * name in a community context (e.g., \"Hari Joshi (Chairman) · 12h ago\").\n *\n * Permission still flows through `CommunityRole` (owner / admin /\n * member). A designation does NOT promote or restrict anything.\n *\n * Per-community: Hari can be \"Chairman\" in one community and\n * \"Member-at-Large\" in another. Custom designations (free text)\n * cover the long tail; presets are surfaced first in the picker.\n */\nexport const COMMUNITY_DESIGNATION_PRESETS = [\n 'chairman',\n 'vice_chairman',\n 'president',\n 'vice_president',\n 'secretary',\n 'joint_secretary',\n 'general_secretary',\n 'treasurer',\n 'joint_treasurer',\n 'organizer',\n 'coordinator',\n 'spokesperson',\n 'founder',\n 'co_founder',\n 'patron',\n 'advisor',\n 'mentor',\n 'committee_member',\n 'member_at_large',\n 'volunteer',\n] as const;\nexport type CommunityDesignationPreset = (typeof COMMUNITY_DESIGNATION_PRESETS)[number];\nexport const communityDesignationPresetSchema = z.enum(COMMUNITY_DESIGNATION_PRESETS);\n\n/**\n * Designation stored on a `CommunityMembership`. Exactly one of\n * `preset` / `custom` is non-null when a designation is set.\n *\n * { preset: 'chairman', custom: null } — picked from the preset enum.\n * { preset: null, custom: 'Press & Media' } — free text.\n * null — no designation.\n *\n * The picker UI surfaces the preset list first; the custom path is\n * for niche labels that don't fit a preset. Validation enforces\n * exactly-one via a refinement.\n */\nexport const communityDesignationSchema = z\n .object({\n preset: communityDesignationPresetSchema.nullable(),\n custom: z.string().nullable(),\n })\n .refine((d) => (d.preset == null) !== (d.custom == null), {\n message: 'Designation must have exactly one of `preset` or `custom` set.',\n });\nexport type CommunityDesignation = z.infer<typeof communityDesignationSchema>;\n\n/**\n * Latitude / longitude pair used for hyperlocal (`reach=neighborhood`)\n * communities. Stored at create time from either the picked area's\n * centroid (if the Area carries coordinates) or the creator's current\n * GPS as a fallback. Indexed 2dsphere on the backend; powers the\n * `$nearSphere` query inside the `?nearMe=true` listing filter.\n */\nexport const communityCenterCoordsSchema = z.object({\n lat: z.number().min(-90).max(90),\n lng: z.number().min(-180).max(180),\n});\nexport type CommunityCenterCoords = z.infer<typeof communityCenterCoordsSchema>;\n\n/** Role hierarchy within a single community.\n *\n * owner — creator; cannot be demoted by anyone, can transfer\n * ownership (deferred for v1) and delete the community.\n * admin — granted by owner; can edit metadata, kick members,\n * soft-delete posts authored in the community.\n * member — joined; can post and comment, can leave at any time.\n */\nexport const COMMUNITY_ROLE_VALUES = ['owner', 'admin', 'member'] as const;\nexport type CommunityRole = (typeof COMMUNITY_ROLE_VALUES)[number];\nexport const communityRoleSchema = z.enum(COMMUNITY_ROLE_VALUES);\n\n/** Membership lifecycle.\n *\n * active — currently in the community.\n * pending — for a `private` community: the join request is awaiting\n * owner/admin approval. Pending rows aren't counted toward\n * `memberCount` and the user can't post yet.\n */\nexport const COMMUNITY_MEMBERSHIP_STATUS_VALUES = ['active', 'pending'] as const;\nexport type CommunityMembershipStatus = (typeof COMMUNITY_MEMBERSHIP_STATUS_VALUES)[number];\nexport const communityMembershipStatusSchema = z.enum(COMMUNITY_MEMBERSHIP_STATUS_VALUES);\n\n// ─── Wire shape ─────────────────────────────────────────────────────────────\n\n/**\n * `GET /communities/:slug` / discovery card / search hit.\n *\n * `viewer` is included when the request is authenticated. It carries\n * the viewer's role + membership status so the UI can render the\n * right CTA (Join / Joined / Pending / Owner) without a follow-up\n * round trip.\n */\nexport const communityWireSchema = z.object({\n _id: z.string(),\n slug: z.string(),\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n ownerUserId: z.string(),\n /** Active members only. Pending join-requests don't count. */\n memberCount: z.number().int().nonnegative(),\n /** Denormalised post count. Increments on create, decrements on\n * soft-delete. */\n postCount: z.number().int().nonnegative(),\n /** Bound chat-group id. Auto-created when the Community is created;\n * members are added to both rosters in lockstep. */\n groupId: z.string(),\n createdAt: z.string().datetime(),\n\n // ─── v2 taxonomy + reach + verification ─────────────────────────────\n /** Curated subject category. Single source of truth in\n * `COMMUNITY_CATEGORY_VALUES`; visible label is i18n'd. */\n category: communityCategorySchema,\n /** Geographic scope. Drives discovery filtering and is the reason\n * `areaLineage` / `centerCoords` may be present. */\n reach: communityReachSchema,\n /** Up to `COMMUNITY_MAX_TAGS` (10) tags from the curated enum. */\n tags: z.array(communityTagSchema),\n /** Mature (18+) flag. Content-gates the surface (blur previews,\n * age-confirm) once the gate UI ships; the field is persisted\n * from create-time so the mature designation is permanent. */\n mature: z.boolean(),\n /** Area snapshot — present when `reach !== 'global'`. Mirrors the\n * post-area lineage pattern; written once at create time and\n * immutable thereafter. */\n areaLineage: areaLineageSnapshotSchema.nullable(),\n /** Lat/lng pair — present when `reach === 'neighborhood'`. Powers\n * the `?nearMe=true` 5 km geospatial filter on discovery. */\n centerCoords: communityCenterCoordsSchema.nullable(),\n /** ISO timestamp set by a state+ leader when verifying the\n * community. Null until verified; clearing reverts to null. */\n verifiedAt: z.string().datetime().nullable(),\n /** UserId of the leader who verified. */\n verifiedBy: z.string().nullable(),\n /** Which leader tier vouched — drives the badge tooltip (\"verified\n * by a state leader\" vs \"by a national leader\"). */\n verifiedScope: communityVerifiedScopeSchema.nullable(),\n\n viewer: z\n .object({\n role: communityRoleSchema.nullable(),\n status: communityMembershipStatusSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n /** Viewer's designation in THIS community. Null when the\n * viewer is not a member or has no designation set. Returned\n * at the wire level (vs the roster level) so post-cards and\n * the byline can render `(Chairman)` without a separate\n * roster lookup. */\n designation: communityDesignationSchema.nullable(),\n })\n .optional(),\n});\nexport type CommunityWire = z.infer<typeof communityWireSchema>;\n\n// ─── Member roster row ──────────────────────────────────────────────────────\n\nexport const communityMemberWireSchema = z.object({\n userId: z.string(),\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n localName: z.string().optional(),\n role: communityRoleSchema,\n status: communityMembershipStatusSchema,\n joinedAt: z.string().datetime(),\n /** Per-community representation label. See\n * `communityDesignationSchema` — null when none set. */\n designation: communityDesignationSchema.nullable(),\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader. Drives the green check badge in the member\n * roster row. Optional for forward-compat with un-migrated\n * backends. */\n identityVerified: z.boolean().optional(),\n});\nexport type CommunityMemberWire = z.infer<typeof communityMemberWireSchema>;\n\n// ─── Create body ────────────────────────────────────────────────────────────\n\n/**\n * `POST /communities` body. `slug` is optional — when omitted the\n * backend auto-generates one from the name (lowercased, hyphenated,\n * collision-suffixed). When provided it must match the slug pattern\n * and be unique.\n *\n * `areaId` is required when `reach !== 'global'` — it's the deepest-\n * matching area-entity id (`localId` for neighborhood, `districtId`\n * for city, etc.) the creator picked from the area picker. The\n * backend resolves the full `areaLineage` snapshot from this id.\n */\nexport const createCommunityBodySchema = z\n .object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n slug: z\n .string()\n .min(COMMUNITY_SLUG_MIN_CHARS)\n .max(COMMUNITY_SLUG_MAX_CHARS)\n .regex(COMMUNITY_SLUG_PATTERN)\n .optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n // ── v2 fields ─────────────────────────────────────────────────\n category: communityCategorySchema,\n reach: communityReachSchema,\n /** ObjectId of the picked area at the reach's tier. Required iff\n * `reach !== 'global'`. */\n areaId: z.string().optional(),\n tags: z.array(communityTagSchema).max(COMMUNITY_MAX_TAGS).default([]),\n mature: z.boolean().default(false),\n })\n .superRefine((body, ctx) => {\n if (body.reach !== 'global' && !body.areaId) {\n ctx.addIssue({\n code: 'custom',\n path: ['areaId'],\n message: 'Area is required when reach is not Global.',\n });\n }\n });\nexport type CreateCommunityBody = z.infer<typeof createCommunityBodySchema>;\n\n// ─── Update body (owner / admin only) ───────────────────────────────────────\n\n/**\n * `PATCH /communities/:slug` body. All fields optional. Sending\n * `null` for `description` or `coverImageUrl` clears that field.\n *\n * Type changes between `public` / `restricted` / `private` are NOT\n * supported in v1 — the decision has implications for already-\n * published posts and pending join requests that we don't want to\n * silently handle. Recreate the community if you need to switch.\n *\n * `category`, `tags`, `mature` are editable post-create. `reach` and\n * `areaLineage` / `centerCoords` are NOT editable — moving a community\n * across geographic scopes would silently invalidate every existing\n * member's relationship with it.\n */\nexport const updateCommunityBodySchema = z.object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS).optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).nullable().optional(),\n coverImageUrl: z.string().url().nullable().optional(),\n category: communityCategorySchema.optional(),\n tags: z.array(communityTagSchema).max(COMMUNITY_MAX_TAGS).optional(),\n mature: z.boolean().optional(),\n});\nexport type UpdateCommunityBody = z.infer<typeof updateCommunityBodySchema>;\n\n// ─── List + discover + search responses ─────────────────────────────────────\n\n/** Sort order on the discover page. `popular` ranks by active member\n * count, `new` by createdAt desc. `top` is reserved for a future\n * activity-weighted ranking and accepted as a no-op for now. */\nexport const COMMUNITY_DISCOVER_SORT_VALUES = ['popular', 'new', 'top'] as const;\nexport type CommunityDiscoverSort = (typeof COMMUNITY_DISCOVER_SORT_VALUES)[number];\nexport const communityDiscoverSortSchema = z.enum(COMMUNITY_DISCOVER_SORT_VALUES);\n\nexport const communityListQuerySchema = z.object({\n sort: communityDiscoverSortSchema.optional(),\n /** Free-text fragment matched case-insensitively against the\n * community name. */\n q: z.string().max(60).optional(),\n cursor: z.string().optional(),\n pageSize: z.number().int().min(1).max(COMMUNITIES_PAGE_SIZE).optional(),\n // ── v2 discovery filters ─────────────────────────────────────────\n /** Filter by curated subject category. */\n category: communityCategorySchema.optional(),\n /** Filter by geographic reach tier. */\n reach: communityReachSchema.optional(),\n /** Return only verified communities. */\n verified: z.boolean().optional(),\n /** Layered \"near me\" mode — when true, returns the union of:\n * • `reach=neighborhood` AND `centerCoords` within\n * `COMMUNITY_HYPERLOCAL_RADIUS_KM` of the supplied (lat, lng),\n * • `reach=city` AND `districtId = viewer.districtId`,\n * • `reach=state` AND `stateId = viewer.stateId`,\n * • `reach=national` AND `countryId = viewer.countryId`.\n * `lat` + `lng` must accompany the flag (typically from the\n * viewer's currentLocation GPS). */\n nearMe: z.boolean().optional(),\n lat: z.number().min(-90).max(90).optional(),\n lng: z.number().min(-180).max(180).optional(),\n});\nexport type CommunityListQuery = z.infer<typeof communityListQuerySchema>;\n\nexport const communityListResponseSchema = z.object({\n items: z.array(communityWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityListResponse = z.infer<typeof communityListResponseSchema>;\n\n// ─── Membership actions ────────────────────────────────────────────────────\n\n/**\n * `POST /communities/:slug/join`. Response carries the new viewer\n * state so the client can update the CTA without a follow-up GET.\n *\n * - public → returns `{ status: 'active', role: 'member' }`\n * - private → returns `{ status: 'pending', role: null }`; the\n * owner / admin approves via the moderation endpoint\n * (`POST /communities/:slug/members/:userId/approve`).\n */\nexport const joinCommunityResponseSchema = z.object({\n status: communityMembershipStatusSchema,\n role: communityRoleSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n});\nexport type JoinCommunityResponse = z.infer<typeof joinCommunityResponseSchema>;\n\nexport const communityMembersListResponseSchema = z.object({\n items: z.array(communityMemberWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityMembersListResponse = z.infer<typeof communityMembersListResponseSchema>;\n\n/** Body for `POST /communities/:slug/members/:userId/role` — owner-\n * only. Used to promote a member to admin or demote an admin back\n * to plain member. Owner role can't be set via this endpoint;\n * transferring ownership has its own dedicated route (deferred). */\nexport const updateMemberRoleBodySchema = z.object({\n role: z.enum(['admin', 'member']),\n});\nexport type UpdateMemberRoleBody = z.infer<typeof updateMemberRoleBodySchema>;\n\n// ─── Designation (representation, not permission) ──────────────────────────\n\n/**\n * Body for `PUT /communities/:slug/members/:userId/designation`.\n * Owner / admin only. Exactly one of `preset` / `custom` must be set.\n *\n * Use the preset list first (one-tap pick from `CommunityDesignationPreset`);\n * fall through to `custom` for niche labels (\"Press & Media\",\n * \"Disaster Response Lead\", etc.) that don't fit a preset.\n *\n * To clear an existing designation, use `DELETE` on the same path —\n * there's no \"null\" mode on this body.\n */\nexport const setMemberDesignationBodySchema = z\n .object({\n preset: communityDesignationPresetSchema.optional(),\n custom: z\n .string()\n .min(COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS)\n .max(COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS)\n .regex(COMMUNITY_DESIGNATION_CUSTOM_PATTERN)\n .optional(),\n })\n .refine((b) => (b.preset != null) !== (b.custom != null), {\n message: 'Provide exactly one of `preset` or `custom`.',\n });\nexport type SetMemberDesignationBody = z.infer<typeof setMemberDesignationBodySchema>;\n\n// ─── Verification (state+ leader vouch) ────────────────────────────────────\n\n/**\n * Body for `POST /communities/:slug/verify`. Empty for now; the\n * verifier's scope (`state | national | global`) is derived from the\n * caller's leader role rather than supplied. Keeping a body object\n * leaves room for a `note` field later without a breaking change.\n */\nexport const verifyCommunityBodySchema = z.object({\n /** Optional free-text note the leader can attach to the verification\n * (visible in the verification audit trail; not surfaced in the\n * default badge tooltip). Capped at 200 chars. */\n note: z.string().max(200).optional(),\n});\nexport type VerifyCommunityBody = z.infer<typeof verifyCommunityBodySchema>;\n\n// ─── Area picker query (powers the cascading area sheet) ───────────────────\n\n/**\n * `GET /areas?level=...&parentId=...&q=...` — backs the area picker\n * inside the create-community wizard's step 3. Returns areas at the\n * specified `level` that sit under the given parent area:\n *\n * level=local → returns localities under a `districtId` parent.\n * level=district → returns districts under a `stateId` parent.\n * level=state → returns states under a `countryId` parent.\n *\n * The picker constrains the user to siblings under their own parent\n * area (so a Maharashtra creator can pick any locality in Maharashtra\n * for a neighborhood community, but not one in Tamil Nadu).\n */\nexport const AREA_PICKER_LEVEL_VALUES = ['local', 'district', 'state'] as const;\nexport type AreaPickerLevel = (typeof AREA_PICKER_LEVEL_VALUES)[number];\nexport const areaPickerLevelSchema = z.enum(AREA_PICKER_LEVEL_VALUES);\n\nexport const areaPickerQuerySchema = z.object({\n level: areaPickerLevelSchema,\n parentId: z.string(),\n /** Optional name prefix for debounced search inside the sheet. */\n q: z.string().max(60).optional(),\n});\nexport type AreaPickerQuery = z.infer<typeof areaPickerQuerySchema>;\n\nexport const areaPickerItemSchema = z.object({\n _id: z.string(),\n name: z.string(),\n level: areaPickerLevelSchema,\n parentId: z.string(),\n});\nexport type AreaPickerItem = z.infer<typeof areaPickerItemSchema>;\n\nexport const areaPickerResponseSchema = z.object({\n items: z.array(areaPickerItemSchema),\n});\nexport type AreaPickerResponse = z.infer<typeof areaPickerResponseSchema>;\n"]}
1
+ {"version":3,"file":"community.js","sourceRoot":"","sources":["../src/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,oCAAoC,EACpC,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,OAAO;IACP,UAAU;IACV,OAAO;IACP,gBAAgB;IAChB,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;AAE3F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAU,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI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IAClB,iEAAiE;IACjE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,QAAQ,EAAE;IACvE,4BAA4B;IAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,8EAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC;wEACoE;IACpE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC","sourcesContent":["/**\n * Topical Community wire shapes.\n *\n * A Community is a Reddit-subreddit / Facebook-group style surface: a\n * named topic users can discover, join, and post into. Distinct from\n * the user-created `Group` (chat-bound, small, private) — each\n * Community auto-owns its own bound `Group` (so members get a\n * Community chat room for free) but they're conceptually different\n * objects with their own roster + permissions.\n *\n * Visibility model\n * ----------------\n * - `public` — anyone can join one-tap; posts are visible to all\n * viewers in the community feed.\n * - `private` — joining requires owner / admin approval; posts and\n * member list are hidden from non-members. Discovery\n * still lists the community card (name + description +\n * member count + join button) so users can request to\n * join.\n *\n * Posts inside a community do NOT participate in the geo cascade —\n * they live and die inside the community surface. Posts authored\n * from the global composer continue to flow through the geo\n * area-proximity cascade ranked by `tierBoost` (see\n * `reform-backend/src/services/community/services/visibility.service.ts`).\n *\n * @module community-schema/community\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport {\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_PATTERN,\n COMMUNITY_MAX_TAGS,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n} from './constants.js';\n\n// ─── Enums ──────────────────────────────────────────────────────────────────\n\n/**\n * Two fundamentally different community shapes share the same wire\n * schema:\n *\n * user — topic-of-interest community a regular user creates and\n * owns (Reddit subreddit / Facebook group analogue). Owner\n * + admins manage; members join. The default kind.\n * official — area-based civic community for a specific administrative\n * area (village / block / district / urban body / ... up\n * to state). Created by the elected area leader; has NO\n * owner. Permission is computed at read time from the\n * current area-leader binding:\n * - admin role = whoever is the area's leader right now\n * (falls back to platform superadmin when no leader is\n * appointed)\n * - representative role = the elected official the area\n * leader names (Pradhan / Mayor / MLA / ...); replaced\n * on each new political election\n * - moderator role = community-scoped; can hide reported\n * posts. Representative can override moderator\n * decisions from settings.\n * Always auto-verified (the leader's act of creating it IS\n * the verification) and immune to delete from anyone\n * except platform superadmin / manager.\n */\nexport const COMMUNITY_KIND_VALUES = ['user', 'official'] as const;\nexport type CommunityKind = (typeof COMMUNITY_KIND_VALUES)[number];\nexport const communityKindSchema = z.enum(COMMUNITY_KIND_VALUES);\n\n/**\n * Administrative area levels that can host an official community.\n *\n * Mirrors a subset of the reform-backend `JURISDICTION_LEVEL` enum —\n * NATIONAL and GLOBAL are intentionally excluded because they are\n * virtual tiers (no `Area` row) and don't fit the \"community for THIS\n * area\" model. If we ever want national / global civic communities\n * they should be a separate concept.\n *\n * The leader-jurisdiction → area-kind binding is 1:1:\n * leader.jurisdictionLevel === community.officialAreaKind AND\n * leader.jurisdictionAreaId === community.officialAreaId\n * is the gate for who can create / admin the community.\n */\nexport const OFFICIAL_COMMUNITY_AREA_KIND_VALUES = [\n 'STATE',\n 'DISTRICT',\n 'BLOCK',\n 'GRAM_PANCHAYAT',\n 'VILLAGE',\n 'URBAN_BODY',\n 'URBAN_WARD',\n 'LOCALITY',\n] as const;\nexport type OfficialCommunityAreaKind = (typeof OFFICIAL_COMMUNITY_AREA_KIND_VALUES)[number];\nexport const officialCommunityAreaKindSchema = z.enum(OFFICIAL_COMMUNITY_AREA_KIND_VALUES);\n\n/**\n * public — anyone can read + post.\n * restricted — anyone can read; only approved members can post. The\n * middle option Reddit added so communities can be open\n * to browse but moderated on the write side.\n * private — only approved members can read or post. The roster\n * + post bodies are hidden from non-members.\n */\nexport const COMMUNITY_TYPE_VALUES = ['public', 'restricted', 'private'] as const;\nexport type CommunityType = (typeof COMMUNITY_TYPE_VALUES)[number];\nexport const communityTypeSchema = z.enum(COMMUNITY_TYPE_VALUES);\n\n/**\n * Geographic scope a community claims. Maps onto the existing\n * area-lineage tiers so discovery can match a viewer's `areaLineage`\n * one tier at a time.\n *\n * neighborhood — hyperlocal; carries `areaLineage.localId` +\n * `centerCoords`. Discovery uses the 5 km radius from\n * `COMMUNITY_HYPERLOCAL_RADIUS_KM`.\n * city — district-scoped; carries `areaLineage.districtId`.\n * state — carries `areaLineage.stateId`.\n * national — carries `areaLineage.countryId`.\n * global — area-agnostic; `areaLineage` is null.\n */\nexport const COMMUNITY_REACH_VALUES = [\n 'neighborhood',\n 'city',\n 'state',\n 'national',\n 'global',\n] as const;\nexport type CommunityReach = (typeof COMMUNITY_REACH_VALUES)[number];\nexport const communityReachSchema = z.enum(COMMUNITY_REACH_VALUES);\n\n/**\n * Verification scope on a verified community — which leader-tier\n * vouched for it.\n *\n * state — a state-level leader verified within their own state.\n * national — a national-level leader (or higher).\n * global — a global / platform-level leader.\n */\nexport const COMMUNITY_VERIFIED_SCOPE_VALUES = ['state', 'national', 'global'] as const;\nexport type CommunityVerifiedScope = (typeof COMMUNITY_VERIFIED_SCOPE_VALUES)[number];\nexport const communityVerifiedScopeSchema = z.enum(COMMUNITY_VERIFIED_SCOPE_VALUES);\n\n/**\n * Curated category enum. Slugs are **stable English keys** (snake_case);\n * the visible label is i18n'd on the frontend (en/hi message files).\n * Never store culturally-specific or transliterated names here — the\n * locale layer owns presentation.\n *\n * First 12 slugs are weighted toward the Indian civic / hyperlocal\n * context that Jansathi serves (Women's / Men's / Youth groups, RWA,\n * Social Welfare, Civic Reform). Remaining 30 are general-interest\n * categories adapted from Reddit's curated topic set + Facebook\n * Groups' top discovery categories.\n *\n * See `docs/community-create-v2.md` §2 in the jansathi-frontend repo\n * for the full label table.\n */\nexport const COMMUNITY_CATEGORY_VALUES = [\n // Indian civic / community (12)\n 'womens_group',\n 'mens_group',\n 'youth_group',\n 'senior_citizens',\n 'parenting_children',\n 'resident_welfare',\n 'social_welfare',\n 'social_awareness',\n 'volunteering',\n 'civic_reform',\n 'local_news_issues',\n 'environment',\n // Civic & legal (3)\n 'legal_law',\n 'politics_government',\n 'real_estate_housing',\n // Faith & culture (3)\n 'religion_spirituality',\n 'festivals_culture',\n 'devotional',\n // Education & sciences (5)\n 'education',\n 'competitive_exams',\n 'books_literature',\n 'language_learning',\n 'science',\n // Health & wellness (4)\n 'health_wellness',\n 'yoga_meditation',\n 'fitness',\n 'mental_health',\n // Identity & society (2)\n 'lgbtq_identity',\n 'mature_topics',\n // Lifestyle (7)\n 'food_cooking',\n 'travel',\n 'photography',\n 'fashion_beauty',\n 'home_garden',\n 'pets_animals',\n 'vehicles_automotive',\n // Sports & arts (5)\n 'sports',\n 'cricket',\n 'arts_crafts',\n 'music',\n 'dance',\n // Entertainment (4)\n 'movies_tv',\n 'gaming',\n 'entertainment',\n 'anime_cosplay',\n // Professional (5)\n 'business_career',\n 'entrepreneurship',\n 'technology',\n 'finance_investing',\n 'agriculture',\n // Information (1) + fallback (1)\n 'news_current_affairs',\n 'other',\n] as const;\nexport type CommunityCategory = (typeof COMMUNITY_CATEGORY_VALUES)[number];\nexport const communityCategorySchema = z.enum(COMMUNITY_CATEGORY_VALUES);\n\n/**\n * Curated tag enum. A community picks 0–`COMMUNITY_MAX_TAGS` from\n * this list. Tags are stable English snake_case slugs; the visible\n * label is i18n'd. The tag picker UI groups them by theme via a\n * separate theme-map on the frontend; the stored enum is flat.\n *\n * Total: 112 tags spanning civic, health, education, sports, food,\n * arts/music/faith, business/tech, local issues, and lifestyle.\n */\nexport const COMMUNITY_TAG_VALUES = [\n // Civic & social (29)\n 'volunteer',\n 'donation_drive',\n 'blood_donation',\n 'anti_corruption',\n 'women_safety',\n 'child_safety',\n 'senior_care',\n 'disability_support',\n 'lgbtq_support',\n 'environment',\n 'cleanliness',\n 'plant_trees',\n 'waste_management',\n 'legal_aid',\n 'rti',\n 'voter_awareness',\n 'government_schemes',\n 'ngo',\n 'charity',\n 'relief_work',\n 'public_service',\n 'fundraising',\n 'awareness_campaign',\n 'social_justice',\n 'women_empowerment',\n 'rural_development',\n 'tribal_welfare',\n 'homeless_support',\n 'street_children',\n // Community & neighborhood (8) — new theme\n 'community_growth',\n 'residents_association',\n 'housing_society',\n 'gated_community',\n 'apartment_living',\n 'mohalla_committee',\n 'newcomers_welcome',\n 'neighborhood_safety',\n // Health & wellness (19)\n 'yoga',\n 'meditation',\n 'fitness',\n 'running',\n 'cycling',\n 'walking',\n 'nutrition',\n 'mental_health',\n 'ayurveda',\n 'weight_loss',\n 'womens_health',\n 'mens_health',\n 'dental_health',\n 'eye_care',\n 'diabetes_support',\n 'cancer_support',\n 'heart_health',\n 'addiction_recovery',\n 'pregnancy_support',\n // Education (16)\n 'jee',\n 'neet',\n 'upsc',\n 'ssc',\n 'ielts',\n 'school_support',\n 'college_support',\n 'scholarship',\n 'career_guidance',\n 'coding',\n 'mathematics',\n 'science',\n 'languages',\n 'spoken_english',\n 'tutoring',\n 'study_abroad',\n // Sports (9)\n 'cricket',\n 'football',\n 'badminton',\n 'tennis',\n 'kabaddi',\n 'hockey',\n 'chess',\n 'swimming',\n 'marathon',\n // Food (10)\n 'street_food',\n 'home_cooking',\n 'vegetarian',\n 'vegan',\n 'jain_food',\n 'fasting_recipes',\n 'north_indian',\n 'south_indian',\n 'baking',\n 'desserts',\n // Arts, music, faith (21)\n 'classical_music',\n 'hindustani',\n 'carnatic',\n 'bhajan',\n 'kirtan',\n 'bollywood',\n 'dance_classical',\n 'dance_folk',\n 'painting',\n 'photography',\n 'craft',\n 'satsang',\n 'festivals',\n 'pilgrimage',\n 'gita_study',\n 'ramayan',\n 'bhagwat',\n 'vedanta',\n 'sikh_satsang',\n 'christian_fellowship',\n 'jain_swadhyay',\n // Business & tech (19)\n 'entrepreneurship',\n 'startup',\n 'small_business',\n 'freelancing',\n 'real_estate',\n 'stocks_investing',\n 'mutual_funds',\n 'agriculture',\n 'handicrafts',\n 'job_postings',\n 'web_development',\n 'artificial_intelligence',\n 'data_science',\n 'cybersecurity',\n 'app_development',\n 'ui_ux_design',\n 'social_media_marketing',\n 'content_creation',\n 'gaming',\n // Local issues (9)\n 'water_supply',\n 'electricity',\n 'road_repair',\n 'garbage_collection',\n 'drainage',\n 'public_transport',\n 'traffic',\n 'parking',\n 'local_healthcare',\n // Skills & trades (6) — new theme\n 'tailoring',\n 'carpentry',\n 'electrical_work',\n 'plumbing',\n 'beauty_skills',\n 'driving',\n // Pets & animals (5) — new theme\n 'pets',\n 'dog_lovers',\n 'cat_lovers',\n 'stray_animal_care',\n 'veterinary_help',\n // Lifestyle (9)\n 'movies',\n 'tv_shows',\n 'books_club',\n 'trekking',\n 'parenting',\n 'gardening',\n 'pottery',\n 'diy',\n 'home_decor',\n] as const;\nexport type CommunityTag = (typeof COMMUNITY_TAG_VALUES)[number];\nexport const communityTagSchema = z.enum(COMMUNITY_TAG_VALUES);\n\n/**\n * Preset designation labels — purely **representation** (not\n * permission-bearing). Renders in brackets after a member's display\n * name in a community context (e.g., \"Hari Joshi (Chairman) · 12h ago\").\n *\n * Permission still flows through `CommunityRole` (owner / admin /\n * member). A designation does NOT promote or restrict anything.\n *\n * Per-community: Hari can be \"Chairman\" in one community and\n * \"Member-at-Large\" in another. Custom designations (free text)\n * cover the long tail; presets are surfaced first in the picker.\n */\nexport const COMMUNITY_DESIGNATION_PRESETS = [\n 'chairman',\n 'vice_chairman',\n 'president',\n 'vice_president',\n 'secretary',\n 'joint_secretary',\n 'general_secretary',\n 'treasurer',\n 'joint_treasurer',\n 'organizer',\n 'coordinator',\n 'spokesperson',\n 'founder',\n 'co_founder',\n 'patron',\n 'advisor',\n 'mentor',\n 'committee_member',\n 'member_at_large',\n 'volunteer',\n] as const;\nexport type CommunityDesignationPreset = (typeof COMMUNITY_DESIGNATION_PRESETS)[number];\nexport const communityDesignationPresetSchema = z.enum(COMMUNITY_DESIGNATION_PRESETS);\n\n/**\n * Designation stored on a `CommunityMembership`. Exactly one of\n * `preset` / `custom` is non-null when a designation is set.\n *\n * { preset: 'chairman', custom: null } — picked from the preset enum.\n * { preset: null, custom: 'Press & Media' } — free text.\n * null — no designation.\n *\n * The picker UI surfaces the preset list first; the custom path is\n * for niche labels that don't fit a preset. Validation enforces\n * exactly-one via a refinement.\n */\nexport const communityDesignationSchema = z\n .object({\n preset: communityDesignationPresetSchema.nullable(),\n custom: z.string().nullable(),\n })\n .refine((d) => (d.preset == null) !== (d.custom == null), {\n message: 'Designation must have exactly one of `preset` or `custom` set.',\n });\nexport type CommunityDesignation = z.infer<typeof communityDesignationSchema>;\n\n/**\n * Latitude / longitude pair used for hyperlocal (`reach=neighborhood`)\n * communities. Stored at create time from either the picked area's\n * centroid (if the Area carries coordinates) or the creator's current\n * GPS as a fallback. Indexed 2dsphere on the backend; powers the\n * `$nearSphere` query inside the `?nearMe=true` listing filter.\n */\nexport const communityCenterCoordsSchema = z.object({\n lat: z.number().min(-90).max(90),\n lng: z.number().min(-180).max(180),\n});\nexport type CommunityCenterCoords = z.infer<typeof communityCenterCoordsSchema>;\n\n/** Role hierarchy within a single community.\n *\n * The role set is shared across `user` and `official` communities, but\n * not every role is valid for every kind:\n *\n * owner — `kind: 'user'` only. The creator; can edit\n * metadata, transfer ownership (deferred), and\n * delete the community.\n * admin — `kind: 'user'`: granted by the owner; can edit\n * metadata, kick members, soft-delete posts.\n * `kind: 'official'`: computed from the current\n * area-leader binding (never stored on a membership\n * row); platform superadmin fills the slot when no\n * leader is appointed.\n * representative — `kind: 'official'` only. The elected official the\n * area leader names (Pradhan / Mayor / ...).\n * Replaced on every new political election. Can\n * override moderator decisions from the community\n * settings page.\n * moderator — `kind: 'official'` only. Community-scoped; can\n * hide reported posts. Multiple moderators allowed\n * per community. The current admin (area leader)\n * grants and revokes.\n * member — joined; can post and comment, can leave at any\n * time. Valid for both kinds.\n */\nexport const COMMUNITY_ROLE_VALUES = [\n 'owner',\n 'admin',\n 'representative',\n 'moderator',\n 'member',\n] as const;\nexport type CommunityRole = (typeof COMMUNITY_ROLE_VALUES)[number];\nexport const communityRoleSchema = z.enum(COMMUNITY_ROLE_VALUES);\n\n/** Membership lifecycle.\n *\n * active — currently in the community.\n * pending — for a `private` community: the join request is awaiting\n * owner/admin approval. Pending rows aren't counted toward\n * `memberCount` and the user can't post yet.\n */\nexport const COMMUNITY_MEMBERSHIP_STATUS_VALUES = ['active', 'pending'] as const;\nexport type CommunityMembershipStatus = (typeof COMMUNITY_MEMBERSHIP_STATUS_VALUES)[number];\nexport const communityMembershipStatusSchema = z.enum(COMMUNITY_MEMBERSHIP_STATUS_VALUES);\n\n// ─── Wire shape ─────────────────────────────────────────────────────────────\n\n/**\n * `GET /communities/:slug` / discovery card / search hit.\n *\n * `viewer` is included when the request is authenticated. It carries\n * the viewer's role + membership status so the UI can render the\n * right CTA (Join / Joined / Pending / Owner) without a follow-up\n * round trip.\n */\nexport const communityWireSchema = z.object({\n _id: z.string(),\n slug: z.string(),\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n /** Discriminator. `user` = topical / interest community; `official`\n * = area-based civic community owned by an area leader. Default at\n * read time when omitted by a pre-v3 backend is `user`. */\n kind: communityKindSchema,\n /** User communities only — the creator. Null for `kind: 'official'`\n * (those have no owner; admin is computed from the area-leader\n * binding). */\n ownerUserId: z.string().nullable(),\n /** Audit-only userId of whoever created the community. Carries no\n * permission on its own — present on both kinds so the wire shape\n * stays uniform. For `kind: 'user'` this equals `ownerUserId`. */\n createdBy: z.string().nullable(),\n /** Active members only. Pending join-requests don't count. */\n memberCount: z.number().int().nonnegative(),\n /** Denormalised post count. Increments on create, decrements on\n * soft-delete. */\n postCount: z.number().int().nonnegative(),\n /** Bound chat-group id. Auto-created when the Community is created;\n * members are added to both rosters in lockstep. */\n groupId: z.string(),\n createdAt: z.string().datetime(),\n\n // ─── v2 taxonomy + reach + verification ─────────────────────────────\n /** Curated subject category. Single source of truth in\n * `COMMUNITY_CATEGORY_VALUES`; visible label is i18n'd. */\n category: communityCategorySchema,\n /** Geographic scope. Drives discovery filtering and is the reason\n * `areaLineage` / `centerCoords` may be present. */\n reach: communityReachSchema,\n /** Up to `COMMUNITY_MAX_TAGS` (10) tags from the curated enum. */\n tags: z.array(communityTagSchema),\n /** Mature (18+) flag. Content-gates the surface (blur previews,\n * age-confirm) once the gate UI ships; the field is persisted\n * from create-time so the mature designation is permanent. */\n mature: z.boolean(),\n /** Area snapshot — present when `reach !== 'global'`. Mirrors the\n * post-area lineage pattern; written once at create time and\n * immutable thereafter. */\n areaLineage: areaLineageSnapshotSchema.nullable(),\n /** Lat/lng pair — present when `reach === 'neighborhood'`. Powers\n * the `?nearMe=true` 5 km geospatial filter on discovery. */\n centerCoords: communityCenterCoordsSchema.nullable(),\n /** ISO timestamp set by a state+ leader when verifying the\n * community. Null until verified; clearing reverts to null. For\n * `kind: 'official'` this is auto-set at create time (the leader's\n * act of creating it IS the verification). */\n verifiedAt: z.string().datetime().nullable(),\n /** UserId of the leader who verified. For `kind: 'official'` this\n * is the leader who created it (same as `createdBy`). */\n verifiedBy: z.string().nullable(),\n /** Which leader tier vouched — drives the badge tooltip (\"verified\n * by a state leader\" vs \"by a national leader\"). For\n * `kind: 'official'` this is null because the \"official\" badge\n * itself communicates authority. */\n verifiedScope: communityVerifiedScopeSchema.nullable(),\n\n // ─── Official community fields ──────────────────────────────────────\n /** Administrative level of the area this official community is\n * bound to. Null for `kind: 'user'`. */\n officialAreaKind: officialCommunityAreaKindSchema.nullable(),\n /** ObjectId of the specific Area entity this official community\n * represents. Null for `kind: 'user'`. Combined with\n * `officialAreaKind`, the pair `(officialAreaKind, officialAreaId)`\n * is unique among non-deleted official communities — one official\n * community per area, ever. */\n officialAreaId: z.string().nullable(),\n\n viewer: z\n .object({\n role: communityRoleSchema.nullable(),\n status: communityMembershipStatusSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n /** Viewer's designation in THIS community. Null when the\n * viewer is not a member or has no designation set. Returned\n * at the wire level (vs the roster level) so post-cards and\n * the byline can render `(Chairman)` without a separate\n * roster lookup. */\n designation: communityDesignationSchema.nullable(),\n })\n .optional(),\n});\nexport type CommunityWire = z.infer<typeof communityWireSchema>;\n\n// ─── Member roster row ──────────────────────────────────────────────────────\n\nexport const communityMemberWireSchema = z.object({\n userId: z.string(),\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n localName: z.string().optional(),\n role: communityRoleSchema,\n status: communityMembershipStatusSchema,\n joinedAt: z.string().datetime(),\n /** Per-community representation label. See\n * `communityDesignationSchema` — null when none set. */\n designation: communityDesignationSchema.nullable(),\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader. Drives the green check badge in the member\n * roster row. Optional for forward-compat with un-migrated\n * backends. */\n identityVerified: z.boolean().optional(),\n});\nexport type CommunityMemberWire = z.infer<typeof communityMemberWireSchema>;\n\n// ─── Create body ────────────────────────────────────────────────────────────\n\n/**\n * `POST /communities` body. `slug` is optional — when omitted the\n * backend auto-generates one from the name (lowercased, hyphenated,\n * collision-suffixed). When provided it must match the slug pattern\n * and be unique.\n *\n * `areaId` is required when `reach !== 'global'` — it's the deepest-\n * matching area-entity id (`localId` for neighborhood, `districtId`\n * for city, etc.) the creator picked from the area picker. The\n * backend resolves the full `areaLineage` snapshot from this id.\n */\nexport const createCommunityBodySchema = z\n .object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS),\n slug: z\n .string()\n .min(COMMUNITY_SLUG_MIN_CHARS)\n .max(COMMUNITY_SLUG_MAX_CHARS)\n .regex(COMMUNITY_SLUG_PATTERN)\n .optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n type: communityTypeSchema,\n coverImageUrl: z.string().url().optional(),\n // ── v2 fields ─────────────────────────────────────────────────\n category: communityCategorySchema,\n reach: communityReachSchema,\n /** ObjectId of the picked area at the reach's tier. Required iff\n * `reach !== 'global'`. */\n areaId: z.string().optional(),\n tags: z.array(communityTagSchema).max(COMMUNITY_MAX_TAGS).default([]),\n mature: z.boolean().default(false),\n })\n .superRefine((body, ctx) => {\n if (body.reach !== 'global' && !body.areaId) {\n ctx.addIssue({\n code: 'custom',\n path: ['areaId'],\n message: 'Area is required when reach is not Global.',\n });\n }\n });\nexport type CreateCommunityBody = z.infer<typeof createCommunityBodySchema>;\n\n// ─── Update body (owner / admin only) ───────────────────────────────────────\n\n/**\n * `PATCH /communities/:slug` body. All fields optional. Sending\n * `null` for `description` or `coverImageUrl` clears that field.\n *\n * Type changes between `public` / `restricted` / `private` are NOT\n * supported in v1 — the decision has implications for already-\n * published posts and pending join requests that we don't want to\n * silently handle. Recreate the community if you need to switch.\n *\n * `category`, `tags`, `mature` are editable post-create. `reach` and\n * `areaLineage` / `centerCoords` are NOT editable — moving a community\n * across geographic scopes would silently invalidate every existing\n * member's relationship with it.\n */\nexport const updateCommunityBodySchema = z.object({\n name: z.string().min(COMMUNITY_NAME_MIN_CHARS).max(COMMUNITY_NAME_MAX_CHARS).optional(),\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).nullable().optional(),\n coverImageUrl: z.string().url().nullable().optional(),\n category: communityCategorySchema.optional(),\n tags: z.array(communityTagSchema).max(COMMUNITY_MAX_TAGS).optional(),\n mature: z.boolean().optional(),\n});\nexport type UpdateCommunityBody = z.infer<typeof updateCommunityBodySchema>;\n\n// ─── List + discover + search responses ─────────────────────────────────────\n\n/** Sort order on the discover page. `popular` ranks by active member\n * count, `new` by createdAt desc. `top` is reserved for a future\n * activity-weighted ranking and accepted as a no-op for now. */\nexport const COMMUNITY_DISCOVER_SORT_VALUES = ['popular', 'new', 'top'] as const;\nexport type CommunityDiscoverSort = (typeof COMMUNITY_DISCOVER_SORT_VALUES)[number];\nexport const communityDiscoverSortSchema = z.enum(COMMUNITY_DISCOVER_SORT_VALUES);\n\nexport const communityListQuerySchema = z.object({\n sort: communityDiscoverSortSchema.optional(),\n /** Free-text fragment matched case-insensitively against the\n * community name. */\n q: z.string().max(60).optional(),\n cursor: z.string().optional(),\n pageSize: z.number().int().min(1).max(COMMUNITIES_PAGE_SIZE).optional(),\n // ── v2 discovery filters ─────────────────────────────────────────\n /** Filter by curated subject category. */\n category: communityCategorySchema.optional(),\n /** Filter by geographic reach tier. */\n reach: communityReachSchema.optional(),\n /** Return only verified communities. */\n verified: z.boolean().optional(),\n /** Layered \"near me\" mode — when true, returns the union of:\n * • `reach=neighborhood` AND `centerCoords` within\n * `COMMUNITY_HYPERLOCAL_RADIUS_KM` of the supplied (lat, lng),\n * • `reach=city` AND `districtId = viewer.districtId`,\n * • `reach=state` AND `stateId = viewer.stateId`,\n * • `reach=national` AND `countryId = viewer.countryId`.\n * `lat` + `lng` must accompany the flag (typically from the\n * viewer's currentLocation GPS). */\n nearMe: z.boolean().optional(),\n lat: z.number().min(-90).max(90).optional(),\n lng: z.number().min(-180).max(180).optional(),\n});\nexport type CommunityListQuery = z.infer<typeof communityListQuerySchema>;\n\nexport const communityListResponseSchema = z.object({\n items: z.array(communityWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityListResponse = z.infer<typeof communityListResponseSchema>;\n\n// ─── Membership actions ────────────────────────────────────────────────────\n\n/**\n * `POST /communities/:slug/join`. Response carries the new viewer\n * state so the client can update the CTA without a follow-up GET.\n *\n * - public → returns `{ status: 'active', role: 'member' }`\n * - private → returns `{ status: 'pending', role: null }`; the\n * owner / admin approves via the moderation endpoint\n * (`POST /communities/:slug/members/:userId/approve`).\n */\nexport const joinCommunityResponseSchema = z.object({\n status: communityMembershipStatusSchema,\n role: communityRoleSchema.nullable(),\n joinedAt: z.string().datetime().nullable(),\n});\nexport type JoinCommunityResponse = z.infer<typeof joinCommunityResponseSchema>;\n\nexport const communityMembersListResponseSchema = z.object({\n items: z.array(communityMemberWireSchema),\n nextCursor: z.string().nullable(),\n});\nexport type CommunityMembersListResponse = z.infer<typeof communityMembersListResponseSchema>;\n\n/** Body for `POST /communities/:slug/members/:userId/role` — owner-\n * only. Used to promote a member to admin or demote an admin back\n * to plain member. Owner role can't be set via this endpoint;\n * transferring ownership has its own dedicated route (deferred). */\nexport const updateMemberRoleBodySchema = z.object({\n role: z.enum(['admin', 'member']),\n});\nexport type UpdateMemberRoleBody = z.infer<typeof updateMemberRoleBodySchema>;\n\n// ─── Designation (representation, not permission) ──────────────────────────\n\n/**\n * Body for `PUT /communities/:slug/members/:userId/designation`.\n * Owner / admin only. Exactly one of `preset` / `custom` must be set.\n *\n * Use the preset list first (one-tap pick from `CommunityDesignationPreset`);\n * fall through to `custom` for niche labels (\"Press & Media\",\n * \"Disaster Response Lead\", etc.) that don't fit a preset.\n *\n * To clear an existing designation, use `DELETE` on the same path —\n * there's no \"null\" mode on this body.\n */\nexport const setMemberDesignationBodySchema = z\n .object({\n preset: communityDesignationPresetSchema.optional(),\n custom: z\n .string()\n .min(COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS)\n .max(COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS)\n .regex(COMMUNITY_DESIGNATION_CUSTOM_PATTERN)\n .optional(),\n })\n .refine((b) => (b.preset != null) !== (b.custom != null), {\n message: 'Provide exactly one of `preset` or `custom`.',\n });\nexport type SetMemberDesignationBody = z.infer<typeof setMemberDesignationBodySchema>;\n\n// ─── Verification (state+ leader vouch) ────────────────────────────────────\n\n/**\n * Body for `POST /communities/:slug/verify`. Empty for now; the\n * verifier's scope (`state | national | global`) is derived from the\n * caller's leader role rather than supplied. Keeping a body object\n * leaves room for a `note` field later without a breaking change.\n */\nexport const verifyCommunityBodySchema = z.object({\n /** Optional free-text note the leader can attach to the verification\n * (visible in the verification audit trail; not surfaced in the\n * default badge tooltip). Capped at 200 chars. */\n note: z.string().max(200).optional(),\n});\nexport type VerifyCommunityBody = z.infer<typeof verifyCommunityBodySchema>;\n\n// ─── Area picker query (powers the cascading area sheet) ───────────────────\n\n/**\n * `GET /areas?level=...&parentId=...&q=...` — backs the area picker\n * inside the create-community wizard's step 3. Returns areas at the\n * specified `level` that sit under the given parent area:\n *\n * level=local → returns localities under a `districtId` parent.\n * level=district → returns districts under a `stateId` parent.\n * level=state → returns states under a `countryId` parent.\n *\n * The picker constrains the user to siblings under their own parent\n * area (so a Maharashtra creator can pick any locality in Maharashtra\n * for a neighborhood community, but not one in Tamil Nadu).\n */\nexport const AREA_PICKER_LEVEL_VALUES = ['local', 'district', 'state'] as const;\nexport type AreaPickerLevel = (typeof AREA_PICKER_LEVEL_VALUES)[number];\nexport const areaPickerLevelSchema = z.enum(AREA_PICKER_LEVEL_VALUES);\n\nexport const areaPickerQuerySchema = z.object({\n level: areaPickerLevelSchema,\n parentId: z.string(),\n /** Optional name prefix for debounced search inside the sheet. */\n q: z.string().max(60).optional(),\n});\nexport type AreaPickerQuery = z.infer<typeof areaPickerQuerySchema>;\n\nexport const areaPickerItemSchema = z.object({\n _id: z.string(),\n name: z.string(),\n level: areaPickerLevelSchema,\n parentId: z.string(),\n});\nexport type AreaPickerItem = z.infer<typeof areaPickerItemSchema>;\n\nexport const areaPickerResponseSchema = z.object({\n items: z.array(areaPickerItemSchema),\n});\nexport type AreaPickerResponse = z.infer<typeof areaPickerResponseSchema>;\n\n// ─── Official community — create + manage ──────────────────────────────────\n\n/**\n * `POST /communities/official` body. Single-step flow.\n *\n * The area-leader binding gates the call: the caller's elevated\n * `serviceRoles['reform']` must include `leader` AND their\n * `jurisdictionLevel + jurisdictionAreaId` must exactly equal the\n * `areaKind + areaId` supplied here. Backend resolves the rest:\n *\n * • `name` and `slug` are derived server-side from the area name +\n * kind (e.g. \"Pataudi Block Community\" / `pataudi-block`). The\n * caller may override `description` and pick a cover image.\n * • `kind` is fixed to `'official'`; no need to send it.\n * • `reach`, `category`, `tags`, `mature`, `areaLineage`,\n * `centerCoords` are derived from the picked area.\n * • `verifiedAt`, `verifiedBy` are auto-set at create time (the\n * leader's act of creating it IS the verification).\n *\n * Re-creating after an area-level community has been soft-deleted by\n * superadmin is allowed because the partial unique index excludes\n * soft-deleted rows.\n */\nexport const createOfficialCommunityBodySchema = z.object({\n /** Administrative level of the picked area. Must equal the caller's\n * jurisdictionLevel. */\n areaKind: officialCommunityAreaKindSchema,\n /** ObjectId of the picked Area entity. Must equal the caller's\n * jurisdictionAreaId. */\n areaId: z.string(),\n /** Optional one-line description shown on the community card. */\n description: z.string().max(COMMUNITY_DESCRIPTION_MAX_CHARS).optional(),\n /** Optional cover image. */\n coverImageUrl: z.string().url().optional(),\n});\nexport type CreateOfficialCommunityBody = z.infer<typeof createOfficialCommunityBodySchema>;\n\n/**\n * Body for `POST /communities/:slug/moderators` — assign a moderator.\n * The target user must already be an active member of the community.\n *\n * Caller authority:\n * - `kind: 'official'` admin (the current area leader, or the\n * platform superadmin when no leader is appointed) can add or\n * remove a moderator. The representative cannot (representative\n * can override moderator decisions but does not manage the\n * moderator roster).\n *\n * To remove a moderator use `DELETE /communities/:slug/moderators/:userId`.\n */\nexport const addOfficialModeratorBodySchema = z.object({\n userId: z.string(),\n});\nexport type AddOfficialModeratorBody = z.infer<typeof addOfficialModeratorBodySchema>;\n\n/**\n * Body for `PUT /communities/:slug/representative` — set or replace\n * the community's named elected representative (Pradhan / Mayor / ...).\n *\n * The representative slot is single-valued: writing a new user ID\n * replaces whoever held it before (matching the \"new election → new\n * person\" lifecycle). Use `DELETE /communities/:slug/representative`\n * to clear the slot between elections.\n *\n * The target user must already be an active member of the community;\n * the backend will auto-add them as a member if they're not.\n *\n * Caller authority: `kind: 'official'` admin only.\n */\nexport const setOfficialRepresentativeBodySchema = z.object({\n userId: z.string(),\n});\nexport type SetOfficialRepresentativeBody = z.infer<typeof setOfficialRepresentativeBodySchema>;\n\n// ─── Post moderation (hide / unhide for moderator + representative) ────────\n\n/**\n * Body for `POST /communities/:slug/posts/:postId/hide`.\n *\n * Hides a post from the community feed for everyone except the author\n * (who still sees their own post, marked as \"hidden by moderator\").\n *\n * Caller authority on `kind: 'official'`:\n * - moderator — can hide a post that has at least one open report.\n * - representative — can hide or unhide ANY post (including overriding\n * a moderator's hide). The override is what makes\n * the representative's \"settings\" page useful.\n * - admin — same authority as representative.\n *\n * On `kind: 'user'` the existing soft-delete by owner / admin path\n * continues to apply; this endpoint is `official`-only.\n */\nexport const hidePostBodySchema = z.object({\n /** Optional moderator note (visible only to other moderators + the\n * representative + admin on the moderation log). Capped at 500. */\n reason: z.string().max(500).optional(),\n});\nexport type HidePostBody = z.infer<typeof hidePostBodySchema>;\n"]}
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export { type AreaLineageSnapshot, areaLineageSnapshotSchema, } from './area.js';
18
18
  export { type CommunityCommentWire, type CreateCommentBody, communityCommentWireSchema, createCommentBodySchema, type UpdateCommentBody, updateCommentBodySchema, } from './comment.js';
19
- export { AREA_PICKER_LEVEL_VALUES, type AreaPickerItem, type AreaPickerLevel, type AreaPickerQuery, type AreaPickerResponse, areaPickerItemSchema, areaPickerLevelSchema, areaPickerQuerySchema, areaPickerResponseSchema, COMMUNITY_CATEGORY_VALUES, COMMUNITY_DESIGNATION_PRESETS, COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_REACH_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TAG_VALUES, COMMUNITY_TYPE_VALUES, COMMUNITY_VERIFIED_SCOPE_VALUES, type CommunityCategory, type CommunityCenterCoords, type CommunityDesignation, type CommunityDesignationPreset, type CommunityDiscoverSort, type CommunityListQuery, type CommunityListResponse, type CommunityMembershipStatus, type CommunityMembersListResponse, type CommunityMemberWire, type CommunityReach, type CommunityRole, type CommunityTag, type CommunityType, type CommunityVerifiedScope, type CommunityWire, type CreateCommunityBody, communityCategorySchema, communityCenterCoordsSchema, communityDesignationPresetSchema, communityDesignationSchema, communityDiscoverSortSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityReachSchema, communityRoleSchema, communityTagSchema, communityTypeSchema, communityVerifiedScopeSchema, communityWireSchema, createCommunityBodySchema, type JoinCommunityResponse, joinCommunityResponseSchema, type SetMemberDesignationBody, setMemberDesignationBodySchema, type UpdateCommunityBody, type UpdateMemberRoleBody, updateCommunityBodySchema, updateMemberRoleBodySchema, type VerifyCommunityBody, verifyCommunityBodySchema, } from './community.js';
19
+ export { type AddOfficialModeratorBody, addOfficialModeratorBodySchema, AREA_PICKER_LEVEL_VALUES, type AreaPickerItem, type AreaPickerLevel, type AreaPickerQuery, type AreaPickerResponse, areaPickerItemSchema, areaPickerLevelSchema, areaPickerQuerySchema, areaPickerResponseSchema, COMMUNITY_CATEGORY_VALUES, COMMUNITY_DESIGNATION_PRESETS, COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_KIND_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_REACH_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TAG_VALUES, COMMUNITY_TYPE_VALUES, COMMUNITY_VERIFIED_SCOPE_VALUES, type CommunityCategory, type CommunityCenterCoords, type CommunityDesignation, type CommunityDesignationPreset, type CommunityDiscoverSort, type CommunityKind, type CommunityListQuery, type CommunityListResponse, type CommunityMembershipStatus, type CommunityMembersListResponse, type CommunityMemberWire, type CommunityReach, type CommunityRole, type CommunityTag, type CommunityType, type CommunityVerifiedScope, type CommunityWire, type CreateCommunityBody, type CreateOfficialCommunityBody, communityCategorySchema, communityCenterCoordsSchema, communityDesignationPresetSchema, communityDesignationSchema, communityDiscoverSortSchema, communityKindSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityReachSchema, communityRoleSchema, communityTagSchema, communityTypeSchema, communityVerifiedScopeSchema, communityWireSchema, createCommunityBodySchema, createOfficialCommunityBodySchema, type HidePostBody, hidePostBodySchema, type JoinCommunityResponse, joinCommunityResponseSchema, OFFICIAL_COMMUNITY_AREA_KIND_VALUES, type OfficialCommunityAreaKind, officialCommunityAreaKindSchema, type SetMemberDesignationBody, setMemberDesignationBodySchema, type SetOfficialRepresentativeBody, setOfficialRepresentativeBodySchema, type UpdateCommunityBody, type UpdateMemberRoleBody, updateCommunityBodySchema, updateMemberRoleBodySchema, type VerifyCommunityBody, verifyCommunityBodySchema, } from './community.js';
20
20
  export { COMMENT_MAX_BODY_CHARS, COMMENTS_PAGE_SIZE, COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS, COMMUNITY_DESIGNATION_CUSTOM_PATTERN, COMMUNITY_HYPERLOCAL_RADIUS_KM, COMMUNITY_MAX_TAGS, COMMUNITY_MEMBERS_PAGE_SIZE, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, EDIT_GRACE_WINDOW_MS, FEED_PAGE_SIZE, GROUP_MAX_MEMBERS, GROUP_NAME_MAX_CHARS, GROUP_NAME_MIN_CHARS, PEOPLE_PAGE_SIZE, POLL_DURATION_PRESETS_MS, POLL_MAX_DURATION_MS, POLL_MAX_OPTIONS, POLL_MIN_DURATION_MS, POLL_MIN_OPTIONS, POLL_OPTION_MAX_CHARS, POLL_OPTION_MIN_CHARS, POLL_QUESTION_MAX_CHARS, POLL_QUESTION_MIN_CHARS, POLLS_PAGE_SIZE, POST_MAX_BODY_CHARS, POST_MAX_IMAGE_BYTES, POST_MAX_IMAGES, POST_MAX_VIDEO_BYTES, POST_MAX_VIDEO_SECONDS, POST_MAX_VIDEOS, PROFILE_MAX_BIO_CHARS, REPLIES_PRELOAD_COUNT, } from './constants.js';
21
21
  export { type SetReactionBody, type SetReactionResponse, setReactionBodySchema, setReactionResponseSchema, type ToggleUpvoteResponse, toggleUpvoteResponseSchema, } from './engagement.js';
22
22
  export { CONTENT_KIND_VALUES, type ContentKind, contentKindSchema, FEED_SORT_VALUES, type FeedSort, feedSortSchema, PROFILE_PRIVACY_VALUES, type ProfilePrivacy, profilePrivacySchema, REACTION_TYPE_VALUES, REPORT_REASON_VALUES, REPORT_STATUS_VALUES, type ReactionType, type ReportReason, type ReportStatus, reactionTypeSchema, reportReasonSchema, reportStatusSchema, VISIBILITY_LEVEL_RANK, VISIBILITY_LEVEL_VALUES, type VisibilityLevel, visibilityLevelSchema, } from './enums.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAi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 export { areaLineageSnapshotSchema, } from './area.js';
19
19
  // ─── Comment ───────────────────────────────────────────────────────────────
20
20
  export { communityCommentWireSchema, createCommentBodySchema, updateCommentBodySchema, } from './comment.js';
21
21
  // ─── Communities ───────────────────────────────────────────────────────────
22
- export { AREA_PICKER_LEVEL_VALUES, areaPickerItemSchema, areaPickerLevelSchema, areaPickerQuerySchema, areaPickerResponseSchema, COMMUNITY_CATEGORY_VALUES, COMMUNITY_DESIGNATION_PRESETS, COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_REACH_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TAG_VALUES, COMMUNITY_TYPE_VALUES, COMMUNITY_VERIFIED_SCOPE_VALUES, communityCategorySchema, communityCenterCoordsSchema, communityDesignationPresetSchema, communityDesignationSchema, communityDiscoverSortSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityReachSchema, communityRoleSchema, communityTagSchema, communityTypeSchema, communityVerifiedScopeSchema, communityWireSchema, createCommunityBodySchema, joinCommunityResponseSchema, setMemberDesignationBodySchema, updateCommunityBodySchema, updateMemberRoleBodySchema, verifyCommunityBodySchema, } from './community.js';
22
+ export { addOfficialModeratorBodySchema, AREA_PICKER_LEVEL_VALUES, areaPickerItemSchema, areaPickerLevelSchema, areaPickerQuerySchema, areaPickerResponseSchema, COMMUNITY_CATEGORY_VALUES, COMMUNITY_DESIGNATION_PRESETS, COMMUNITY_DISCOVER_SORT_VALUES, COMMUNITY_KIND_VALUES, COMMUNITY_MEMBERSHIP_STATUS_VALUES, COMMUNITY_REACH_VALUES, COMMUNITY_ROLE_VALUES, COMMUNITY_TAG_VALUES, COMMUNITY_TYPE_VALUES, COMMUNITY_VERIFIED_SCOPE_VALUES, communityCategorySchema, communityCenterCoordsSchema, communityDesignationPresetSchema, communityDesignationSchema, communityDiscoverSortSchema, communityKindSchema, communityListQuerySchema, communityListResponseSchema, communityMembershipStatusSchema, communityMembersListResponseSchema, communityMemberWireSchema, communityReachSchema, communityRoleSchema, communityTagSchema, communityTypeSchema, communityVerifiedScopeSchema, communityWireSchema, createCommunityBodySchema, createOfficialCommunityBodySchema, hidePostBodySchema, joinCommunityResponseSchema, OFFICIAL_COMMUNITY_AREA_KIND_VALUES, officialCommunityAreaKindSchema, setMemberDesignationBodySchema, setOfficialRepresentativeBodySchema, updateCommunityBodySchema, updateMemberRoleBodySchema, verifyCommunityBodySchema, } from './community.js';
23
23
  // ─── Constants ─────────────────────────────────────────────────────────────
24
24
  export { COMMENT_MAX_BODY_CHARS, COMMENTS_PAGE_SIZE, COMMUNITIES_PAGE_SIZE, COMMUNITY_DESCRIPTION_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS, COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS, COMMUNITY_DESIGNATION_CUSTOM_PATTERN, COMMUNITY_HYPERLOCAL_RADIUS_KM, COMMUNITY_MAX_TAGS, COMMUNITY_MEMBERS_PAGE_SIZE, COMMUNITY_NAME_MAX_CHARS, COMMUNITY_NAME_MIN_CHARS, COMMUNITY_SLUG_MAX_CHARS, COMMUNITY_SLUG_MIN_CHARS, COMMUNITY_SLUG_PATTERN, EDIT_GRACE_WINDOW_MS, FEED_PAGE_SIZE, GROUP_MAX_MEMBERS, GROUP_NAME_MAX_CHARS, GROUP_NAME_MIN_CHARS, PEOPLE_PAGE_SIZE, POLL_DURATION_PRESETS_MS, POLL_MAX_DURATION_MS, POLL_MAX_OPTIONS, POLL_MIN_DURATION_MS, POLL_MIN_OPTIONS, POLL_OPTION_MAX_CHARS, POLL_OPTION_MIN_CHARS, POLL_QUESTION_MAX_CHARS, POLL_QUESTION_MIN_CHARS, POLLS_PAGE_SIZE, POST_MAX_BODY_CHARS, POST_MAX_IMAGE_BYTES, POST_MAX_IMAGES, POST_MAX_VIDEO_BYTES, POST_MAX_VIDEO_SECONDS, POST_MAX_VIDEOS, PROFILE_MAX_BIO_CHARS, REPLIES_PRELOAD_COUNT, } from './constants.js';
25
25
  // ─── Engagement (upvote + reactions) ───────────────────────────────────────
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8EAA8E;AAC9E,OAAO,EAEL,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAGL,0BAA0B,EAC1B,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,OAAO,EACL,wBAAwB,EAKxB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,+BAA+B,EAkB/B,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,EACnB,yBAAyB,EAEzB,2BAA2B,EAE3B,8BAA8B,EAG9B,yBAAyB,EACzB,0BAA0B,EAE1B,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,oCAAoC,EACpC,8BAA8B,EAC9B,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,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qB,EACrB,oBAAoB,EACpB,2BAA2B,EAE3B,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAGL,uBAAuB,EACvB,oBAAoB,EAEpB,wBAAwB,EAExB,oBAAoB,EAEpB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,8EAA8E;AAC9E,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EAOzB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,8EAA8E;AAC9E,OAAO,EAML,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,8EAA8E;AAC9E,OAAO,EAGL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,OAAO,EAGL,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAE3B,2BAA2B,EAE3B,iCAAiC,GAClC,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,OAAO,EAEL,0BAA0B,EAE1B,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,OAAO,EAEL,0BAA0B,EAG1B,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAI5B,wBAAwB,EACxB,4BAA4B,EAC5B,kCAAkC,EAClC,cAAc,EACd,+BAA+B,GAChC,MAAM,eAAe,CAAC","sourcesContent":["/**\n * community-schema — Shared Zod schemas + TypeScript types for the\n * Jansathi hyperlocal community feature (feed, posts, engagement,\n * social graph, groups, settings).\n *\n * Single source of truth consumed by reform-backend and every product\n * frontend. The schemas mirror MongoDB / Mongoose document shapes\n * 1:1 so the same Zod validation runs at the controller boundary on\n * the backend and in the form handlers on the client.\n *\n * Cascade-upward visibility semantics: a viewer whose feed level is L\n * sees posts at L and every BROADER level matching their area lineage.\n * See `./enums.ts#VISIBILITY_LEVEL_VALUES` for the level rank table.\n *\n * @module community-schema\n */\n\n// ─── Area lineage snapshot ─────────────────────────────────────────────────\nexport {\n type AreaLineageSnapshot,\n areaLineageSnapshotSchema,\n} from './area.js';\n\n// ─── Comment ───────────────────────────────────────────────────────────────\nexport {\n type CommunityCommentWire,\n type CreateCommentBody,\n communityCommentWireSchema,\n createCommentBodySchema,\n type UpdateCommentBody,\n updateCommentBodySchema,\n} from './comment.js';\n\n// ─── Communities ───────────────────────────────────────────────────────────\nexport {\n AREA_PICKER_LEVEL_VALUES,\n type AreaPickerItem,\n type AreaPickerLevel,\n type AreaPickerQuery,\n type AreaPickerResponse,\n areaPickerItemSchema,\n areaPickerLevelSchema,\n areaPickerQuerySchema,\n areaPickerResponseSchema,\n COMMUNITY_CATEGORY_VALUES,\n COMMUNITY_DESIGNATION_PRESETS,\n COMMUNITY_DISCOVER_SORT_VALUES,\n COMMUNITY_MEMBERSHIP_STATUS_VALUES,\n COMMUNITY_REACH_VALUES,\n COMMUNITY_ROLE_VALUES,\n COMMUNITY_TAG_VALUES,\n COMMUNITY_TYPE_VALUES,\n COMMUNITY_VERIFIED_SCOPE_VALUES,\n type CommunityCategory,\n type CommunityCenterCoords,\n type CommunityDesignation,\n type CommunityDesignationPreset,\n type CommunityDiscoverSort,\n type CommunityListQuery,\n type CommunityListResponse,\n type CommunityMembershipStatus,\n type CommunityMembersListResponse,\n type CommunityMemberWire,\n type CommunityReach,\n type CommunityRole,\n type CommunityTag,\n type CommunityType,\n type CommunityVerifiedScope,\n type CommunityWire,\n type CreateCommunityBody,\n communityCategorySchema,\n communityCenterCoordsSchema,\n communityDesignationPresetSchema,\n communityDesignationSchema,\n communityDiscoverSortSchema,\n communityListQuerySchema,\n communityListResponseSchema,\n communityMembershipStatusSchema,\n communityMembersListResponseSchema,\n communityMemberWireSchema,\n communityReachSchema,\n communityRoleSchema,\n communityTagSchema,\n communityTypeSchema,\n communityVerifiedScopeSchema,\n communityWireSchema,\n createCommunityBodySchema,\n type JoinCommunityResponse,\n joinCommunityResponseSchema,\n type SetMemberDesignationBody,\n setMemberDesignationBodySchema,\n type UpdateCommunityBody,\n type UpdateMemberRoleBody,\n updateCommunityBodySchema,\n updateMemberRoleBodySchema,\n type VerifyCommunityBody,\n verifyCommunityBodySchema,\n} from './community.js';\n\n// ─── Constants ─────────────────────────────────────────────────────────────\nexport {\n COMMENT_MAX_BODY_CHARS,\n COMMENTS_PAGE_SIZE,\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_PATTERN,\n COMMUNITY_HYPERLOCAL_RADIUS_KM,\n COMMUNITY_MAX_TAGS,\n COMMUNITY_MEMBERS_PAGE_SIZE,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n EDIT_GRACE_WINDOW_MS,\n FEED_PAGE_SIZE,\n GROUP_MAX_MEMBERS,\n GROUP_NAME_MAX_CHARS,\n GROUP_NAME_MIN_CHARS,\n PEOPLE_PAGE_SIZE,\n POLL_DURATION_PRESETS_MS,\n POLL_MAX_DURATION_MS,\n POLL_MAX_OPTIONS,\n POLL_MIN_DURATION_MS,\n POLL_MIN_OPTIONS,\n POLL_OPTION_MAX_CHARS,\n POLL_OPTION_MIN_CHARS,\n POLL_QUESTION_MAX_CHARS,\n POLL_QUESTION_MIN_CHARS,\n POLLS_PAGE_SIZE,\n POST_MAX_BODY_CHARS,\n POST_MAX_IMAGE_BYTES,\n POST_MAX_IMAGES,\n POST_MAX_VIDEO_BYTES,\n POST_MAX_VIDEO_SECONDS,\n POST_MAX_VIDEOS,\n PROFILE_MAX_BIO_CHARS,\n REPLIES_PRELOAD_COUNT,\n} from './constants.js';\n\n// ─── Engagement (upvote + reactions) ───────────────────────────────────────\nexport {\n type SetReactionBody,\n type SetReactionResponse,\n setReactionBodySchema,\n setReactionResponseSchema,\n type ToggleUpvoteResponse,\n toggleUpvoteResponseSchema,\n} from './engagement.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\nexport {\n CONTENT_KIND_VALUES,\n type ContentKind,\n contentKindSchema,\n FEED_SORT_VALUES,\n type FeedSort,\n feedSortSchema,\n PROFILE_PRIVACY_VALUES,\n type ProfilePrivacy,\n profilePrivacySchema,\n REACTION_TYPE_VALUES,\n REPORT_REASON_VALUES,\n REPORT_STATUS_VALUES,\n type ReactionType,\n type ReportReason,\n type ReportStatus,\n reactionTypeSchema,\n reportReasonSchema,\n reportStatusSchema,\n VISIBILITY_LEVEL_RANK,\n VISIBILITY_LEVEL_VALUES,\n type VisibilityLevel,\n visibilityLevelSchema,\n} from './enums.js';\n\n// ─── Feed (polymorphic union) ──────────────────────────────────────────────\nexport {\n type DonateItemFeedItem,\n donateItemFeedItemSchema,\n type FeedItem,\n type FeedQueryParams,\n type FeedResponse,\n feedItemSchema,\n feedQueryParamsSchema,\n feedResponseSchema,\n type LostFoundFeedItem,\n lostFoundFeedItemSchema,\n type VoiceBoxFeedItem,\n voiceBoxFeedItemSchema,\n} from './feed.js';\n// ─── Groups ────────────────────────────────────────────────────────────────\nexport {\n type AddGroupMembersBody,\n addGroupMembersBodySchema,\n type CommunityGroupWire,\n type CommunityGroupWithMembers,\n type CreateGroupBody,\n communityGroupWireSchema,\n communityGroupWithMembersSchema,\n createGroupBodySchema,\n type GroupMembersListResponse,\n type GroupMemberWire,\n type GroupRole,\n type GroupsListResponse,\n groupMembersListResponseSchema,\n groupMemberWireSchema,\n groupRoleSchema,\n groupsListResponseSchema,\n type UpdateGroupBody,\n updateGroupBodySchema,\n} from './group.js';\n// ─── Media ─────────────────────────────────────────────────────────────────\nexport {\n type PostImage,\n type PostVideo,\n postImageSchema,\n postVideoSchema,\n} from './media.js';\n// ─── Poll ──────────────────────────────────────────────────────────────────\nexport {\n type CastVoteBody,\n type CommunityPollFeedItem,\n type CommunityPollWire,\n type CreatePollBody,\n castVoteBodySchema,\n communityPollFeedItemSchema,\n communityPollWireSchema,\n createPollBodySchema,\n POLL_RESULTS_VISIBILITY_VALUES,\n type PollOptionInput,\n type PollOptionWire,\n type PollResultsVisibility,\n pollOptionInputSchema,\n pollOptionWireSchema,\n pollResultsVisibilitySchema,\n type VoteResponse,\n voteResponseSchema,\n} from './poll.js';\n\n// ─── Post ──────────────────────────────────────────────────────────────────\nexport {\n type CommunityPostWire,\n type CreatePostBody,\n communityPostWireSchema,\n createPostBodySchema,\n type PostAuthorSnapshot,\n postAuthorSnapshotSchema,\n type RepostedSource,\n repostedSourceSchema,\n type UpdatePostBody,\n updatePostBodySchema,\n} from './post.js';\n// ─── Profile + People list ─────────────────────────────────────────────────\nexport {\n PEOPLE_LIST_FILTER_DEFAULT,\n PEOPLE_LIST_FILTER_VALUES,\n type PeopleListFilter,\n type PeopleListItem,\n type PeopleListResponse,\n type PeopleQueryParams,\n type ProfileMutuals,\n type PublicProfileWire,\n peopleListFilterSchema,\n peopleListItemSchema,\n peopleListResponseSchema,\n peopleQueryParamsSchema,\n profileMutualsSchema,\n publicProfileWireSchema,\n} from './profile.js';\n// ─── Reports (moderation) ──────────────────────────────────────────────────\nexport {\n type ReportContentBody,\n type ReportContentKind,\n type ReportRecordWire,\n type ReportSubmissionResponse,\n type ReportUserBody,\n reportContentBodySchema,\n reportContentKindSchema,\n reportRecordWireSchema,\n reportSubmissionResponseSchema,\n reportUserBodySchema,\n} from './report.js';\n// ─── Repost (quote / amplify) ──────────────────────────────────────────────\nexport {\n type CreateRepostBody,\n type CreateRepostResponse,\n createRepostBodySchema,\n createRepostResponseSchema,\n} from './repost.js';\n\n// ─── Settings ──────────────────────────────────────────────────────────────\nexport {\n type BlockedUsersListResponse,\n type BlockedUserWire,\n blockedUsersListResponseSchema,\n blockedUserWireSchema,\n COMMUNITY_SETTINGS_DEFAULTS,\n type CommunitySettingsWire,\n communitySettingsWireSchema,\n type UpdateCommunitySettingsBody,\n updateCommunitySettingsBodySchema,\n} from './settings.js';\n\n// ─── Social (follow) ───────────────────────────────────────────────────────\nexport {\n type ToggleFollowResponse,\n toggleFollowResponseSchema,\n type ViewerSocialState,\n viewerSocialStateSchema,\n} from './social.js';\n\n// ─── Username (URL handle + change / availability) ────────────────────────\nexport {\n type CurrentUsernameState,\n currentUsernameStateSchema,\n type UpdateUsernameBody,\n type UpdateUsernameResponse,\n USERNAME_MAX_LENGTH,\n USERNAME_MIN_LENGTH,\n USERNAME_PATTERN,\n USERNAME_UNAVAILABLE_REASONS,\n type Username,\n type UsernameAvailabilityResponse,\n type UsernameUnavailableReason,\n updateUsernameBodySchema,\n updateUsernameResponseSchema,\n usernameAvailabilityResponseSchema,\n usernameSchema,\n usernameUnavailableReasonSchema,\n} from './username.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8EAA8E;AAC9E,OAAO,EAEL,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,OAAO,EAGL,0BAA0B,EAC1B,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,OAAO,EAEL,8BAA8B,EAC9B,wBAAwB,EAKxB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,kCAAkC,EAClC,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,+BAA+B,EAoB/B,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,E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8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAE3B,2BAA2B,EAE3B,iCAAiC,GAClC,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,OAAO,EAEL,0BAA0B,EAE1B,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,OAAO,EAEL,0BAA0B,EAG1B,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAI5B,wBAAwB,EACxB,4BAA4B,EAC5B,kCAAkC,EAClC,cAAc,EACd,+BAA+B,GAChC,MAAM,eAAe,CAAC","sourcesContent":["/**\n * community-schema — Shared Zod schemas + TypeScript types for the\n * Jansathi hyperlocal community feature (feed, posts, engagement,\n * social graph, groups, settings).\n *\n * Single source of truth consumed by reform-backend and every product\n * frontend. The schemas mirror MongoDB / Mongoose document shapes\n * 1:1 so the same Zod validation runs at the controller boundary on\n * the backend and in the form handlers on the client.\n *\n * Cascade-upward visibility semantics: a viewer whose feed level is L\n * sees posts at L and every BROADER level matching their area lineage.\n * See `./enums.ts#VISIBILITY_LEVEL_VALUES` for the level rank table.\n *\n * @module community-schema\n */\n\n// ─── Area lineage snapshot ─────────────────────────────────────────────────\nexport {\n type AreaLineageSnapshot,\n areaLineageSnapshotSchema,\n} from './area.js';\n\n// ─── Comment ───────────────────────────────────────────────────────────────\nexport {\n type CommunityCommentWire,\n type CreateCommentBody,\n communityCommentWireSchema,\n createCommentBodySchema,\n type UpdateCommentBody,\n updateCommentBodySchema,\n} from './comment.js';\n\n// ─── Communities ───────────────────────────────────────────────────────────\nexport {\n type AddOfficialModeratorBody,\n addOfficialModeratorBodySchema,\n AREA_PICKER_LEVEL_VALUES,\n type AreaPickerItem,\n type AreaPickerLevel,\n type AreaPickerQuery,\n type AreaPickerResponse,\n areaPickerItemSchema,\n areaPickerLevelSchema,\n areaPickerQuerySchema,\n areaPickerResponseSchema,\n COMMUNITY_CATEGORY_VALUES,\n COMMUNITY_DESIGNATION_PRESETS,\n COMMUNITY_DISCOVER_SORT_VALUES,\n COMMUNITY_KIND_VALUES,\n COMMUNITY_MEMBERSHIP_STATUS_VALUES,\n COMMUNITY_REACH_VALUES,\n COMMUNITY_ROLE_VALUES,\n COMMUNITY_TAG_VALUES,\n COMMUNITY_TYPE_VALUES,\n COMMUNITY_VERIFIED_SCOPE_VALUES,\n type CommunityCategory,\n type CommunityCenterCoords,\n type CommunityDesignation,\n type CommunityDesignationPreset,\n type CommunityDiscoverSort,\n type CommunityKind,\n type CommunityListQuery,\n type CommunityListResponse,\n type CommunityMembershipStatus,\n type CommunityMembersListResponse,\n type CommunityMemberWire,\n type CommunityReach,\n type CommunityRole,\n type CommunityTag,\n type CommunityType,\n type CommunityVerifiedScope,\n type CommunityWire,\n type CreateCommunityBody,\n type CreateOfficialCommunityBody,\n communityCategorySchema,\n communityCenterCoordsSchema,\n communityDesignationPresetSchema,\n communityDesignationSchema,\n communityDiscoverSortSchema,\n communityKindSchema,\n communityListQuerySchema,\n communityListResponseSchema,\n communityMembershipStatusSchema,\n communityMembersListResponseSchema,\n communityMemberWireSchema,\n communityReachSchema,\n communityRoleSchema,\n communityTagSchema,\n communityTypeSchema,\n communityVerifiedScopeSchema,\n communityWireSchema,\n createCommunityBodySchema,\n createOfficialCommunityBodySchema,\n type HidePostBody,\n hidePostBodySchema,\n type JoinCommunityResponse,\n joinCommunityResponseSchema,\n OFFICIAL_COMMUNITY_AREA_KIND_VALUES,\n type OfficialCommunityAreaKind,\n officialCommunityAreaKindSchema,\n type SetMemberDesignationBody,\n setMemberDesignationBodySchema,\n type SetOfficialRepresentativeBody,\n setOfficialRepresentativeBodySchema,\n type UpdateCommunityBody,\n type UpdateMemberRoleBody,\n updateCommunityBodySchema,\n updateMemberRoleBodySchema,\n type VerifyCommunityBody,\n verifyCommunityBodySchema,\n} from './community.js';\n\n// ─── Constants ─────────────────────────────────────────────────────────────\nexport {\n COMMENT_MAX_BODY_CHARS,\n COMMENTS_PAGE_SIZE,\n COMMUNITIES_PAGE_SIZE,\n COMMUNITY_DESCRIPTION_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MAX_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_MIN_CHARS,\n COMMUNITY_DESIGNATION_CUSTOM_PATTERN,\n COMMUNITY_HYPERLOCAL_RADIUS_KM,\n COMMUNITY_MAX_TAGS,\n COMMUNITY_MEMBERS_PAGE_SIZE,\n COMMUNITY_NAME_MAX_CHARS,\n COMMUNITY_NAME_MIN_CHARS,\n COMMUNITY_SLUG_MAX_CHARS,\n COMMUNITY_SLUG_MIN_CHARS,\n COMMUNITY_SLUG_PATTERN,\n EDIT_GRACE_WINDOW_MS,\n FEED_PAGE_SIZE,\n GROUP_MAX_MEMBERS,\n GROUP_NAME_MAX_CHARS,\n GROUP_NAME_MIN_CHARS,\n PEOPLE_PAGE_SIZE,\n POLL_DURATION_PRESETS_MS,\n POLL_MAX_DURATION_MS,\n POLL_MAX_OPTIONS,\n POLL_MIN_DURATION_MS,\n POLL_MIN_OPTIONS,\n POLL_OPTION_MAX_CHARS,\n POLL_OPTION_MIN_CHARS,\n POLL_QUESTION_MAX_CHARS,\n POLL_QUESTION_MIN_CHARS,\n POLLS_PAGE_SIZE,\n POST_MAX_BODY_CHARS,\n POST_MAX_IMAGE_BYTES,\n POST_MAX_IMAGES,\n POST_MAX_VIDEO_BYTES,\n POST_MAX_VIDEO_SECONDS,\n POST_MAX_VIDEOS,\n PROFILE_MAX_BIO_CHARS,\n REPLIES_PRELOAD_COUNT,\n} from './constants.js';\n\n// ─── Engagement (upvote + reactions) ───────────────────────────────────────\nexport {\n type SetReactionBody,\n type SetReactionResponse,\n setReactionBodySchema,\n setReactionResponseSchema,\n type ToggleUpvoteResponse,\n toggleUpvoteResponseSchema,\n} from './engagement.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\nexport {\n CONTENT_KIND_VALUES,\n type ContentKind,\n contentKindSchema,\n FEED_SORT_VALUES,\n type FeedSort,\n feedSortSchema,\n PROFILE_PRIVACY_VALUES,\n type ProfilePrivacy,\n profilePrivacySchema,\n REACTION_TYPE_VALUES,\n REPORT_REASON_VALUES,\n REPORT_STATUS_VALUES,\n type ReactionType,\n type ReportReason,\n type ReportStatus,\n reactionTypeSchema,\n reportReasonSchema,\n reportStatusSchema,\n VISIBILITY_LEVEL_RANK,\n VISIBILITY_LEVEL_VALUES,\n type VisibilityLevel,\n visibilityLevelSchema,\n} from './enums.js';\n\n// ─── Feed (polymorphic union) ──────────────────────────────────────────────\nexport {\n type DonateItemFeedItem,\n donateItemFeedItemSchema,\n type FeedItem,\n type FeedQueryParams,\n type FeedResponse,\n feedItemSchema,\n feedQueryParamsSchema,\n feedResponseSchema,\n type LostFoundFeedItem,\n lostFoundFeedItemSchema,\n type VoiceBoxFeedItem,\n voiceBoxFeedItemSchema,\n} from './feed.js';\n// ─── Groups ────────────────────────────────────────────────────────────────\nexport {\n type AddGroupMembersBody,\n addGroupMembersBodySchema,\n type CommunityGroupWire,\n type CommunityGroupWithMembers,\n type CreateGroupBody,\n communityGroupWireSchema,\n communityGroupWithMembersSchema,\n createGroupBodySchema,\n type GroupMembersListResponse,\n type GroupMemberWire,\n type GroupRole,\n type GroupsListResponse,\n groupMembersListResponseSchema,\n groupMemberWireSchema,\n groupRoleSchema,\n groupsListResponseSchema,\n type UpdateGroupBody,\n updateGroupBodySchema,\n} from './group.js';\n// ─── Media ─────────────────────────────────────────────────────────────────\nexport {\n type PostImage,\n type PostVideo,\n postImageSchema,\n postVideoSchema,\n} from './media.js';\n// ─── Poll ──────────────────────────────────────────────────────────────────\nexport {\n type CastVoteBody,\n type CommunityPollFeedItem,\n type CommunityPollWire,\n type CreatePollBody,\n castVoteBodySchema,\n communityPollFeedItemSchema,\n communityPollWireSchema,\n createPollBodySchema,\n POLL_RESULTS_VISIBILITY_VALUES,\n type PollOptionInput,\n type PollOptionWire,\n type PollResultsVisibility,\n pollOptionInputSchema,\n pollOptionWireSchema,\n pollResultsVisibilitySchema,\n type VoteResponse,\n voteResponseSchema,\n} from './poll.js';\n\n// ─── Post ──────────────────────────────────────────────────────────────────\nexport {\n type CommunityPostWire,\n type CreatePostBody,\n communityPostWireSchema,\n createPostBodySchema,\n type PostAuthorSnapshot,\n postAuthorSnapshotSchema,\n type RepostedSource,\n repostedSourceSchema,\n type UpdatePostBody,\n updatePostBodySchema,\n} from './post.js';\n// ─── Profile + People list ─────────────────────────────────────────────────\nexport {\n PEOPLE_LIST_FILTER_DEFAULT,\n PEOPLE_LIST_FILTER_VALUES,\n type PeopleListFilter,\n type PeopleListItem,\n type PeopleListResponse,\n type PeopleQueryParams,\n type ProfileMutuals,\n type PublicProfileWire,\n peopleListFilterSchema,\n peopleListItemSchema,\n peopleListResponseSchema,\n peopleQueryParamsSchema,\n profileMutualsSchema,\n publicProfileWireSchema,\n} from './profile.js';\n// ─── Reports (moderation) ──────────────────────────────────────────────────\nexport {\n type ReportContentBody,\n type ReportContentKind,\n type ReportRecordWire,\n type ReportSubmissionResponse,\n type ReportUserBody,\n reportContentBodySchema,\n reportContentKindSchema,\n reportRecordWireSchema,\n reportSubmissionResponseSchema,\n reportUserBodySchema,\n} from './report.js';\n// ─── Repost (quote / amplify) ──────────────────────────────────────────────\nexport {\n type CreateRepostBody,\n type CreateRepostResponse,\n createRepostBodySchema,\n createRepostResponseSchema,\n} from './repost.js';\n\n// ─── Settings ──────────────────────────────────────────────────────────────\nexport {\n type BlockedUsersListResponse,\n type BlockedUserWire,\n blockedUsersListResponseSchema,\n blockedUserWireSchema,\n COMMUNITY_SETTINGS_DEFAULTS,\n type CommunitySettingsWire,\n communitySettingsWireSchema,\n type UpdateCommunitySettingsBody,\n updateCommunitySettingsBodySchema,\n} from './settings.js';\n\n// ─── Social (follow) ───────────────────────────────────────────────────────\nexport {\n type ToggleFollowResponse,\n toggleFollowResponseSchema,\n type ViewerSocialState,\n viewerSocialStateSchema,\n} from './social.js';\n\n// ─── Username (URL handle + change / availability) ────────────────────────\nexport {\n type CurrentUsernameState,\n currentUsernameStateSchema,\n type UpdateUsernameBody,\n type UpdateUsernameResponse,\n USERNAME_MAX_LENGTH,\n USERNAME_MIN_LENGTH,\n USERNAME_PATTERN,\n USERNAME_UNAVAILABLE_REASONS,\n type Username,\n type UsernameAvailabilityResponse,\n type UsernameUnavailableReason,\n updateUsernameBodySchema,\n updateUsernameResponseSchema,\n usernameAvailabilityResponseSchema,\n usernameSchema,\n usernameUnavailableReasonSchema,\n} from './username.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,4DAK5B,CAAC;AACX,eAAO,MAAM,sBAAsB;;;;;EAAoC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1E,eAAO,MAAM,0BAA0B,EAAE,gBAA8B,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;iBAW/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;iBAwB/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;iBAalC,CAAC;AACH,MAAM,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,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/profile.js CHANGED
@@ -35,12 +35,7 @@ import { usernameSchema } from './username.js';
35
35
  * - `'suggested'` — friends-of-friends ranked by mutual-follower count,
36
36
  * excluding users the viewer already follows (PYMK).
37
37
  */
38
- export const PEOPLE_LIST_FILTER_VALUES = [
39
- 'followers',
40
- 'following',
41
- 'nearby',
42
- 'suggested',
43
- ];
38
+ export const PEOPLE_LIST_FILTER_VALUES = ['followers', 'following', 'nearby', 'suggested'];
44
39
  export const peopleListFilterSchema = z.enum(PEOPLE_LIST_FILTER_VALUES);
45
40
  export const PEOPLE_LIST_FILTER_DEFAULT = 'followers';
46
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,WAAW;IACX,WAAW;IACX,QAAQ;IACR,WAAW;CACH,CAAC;AACX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAqB,WAAW,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,C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E,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC","sourcesContent":["/**\n * Public community-profile wire shape.\n *\n * What every viewer can see about another user's community presence.\n * Differs from the auth/UDP `User` shape — this view is purposely thin\n * and content-engagement-oriented (post count, follower count, …).\n *\n * Privacy gating:\n * - `public` profile: the full shape is returned to any signed-in viewer.\n * - `private` profile: only `userId`, `displayName`, `avatarUrl`, and\n * the viewer's follow state are returned to non-followers. Posts and\n * counters are hidden until the viewer follows the profile owner and\n * the owner has accepted (TODO: follow-approval lifecycle — currently\n * \"private\" simply hides counters/posts from anyone who isn't the\n * owner).\n *\n * @module community-schema/profile\n */\n\nimport { z } from 'zod';\nimport { PROFILE_MAX_BIO_CHARS } from './constants.js';\nimport { profilePrivacySchema, visibilityLevelSchema } from './enums.js';\nimport { viewerSocialStateSchema } from './social.js';\nimport { usernameSchema } from './username.js';\n\n// ─── People list filter ─────────────────────────────────────────────────────\n\n/**\n * Filter axis for the People tab. Each value corresponds to a distinct\n * source of candidate users on the backend; the cascade-by-area behaviour\n * is now scoped to the `'nearby'` filter only.\n *\n * - `'followers'` — users following the viewer, newest-first by follow\n * time. The viewer's incoming social graph.\n * - `'following'` — users the viewer is following, newest-first.\n * - `'nearby'` — area-cascade (local → district → state → national →\n * global), capped at 100 results. The legacy single-lens behaviour.\n * - `'suggested'` — friends-of-friends ranked by mutual-follower count,\n * excluding users the viewer already follows (PYMK).\n */\nexport const PEOPLE_LIST_FILTER_VALUES = [\n 'followers',\n 'following',\n 'nearby',\n 'suggested',\n] as const;\nexport const peopleListFilterSchema = z.enum(PEOPLE_LIST_FILTER_VALUES);\nexport type PeopleListFilter = (typeof PEOPLE_LIST_FILTER_VALUES)[number];\nexport const PEOPLE_LIST_FILTER_DEFAULT: PeopleListFilter = 'followers';\n\n/**\n * Mini-row used in the \"Followed by X, Y + N more\" mutuals line on the\n * profile header. The server picks up to 3 sample names + a count of\n * the remaining mutuals so the row reads naturally without paginating\n * the full mutuals list inline.\n */\nexport const profileMutualsSchema = z.object({\n /** Avatar URLs (or single-letter fallbacks via `null`) for the sample\n * mutuals — order is \"show first\" → \"show last\". Capped at 3. */\n avatars: z.array(z.string().url().nullable()).max(3),\n /** Display names matched 1:1 with `avatars` order. Empty when the\n * viewer has no mutuals with the profile owner. */\n sampleNames: z.array(z.string()).max(3),\n /** How many additional mutuals exist beyond the sample. Used to\n * render the trailing \"+ N more\" suffix. Zero when the sample IS\n * the full list. */\n extraCount: z.number().int().nonnegative(),\n});\nexport type ProfileMutuals = z.infer<typeof profileMutualsSchema>;\n\nexport const publicProfileWireSchema = z.object({\n userId: z.string(),\n /** Public URL handle. The profile page lives at `/<username>`; this\n * is the canonical identity surfaced to the viewer. Always present\n * — every user is auto-minted a username at provisioning time and\n * can change it from community Settings (14-day cooldown). */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n\n /** Author area at view time (resolved server-side). Hidden when\n * privacy is `private` and the viewer is not the owner. */\n localName: z.string().optional(),\n\n /** Privacy of THIS profile (not the viewer's). Useful for the UI\n * to render a lock chip when the profile is private. */\n privacy: profilePrivacySchema,\n\n /** Short bio — present only when set by the user. */\n bio: z.string().max(PROFILE_MAX_BIO_CHARS).optional(),\n\n /** Engagement counters. Hidden on private profiles when the viewer is\n * not the owner. Three-tuple post-redesign: connections went away\n * when the connection-request feature was removed in v0.9.0. */\n counters: z\n .object({\n postCount: z.number().int().nonnegative(),\n followerCount: z.number().int().nonnegative(),\n followingCount: z.number().int().nonnegative(),\n })\n .optional(),\n\n /** Mutual followees between the viewer and the profile owner. Renders\n * the \"Followed by X, Y + N more\" line. Omitted for self-view (no\n * point telling you about yourself) and when the viewer has no\n * mutuals with the owner. */\n mutuals: profileMutualsSchema.optional(),\n\n /** Per-viewer relationship state. Always present (never gated). */\n viewer: viewerSocialStateSchema,\n\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader (UDP step-1 `verifiedFields`). Surfaces the\n * green check badge next to the display name on the profile\n * header. Optional so backends not yet populating the field\n * serialize a valid wire shape — readers treat undefined as\n * unverified. Live-joined at read time, NOT a snapshot. */\n identityVerified: z.boolean().optional(),\n});\nexport type PublicProfileWire = z.infer<typeof publicProfileWireSchema>;\n\n// ─── People list ────────────────────────────────────────────────────────────\n\n/**\n * Lightweight row used in the People tab list. Fewer fields than the\n * full profile to keep the list response small.\n */\nexport const peopleListItemSchema = z.object({\n userId: z.string(),\n /** Public URL handle (see `publicProfileWireSchema.username`). Always\n * present — the row's display + tap-to-profile link both depend on it. */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n localName: z.string().optional(),\n privacy: profilePrivacySchema,\n viewer: viewerSocialStateSchema,\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader. Drives the green check badge next to the\n * display name in the row. Optional for forward-compat with\n * un-migrated backends. */\n identityVerified: z.boolean().optional(),\n /** Mutual followers between the viewer and this row's user. Populated\n * on every People-list filter so the row can render the FB-style\n * \"Followed by A, B + N more\" line. Omitted when there are no\n * mutuals to avoid wasting bytes on the common cold-start case. */\n mutuals: profileMutualsSchema.optional(),\n /** Total number of mutual followers (NOT just the sampled three).\n * Drives the \"X mutuals\" count badge + sort key for the `suggested`\n * filter. Defaults to 0 when omitted. */\n mutualCount: z.number().int().nonnegative().optional(),\n});\nexport type PeopleListItem = z.infer<typeof peopleListItemSchema>;\n\nexport const peopleQueryParamsSchema = z.object({\n /** Filter axis (followers / following / nearby / suggested). The\n * backend defaults to `PEOPLE_LIST_FILTER_DEFAULT` when omitted so\n * every cold landing has the same source-of-truth. */\n filter: peopleListFilterSchema.optional(),\n /** Free-text search across `displayName`. */\n q: z.string().optional(),\n /** Legacy area-scope filter. Retained for backward compat — when set\n * with no `filter`, the server treats it as `filter: 'nearby'` plus\n * the level override. Newer clients should pass `filter` directly. */\n level: visibilityLevelSchema.optional(),\n cursor: z.string().optional(),\n pageSize: z.number().int().positive().max(50).optional(),\n});\nexport type PeopleQueryParams = z.infer<typeof peopleQueryParamsSchema>;\n\nexport const peopleListResponseSchema = z.object({\n items: z.array(peopleListItemSchema),\n nextCursor: z.string().nullable(),\n});\nexport type PeopleListResponse = z.infer<typeof peopleListResponseSchema>;\n"]}
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AACpG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAqB,WAAW,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C;sEACkE;IAClE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,Q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C,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC","sourcesContent":["/**\n * Public community-profile wire shape.\n *\n * What every viewer can see about another user's community presence.\n * Differs from the auth/UDP `User` shape — this view is purposely thin\n * and content-engagement-oriented (post count, follower count, …).\n *\n * Privacy gating:\n * - `public` profile: the full shape is returned to any signed-in viewer.\n * - `private` profile: only `userId`, `displayName`, `avatarUrl`, and\n * the viewer's follow state are returned to non-followers. Posts and\n * counters are hidden until the viewer follows the profile owner and\n * the owner has accepted (TODO: follow-approval lifecycle — currently\n * \"private\" simply hides counters/posts from anyone who isn't the\n * owner).\n *\n * @module community-schema/profile\n */\n\nimport { z } from 'zod';\nimport { PROFILE_MAX_BIO_CHARS } from './constants.js';\nimport { profilePrivacySchema, visibilityLevelSchema } from './enums.js';\nimport { viewerSocialStateSchema } from './social.js';\nimport { usernameSchema } from './username.js';\n\n// ─── People list filter ─────────────────────────────────────────────────────\n\n/**\n * Filter axis for the People tab. Each value corresponds to a distinct\n * source of candidate users on the backend; the cascade-by-area behaviour\n * is now scoped to the `'nearby'` filter only.\n *\n * - `'followers'` — users following the viewer, newest-first by follow\n * time. The viewer's incoming social graph.\n * - `'following'` — users the viewer is following, newest-first.\n * - `'nearby'` — area-cascade (local → district → state → national →\n * global), capped at 100 results. The legacy single-lens behaviour.\n * - `'suggested'` — friends-of-friends ranked by mutual-follower count,\n * excluding users the viewer already follows (PYMK).\n */\nexport const PEOPLE_LIST_FILTER_VALUES = ['followers', 'following', 'nearby', 'suggested'] as const;\nexport const peopleListFilterSchema = z.enum(PEOPLE_LIST_FILTER_VALUES);\nexport type PeopleListFilter = (typeof PEOPLE_LIST_FILTER_VALUES)[number];\nexport const PEOPLE_LIST_FILTER_DEFAULT: PeopleListFilter = 'followers';\n\n/**\n * Mini-row used in the \"Followed by X, Y + N more\" mutuals line on the\n * profile header. The server picks up to 3 sample names + a count of\n * the remaining mutuals so the row reads naturally without paginating\n * the full mutuals list inline.\n */\nexport const profileMutualsSchema = z.object({\n /** Avatar URLs (or single-letter fallbacks via `null`) for the sample\n * mutuals — order is \"show first\" → \"show last\". Capped at 3. */\n avatars: z.array(z.string().url().nullable()).max(3),\n /** Display names matched 1:1 with `avatars` order. Empty when the\n * viewer has no mutuals with the profile owner. */\n sampleNames: z.array(z.string()).max(3),\n /** How many additional mutuals exist beyond the sample. Used to\n * render the trailing \"+ N more\" suffix. Zero when the sample IS\n * the full list. */\n extraCount: z.number().int().nonnegative(),\n});\nexport type ProfileMutuals = z.infer<typeof profileMutualsSchema>;\n\nexport const publicProfileWireSchema = z.object({\n userId: z.string(),\n /** Public URL handle. The profile page lives at `/<username>`; this\n * is the canonical identity surfaced to the viewer. Always present\n * — every user is auto-minted a username at provisioning time and\n * can change it from community Settings (14-day cooldown). */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n\n /** Author area at view time (resolved server-side). Hidden when\n * privacy is `private` and the viewer is not the owner. */\n localName: z.string().optional(),\n\n /** Privacy of THIS profile (not the viewer's). Useful for the UI\n * to render a lock chip when the profile is private. */\n privacy: profilePrivacySchema,\n\n /** Short bio — present only when set by the user. */\n bio: z.string().max(PROFILE_MAX_BIO_CHARS).optional(),\n\n /** Engagement counters. Hidden on private profiles when the viewer is\n * not the owner. Three-tuple post-redesign: connections went away\n * when the connection-request feature was removed in v0.9.0. */\n counters: z\n .object({\n postCount: z.number().int().nonnegative(),\n followerCount: z.number().int().nonnegative(),\n followingCount: z.number().int().nonnegative(),\n })\n .optional(),\n\n /** Mutual followees between the viewer and the profile owner. Renders\n * the \"Followed by X, Y + N more\" line. Omitted for self-view (no\n * point telling you about yourself) and when the viewer has no\n * mutuals with the owner. */\n mutuals: profileMutualsSchema.optional(),\n\n /** Per-viewer relationship state. Always present (never gated). */\n viewer: viewerSocialStateSchema,\n\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader (UDP step-1 `verifiedFields`). Surfaces the\n * green check badge next to the display name on the profile\n * header. Optional so backends not yet populating the field\n * serialize a valid wire shape — readers treat undefined as\n * unverified. Live-joined at read time, NOT a snapshot. */\n identityVerified: z.boolean().optional(),\n});\nexport type PublicProfileWire = z.infer<typeof publicProfileWireSchema>;\n\n// ─── People list ────────────────────────────────────────────────────────────\n\n/**\n * Lightweight row used in the People tab list. Fewer fields than the\n * full profile to keep the list response small.\n */\nexport const peopleListItemSchema = z.object({\n userId: z.string(),\n /** Public URL handle (see `publicProfileWireSchema.username`). Always\n * present — the row's display + tap-to-profile link both depend on it. */\n username: usernameSchema,\n displayName: z.string(),\n avatarUrl: z.string().url().optional(),\n localName: z.string().optional(),\n privacy: profilePrivacySchema,\n viewer: viewerSocialStateSchema,\n /** True when this user has been identity-verified by a Jansathi\n * volunteer / leader. Drives the green check badge next to the\n * display name in the row. Optional for forward-compat with\n * un-migrated backends. */\n identityVerified: z.boolean().optional(),\n /** Mutual followers between the viewer and this row's user. Populated\n * on every People-list filter so the row can render the FB-style\n * \"Followed by A, B + N more\" line. Omitted when there are no\n * mutuals to avoid wasting bytes on the common cold-start case. */\n mutuals: profileMutualsSchema.optional(),\n /** Total number of mutual followers (NOT just the sampled three).\n * Drives the \"X mutuals\" count badge + sort key for the `suggested`\n * filter. Defaults to 0 when omitted. */\n mutualCount: z.number().int().nonnegative().optional(),\n});\nexport type PeopleListItem = z.infer<typeof peopleListItemSchema>;\n\nexport const peopleQueryParamsSchema = z.object({\n /** Filter axis (followers / following / nearby / suggested). The\n * backend defaults to `PEOPLE_LIST_FILTER_DEFAULT` when omitted so\n * every cold landing has the same source-of-truth. */\n filter: peopleListFilterSchema.optional(),\n /** Free-text search across `displayName`. */\n q: z.string().optional(),\n /** Legacy area-scope filter. Retained for backward compat — when set\n * with no `filter`, the server treats it as `filter: 'nearby'` plus\n * the level override. Newer clients should pass `filter` directly. */\n level: visibilityLevelSchema.optional(),\n cursor: z.string().optional(),\n pageSize: z.number().int().positive().max(50).optional(),\n});\nexport type PeopleQueryParams = z.infer<typeof peopleQueryParamsSchema>;\n\nexport const peopleListResponseSchema = z.object({\n items: z.array(peopleListItemSchema),\n nextCursor: z.string().nullable(),\n});\nexport type PeopleListResponse = z.infer<typeof peopleListResponseSchema>;\n"]}
package/dist/report.d.ts CHANGED
@@ -103,8 +103,8 @@ export declare const reportRecordWireSchema: z.ZodObject<{
103
103
  voice_box: "voice_box";
104
104
  donate_item: "donate_item";
105
105
  poll: "poll";
106
- comment: "comment";
107
106
  user: "user";
107
+ comment: "comment";
108
108
  }>;
109
109
  contentId: z.ZodString;
110
110
  targetUserId: z.ZodOptional<z.ZodString>;
@@ -145,8 +145,8 @@ export declare const reportSubmissionResponseSchema: z.ZodObject<{
145
145
  voice_box: "voice_box";
146
146
  donate_item: "donate_item";
147
147
  poll: "poll";
148
- comment: "comment";
149
148
  user: "user";
149
+ comment: "comment";
150
150
  }>;
151
151
  contentId: z.ZodString;
152
152
  targetUserId: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jansathi-community-schema",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared Zod schemas + TypeScript types for the Jansathi hyperlocal community feature (feed, posts, engagement, social graph, groups, communities).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",