jansathi-community-schema 0.29.1 → 0.30.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.
@@ -159,16 +159,16 @@ export type CrowdfundingFeeBillingMode = z.infer<typeof crowdfundingFeeBillingMo
159
159
  * at `'pending'` on draft create, flips to `'paid'` after Razorpay
160
160
  * verify, and stays `'paid'` for the campaign lifetime.
161
161
  *
162
- * `'failed'` is reserved for the rare case where activation crosses
163
- * with a Razorpay refund surfaced so the My Campaigns surface can
164
- * prompt the creator to retry payment without breaking the draft.
162
+ * No `'failed'` state today if Razorpay fails or the user dismisses
163
+ * the modal, the row stays `'pending'` and the next retry transitions
164
+ * via the same flow. A failure state can be added when (and if) the
165
+ * My Campaigns surface needs a distinct "retry needed" badge.
165
166
  */
166
- export declare const CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES: readonly ["pending", "paid", "deferred", "failed"];
167
+ export declare const CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES: readonly ["pending", "paid", "deferred"];
167
168
  export declare const crowdfundingFeePaymentStatusSchema: z.ZodEnum<{
168
169
  pending: "pending";
169
170
  deferred: "deferred";
170
171
  paid: "paid";
171
- failed: "failed";
172
172
  }>;
173
173
  export type CrowdfundingFeePaymentStatus = z.infer<typeof crowdfundingFeePaymentStatusSchema>;
174
174
  /**
@@ -350,7 +350,6 @@ export declare const crowdfundingFeedItemSchema: z.ZodObject<{
350
350
  pending: "pending";
351
351
  deferred: "deferred";
352
352
  paid: "paid";
353
- failed: "failed";
354
353
  }>>;
355
354
  platformFeeAmountInr: z.ZodOptional<z.ZodNumber>;
356
355
  score: z.ZodNumber;
@@ -520,7 +519,6 @@ export declare const communityCrowdfundingWireSchema: z.ZodObject<{
520
519
  pending: "pending";
521
520
  deferred: "deferred";
522
521
  paid: "paid";
523
- failed: "failed";
524
522
  }>>;
525
523
  platformFeeAmountInr: z.ZodOptional<z.ZodNumber>;
526
524
  score: z.ZodNumber;
@@ -1 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AACH,eAAO,MAAM,6BAA6B;;;;;;;;iBAExC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;iBAMvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAIlF;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC;;;;iBAM/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;;iBAE9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAIhG,eAAO,MAAM,oCAAoC;;;;;;;;iBAI/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;iBAIjD,CAAC;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC"}
@@ -156,15 +156,15 @@ export const crowdfundingFeeBillingModeSchema = z.enum(CROWDFUNDING_FEE_BILLING_
156
156
  * at `'pending'` on draft create, flips to `'paid'` after Razorpay
157
157
  * verify, and stays `'paid'` for the campaign lifetime.
158
158
  *
159
- * `'failed'` is reserved for the rare case where activation crosses
160
- * with a Razorpay refund surfaced so the My Campaigns surface can
161
- * prompt the creator to retry payment without breaking the draft.
159
+ * No `'failed'` state today if Razorpay fails or the user dismisses
160
+ * the modal, the row stays `'pending'` and the next retry transitions
161
+ * via the same flow. A failure state can be added when (and if) the
162
+ * My Campaigns surface needs a distinct "retry needed" badge.
162
163
  */
163
164
  export const CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES = [
164
165
  'pending',
165
166
  'paid',
166
167
  'deferred',
167
- 'failed',
168
168
  ];
169
169
  export const crowdfundingFeePaymentStatusSchema = z.enum(CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES);
170
170
  // ─── Sub-shapes ────────────────────────────────────────────────────────────
@@ -291,8 +291,8 @@ export const crowdfundingFeedItemSchema = z.object({
291
291
  /**
292
292
  * Server-tracked state of the upfront-billing payment. Always
293
293
  * `'deferred'` when `feeBillingMode === 'deferred'`. For upfront
294
- * campaigns: `'pending'` while the Razorpay flow is open, `'paid'`
295
- * after verify, `'failed'` if activation fails after capture.
294
+ * campaigns: `'pending'` while the Razorpay flow is open or
295
+ * incomplete, `'paid'` after verify.
296
296
  */
297
297
  feePaymentStatus: crowdfundingFeePaymentStatusSchema.optional(),
298
298
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"crowdfunding.js","sourceRoot":"","sources":["../src/crowdfunding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,uCAAuC,EACvC,2CAA2C,EAC3C,kCAAkC,EAClC,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,yBAAyB,EACzB,uCAAuC,EACvC,uCAAuC,EACvC,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,SAAS;IACT,WAAW;IACX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CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CAC7B,CAAC,CAAC;AAGH,8EAA8E;AAE9E,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC","sourcesContent":["/**\n * Community crowdfunding wire shapes.\n *\n * A crowdfunding campaign is a verified civic fundraiser surfaced in\n * the feed alongside posts / polls / lost-found / voice-box / donate-\n * item. The model is:\n *\n * 1. Creator drafts a campaign, fills bank + UPI QR + identity tier\n * based on the goal amount, picks an area scope.\n * 2. A leader at the matching scope (or any leader higher up the\n * hierarchy) reviews and approves OR rejects with reason.\n * Approved campaigns transition to ACTIVE and appear in the feed.\n * 3. Donors view the card, tap \"Donate\", pay externally via UPI\n * directly to the creator's bank — the platform never sees the\n * money. After paying, the donor self-attests amount + uploads a\n * receipt screenshot (optional). Without a screenshot the\n * donation enters PENDING state — the donor can upload the\n * receipt later (anytime, from settings → My Donations).\n * 4. The live progress bar shows ONLY verified amount (receipt\n * uploaded). Pending donations are counted separately and\n * surfaced as a secondary \"₹X pending receipt\" note. This is the\n * product decision: the visible progress reflects trust-grounded\n * money, not claims.\n *\n * Privacy: bank account number, IFSC, PAN, Aadhaar last-4, and\n * supporting documents are NEVER on the wire. Only `bankAccountLast4`,\n * `bankAccountHolderName`, and a UPI QR URL surface to donors.\n *\n * @module community-schema/crowdfunding\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport {\n CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS,\n CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS,\n CROWDFUNDING_DESCRIPTION_MAX_CHARS,\n CROWDFUNDING_DESCRIPTION_MIN_CHARS,\n CROWDFUNDING_MAX_DONATION_INR,\n CROWDFUNDING_MAX_DURATION_DAYS,\n CROWDFUNDING_MAX_GOAL_INR,\n CROWDFUNDING_MAX_IMAGES,\n CROWDFUNDING_MAX_SUPPORTING_DOCS,\n CROWDFUNDING_MIN_DURATION_DAYS,\n CROWDFUNDING_MIN_GOAL_INR,\n CROWDFUNDING_REJECTION_REASON_MAX_CHARS,\n CROWDFUNDING_REJECTION_REASON_MIN_CHARS,\n CROWDFUNDING_TITLE_MAX_CHARS,\n CROWDFUNDING_TITLE_MIN_CHARS,\n} from './constants.js';\nimport { voteValueSchema } from './engagement.js';\nimport { postAuthorSnapshotSchema } from './post.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\n\n/**\n * Top-level categories — drives the chip + icon on the card and the\n * verifier's per-category supporting-doc requirements (medical needs\n * hospital invoice; education needs admission letter; etc.).\n */\nexport const CROWDFUNDING_CATEGORY_VALUES = [\n 'medical',\n 'maternity',\n 'senior_care',\n 'special_needs',\n 'education',\n 'memorial',\n 'disaster',\n 'civic',\n 'faith',\n 'sports_talent',\n 'animal_welfare',\n 'environment',\n 'legal_aid',\n 'arts_culture',\n 'self_improvement',\n /**\n * Startup / prototype building — distinct from `self_improvement`\n * (which is now strictly skill / coursework). Covers MVP builds,\n * tooling, initial inventory, working capital, registration fees,\n * marketing for genuine first-stage entrepreneurs.\n */\n 'startup_prototype',\n 'other',\n] as const;\n\n/**\n * Who the campaign is for — drives the relation chip set and the\n * organization-specific identity asks on the composer. Captured so the\n * verifier can match the campaign narrative to the supporting docs\n * (e.g. an `organization` audience should produce 12A / 80G papers,\n * not a personal hospital bill).\n */\nexport const CROWDFUNDING_AUDIENCE_VALUES = [\n 'self',\n 'family',\n 'friend',\n 'community',\n 'organization',\n] as const;\nexport const crowdfundingAudienceSchema = z.enum(CROWDFUNDING_AUDIENCE_VALUES);\nexport type CrowdfundingAudience = z.infer<typeof crowdfundingAudienceSchema>;\n\n/**\n * Org-registration class — only meaningful when `audience ===\n * 'organization'`. Drives the verifier's expected document set\n * (12A/80G for trust, FCRA-style papers for NGO, etc.).\n */\nexport const CROWDFUNDING_ORG_KIND_VALUES = [\n 'ngo',\n 'trust',\n 'society',\n 'section_8',\n 'other',\n] as const;\nexport const crowdfundingOrgKindSchema = z.enum(CROWDFUNDING_ORG_KIND_VALUES);\nexport type CrowdfundingOrgKind = z.infer<typeof crowdfundingOrgKindSchema>;\nexport const crowdfundingCategorySchema = z.enum(CROWDFUNDING_CATEGORY_VALUES);\nexport type CrowdfundingCategory = z.infer<typeof crowdfundingCategorySchema>;\n\n/**\n * Area scope — drives the required verifier role. A higher-tier\n * leader can always verify a lower-tier campaign (escalation path);\n * the reverse is rejected.\n */\nexport const CROWDFUNDING_SCOPE_VALUES = [\n 'local',\n 'district',\n 'state',\n 'national',\n 'global',\n] as const;\nexport const crowdfundingScopeSchema = z.enum(CROWDFUNDING_SCOPE_VALUES);\nexport type CrowdfundingScope = z.infer<typeof crowdfundingScopeSchema>;\n\n/**\n * Lifecycle state. `submitted` is the verifier's queue; `active` is\n * publishable in the feed; the three `closed_*` are terminal end-states\n * with different reasons.\n */\nexport const CROWDFUNDING_STATUS_VALUES = [\n 'draft',\n 'submitted',\n 'rejected',\n 'active',\n 'closed_success',\n 'closed_timeout',\n 'closed_by_creator',\n] as const;\nexport const crowdfundingStatusSchema = z.enum(CROWDFUNDING_STATUS_VALUES);\nexport type CrowdfundingStatus = z.infer<typeof crowdfundingStatusSchema>;\n\n/**\n * Per-donation verification state. `pending` = attested but no\n * receipt. `verified` = receipt uploaded (creator confirmation\n * optional). `disputed` = creator marked \"I didn't receive this\".\n * Only `verified` rolls into the campaign's `verifiedAmountInr`\n * which drives the visible progress bar.\n */\nexport const CROWDFUNDING_DONATION_STATE_VALUES = ['pending', 'verified', 'disputed'] as const;\nexport const crowdfundingDonationStateSchema = z.enum(CROWDFUNDING_DONATION_STATE_VALUES);\nexport type CrowdfundingDonationState = z.infer<typeof crowdfundingDonationStateSchema>;\n\n/**\n * When the platform fee is settled:\n * - `'upfront'` — Creator pays a FLAT scope-tiered fee via Razorpay\n * BEFORE the campaign goes to leader review (₹500 local / ₹1,000\n * district / ₹2,000 state / ₹5,000 national / ₹10,000 global —\n * see `CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE`). Approved\n * campaigns then disburse 100 % of donations to the creator.\n * - `'deferred'` — Nothing paid upfront. At disbursement time the\n * platform deducts 5 % of COLLECTED donations (see\n * `CROWDFUNDING_DEFERRED_FEE_RATE`) before transferring the rest\n * to the creator. The creator accepts an \"I promise to pay\"\n * attestation on the Pricing step to take this path.\n *\n * The choice is captured at submit time on the composer's Pricing\n * step and surfaced on the wire so the My Campaigns surface can show\n * \"Paid ₹X\" / \"Will deduct at payout\" badges per campaign.\n */\nexport const CROWDFUNDING_FEE_BILLING_MODE_VALUES = ['upfront', 'deferred'] as const;\nexport const crowdfundingFeeBillingModeSchema = z.enum(CROWDFUNDING_FEE_BILLING_MODE_VALUES);\nexport type CrowdfundingFeeBillingMode = z.infer<typeof crowdfundingFeeBillingModeSchema>;\n\n/**\n * Server-tracked state of the upfront-billing payment. Always\n * `'deferred'` when the creator picked the on-collection mode (there\n * is nothing to pay until disbursement). For upfront mode it starts\n * at `'pending'` on draft create, flips to `'paid'` after Razorpay\n * verify, and stays `'paid'` for the campaign lifetime.\n *\n * `'failed'` is reserved for the rare case where activation crosses\n * with a Razorpay refund — surfaced so the My Campaigns surface can\n * prompt the creator to retry payment without breaking the draft.\n */\nexport const CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES = [\n 'pending',\n 'paid',\n 'deferred',\n 'failed',\n] as const;\nexport const crowdfundingFeePaymentStatusSchema = z.enum(CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES);\nexport type CrowdfundingFeePaymentStatus = z.infer<typeof crowdfundingFeePaymentStatusSchema>;\n\n// ─── Sub-shapes ────────────────────────────────────────────────────────────\n\n/**\n * Per-campaign verification block. `approved` is the only state that\n * lets the campaign go ACTIVE; `pending` keeps it queued; `rejected`\n * is terminal-with-resubmit-allowed.\n */\nexport const crowdfundingVerificationSchema = z.object({\n status: z.enum(['pending', 'approved', 'rejected']),\n /** The leader who acted on this submission (display name —\n * live-joined from User at projection time). */\n verifiedByDisplayName: z.string().optional(),\n verifiedByUserId: z.string().optional(),\n /** When the leader acted. Approved + rejected both stamp this. */\n verifiedAt: z.string().datetime().optional(),\n /** The scope the verifier claimed when acting. A district leader\n * acting on a local campaign records `district` here so the\n * audit log shows the escalation path. */\n verifierScope: crowdfundingScopeSchema.optional(),\n /** Required when `status === 'rejected'`. Why the leader said no. */\n rejectionReason: z.string().optional(),\n});\nexport type CrowdfundingVerification = z.infer<typeof crowdfundingVerificationSchema>;\n\n/**\n * Public-facing payment surface — what the donor sees in the Donate\n * dialog. The full account number, IFSC, PAN, Aadhaar, supporting\n * docs etc. are kept server-side; only what's needed for the donor\n * to send money + recognise the recipient is exposed.\n */\nexport const crowdfundingPaymentSchema = z.object({\n /** GCS URL of the UPI QR code image uploaded by the creator. The\n * Donate dialog renders this for the donor to scan. */\n upiQrUrl: z.string().url(),\n /** Optional VPA — lets the donor tap a one-tap UPI deep link\n * instead of scanning the QR. e.g. \"ravi@okhdfcbank\". */\n upiId: z.string().optional(),\n /** Last 4 digits of the bank account — shown to the donor as\n * reassurance (\"ending in ••1234\"). Full number never surfaces. */\n bankAccountLast4: z.string().length(4),\n /** Account holder's name — must match the verified author display\n * name (penny-drop + UDP cross-check at submission time). */\n bankAccountHolderName: z.string(),\n /** Optional bank short name surfaced on the dialog. */\n bankName: z.string().optional(),\n});\nexport type CrowdfundingPayment = z.infer<typeof crowdfundingPaymentSchema>;\n\n// ─── Wire shape — feed item ────────────────────────────────────────────────\n\n/**\n * The card-renderable wire shape. Mirrors the engagement + author +\n * area-lineage shape of other feed kinds so the existing\n * EngagementBar, AuthorByline, and feed-projection helpers slot in\n * 1:1 without per-kind branches.\n */\nexport const crowdfundingFeedItemSchema = z.object({\n _id: z.string(),\n contentKind: z.literal('crowdfunding'),\n author: postAuthorSnapshotSchema,\n\n // ─── Campaign content ────────────────────────────────────────────\n title: z.string(),\n description: z.string(),\n category: crowdfundingCategorySchema,\n beneficiaryName: z.string(),\n beneficiaryRelation: z.string().optional(),\n /** Who the campaign is for. Optional on the wire so historic\n * campaigns created before this field landed still validate. */\n audience: crowdfundingAudienceSchema.optional(),\n /** Optional explainer when `category === 'other'` — the writer's\n * short label for the custom cause (e.g. \"Wedding emergency\"). */\n categoryOther: z.string().optional(),\n /** Up to 3 sub-causes within the chosen category, e.g.\n * [\"Cancer treatment\", \"ICU / critical care\"] for `medical`. */\n subCauses: z.array(z.string()).max(3).optional(),\n /** When one of the picked sub-causes is \"Other\", this carries the\n * writer's clarification (e.g. \"Reconstructive surgery\"). */\n subCauseOther: z.string().optional(),\n /** Org-registration class. Only meaningful when\n * `audience === 'organization'`. */\n organizationKind: crowdfundingOrgKindSchema.optional(),\n /** When `organizationKind === 'other'`, the writer's clarification\n * (e.g. \"Religious body\", \"Cooperative\"). */\n organizationKindOther: z.string().optional(),\n /** Story images (separate from supporting documents, which are\n * verifier-only). Up to `CROWDFUNDING_MAX_IMAGES`. */\n images: z.array(z.string().url()).max(CROWDFUNDING_MAX_IMAGES).optional(),\n /** Optional YouTube URL surfaced as a preview/playback embed\n * alongside the story photos. Accepted forms: youtube.com/watch?v=,\n * youtu.be/, youtube.com/shorts/, youtube.com/embed/,\n * m.youtube.com/watch?v=. The wire stores whatever the creator\n * pasted; clients extract the video id themselves at render time. */\n youtubeUrl: z.string().url().optional(),\n\n // ─── Goal + progress ─────────────────────────────────────────────\n goalAmountInr: z.number().int().positive(),\n /** Sum of donations whose `verificationState === 'verified'`\n * (receipt uploaded or creator confirmed). THIS drives the visible\n * progress bar — the product decision is that only trust-grounded\n * money counts visually. */\n verifiedAmountInr: z.number().int().nonnegative(),\n /** Total attested amount — verified + pending + disputed\n * combined. Surfaced as secondary text (\"₹X pending receipt\")\n * so creator + donors can see the full attested pipeline without\n * it inflating the headline progress. */\n attestedAmountInr: z.number().int().nonnegative(),\n /** Distinct donors who attested any state. */\n donorCount: z.number().int().nonnegative(),\n /** Distinct donors whose latest donation is `verified`. The card\n * uses this for \"47 verified supporters\" copy. */\n verifiedDonorCount: z.number().int().nonnegative(),\n\n closesAt: z.string().datetime(),\n\n // ─── Verification surface ────────────────────────────────────────\n scope: crowdfundingScopeSchema,\n verification: crowdfundingVerificationSchema,\n\n // ─── Payment surface (donor-facing) ──────────────────────────────\n payment: crowdfundingPaymentSchema,\n\n // ─── Lifecycle ───────────────────────────────────────────────────\n status: crowdfundingStatusSchema,\n closedAt: z.string().datetime().nullable().optional(),\n\n // ─── Platform fee — set on the composer's Pricing step ───────────\n /**\n * Creator's choice for how the platform fee is settled. Optional\n * on the wire so legacy campaigns created before this field landed\n * still validate; the My Campaigns surface falls back to \"deferred\n * (legacy)\" copy when missing.\n */\n feeBillingMode: crowdfundingFeeBillingModeSchema.optional(),\n /**\n * Server-tracked state of the upfront-billing payment. Always\n * `'deferred'` when `feeBillingMode === 'deferred'`. For upfront\n * campaigns: `'pending'` while the Razorpay flow is open, `'paid'`\n * after verify, `'failed'` if activation fails after capture.\n */\n feePaymentStatus: crowdfundingFeePaymentStatusSchema.optional(),\n /**\n * Platform fee in rupees recorded on the campaign:\n * - UPFRONT campaigns: the flat scope-tiered amount that was (or\n * will be) charged — looked up from\n * `CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE[scope]` at draft time\n * and frozen on `feePaymentStatus === 'paid'`.\n * - DEFERRED campaigns: `0` until disbursement, then the actual\n * `5 % × verifiedAmountInr` written by the payout job.\n *\n * Surfaced so the My Campaigns surface can show \"Paid ₹500\" /\n * \"Will deduct ₹X at payout\" badges without recomputing.\n */\n platformFeeAmountInr: z.number().int().nonnegative().optional(),\n\n // ─── Standard engagement (same axis as other kinds) ──────────────\n score: z.number().int(),\n commentCount: z.number().int().nonnegative(),\n repostCount: z.number().int().nonnegative(),\n reactionCounts: z.record(z.string(), z.number().int().nonnegative()),\n\n areaLineage: areaLineageSnapshotSchema,\n /** When set, the campaign is scoped to a topical community and the\n * geo-cascade feed query skips it (mirrors the post + poll\n * community-scoping rule). */\n communityId: z.string().optional(),\n\n createdAt: z.string().datetime(),\n\n viewer: z\n .object({\n vote: voteValueSchema.nullable(),\n reaction: z.string().nullable(),\n bookmarked: z.boolean(),\n isAuthor: z.boolean(),\n reposted: z.boolean(),\n /** The viewer's own donation state on THIS campaign. `null`\n * means they haven't attested anything yet. Populated from\n * the latest CrowdfundingDonation row keyed by\n * (campaignId, viewerUserId). */\n donationState: crowdfundingDonationStateSchema.nullable(),\n /** Amount the viewer last attested, in ₹. Null when no\n * attestation. The card uses this to render the \"You gave\n * ₹500 — upload receipt\" prompt. */\n donationAmountInr: z.number().int().positive().nullable(),\n /** True when the viewer is eligible to verify this campaign\n * (matching-or-higher leader at the campaign's scope, viewing\n * a `submitted` campaign). Renders the in-card Verify CTA. */\n canVerify: z.boolean(),\n })\n .optional(),\n});\nexport type CrowdfundingFeedItem = z.infer<typeof crowdfundingFeedItemSchema>;\n\n// Same shape mirrored as the public \"wire\" alias for parity with the\n// other kinds whose feed envelope === detail envelope.\nexport const communityCrowdfundingWireSchema = crowdfundingFeedItemSchema;\nexport type CommunityCrowdfundingWire = z.infer<typeof communityCrowdfundingWireSchema>;\n\n// ─── Donation wire ─────────────────────────────────────────────────────────\n\n/**\n * Single donation row — surfaced on the campaign's public donor list\n * and on the donor's own \"My Donations\" surface. The full bank /\n * receipt URL stays server-side; the wire carries display info plus\n * the verification state.\n */\nexport const crowdfundingDonationWireSchema = z.object({\n _id: z.string(),\n campaignId: z.string(),\n /** Donor's userId — omitted when `isAnonymous`, so the wire is the\n * privacy boundary not the card. */\n donorUserId: z.string().optional(),\n donorDisplayName: z.string(),\n amountInr: z.number().int().positive(),\n isAnonymous: z.boolean(),\n attestedAt: z.string().datetime(),\n /** When the receipt was uploaded. Absent on pending donations. */\n receiptUploadedAt: z.string().datetime().nullable().optional(),\n /** Signed URL for the receipt screenshot. Visible only to:\n * - the donor (their own row)\n * - the campaign creator\n * - the verifier on review\n * - admin / moderators\n * The list endpoint scrubs this for all other viewers. */\n receiptUrl: z.string().url().nullable().optional(),\n verificationState: crowdfundingDonationStateSchema,\n /** Set when the creator confirmed receipt independently of a\n * receipt upload. e.g. \"I see ₹500 from Ravi in my account\". */\n creatorConfirmed: z.boolean().optional(),\n /** Set when the creator marked \"I didn't receive this\". Donor is\n * notified to upload the receipt; auto-reverts after 7 days. */\n disputeReason: z.string().optional(),\n});\nexport type CrowdfundingDonationWire = z.infer<typeof crowdfundingDonationWireSchema>;\n\n// ─── Create / update / lifecycle bodies ────────────────────────────────────\n\n/**\n * Composer payload. Identity + bank fields are tier-conditional —\n * the server cross-checks the chosen `goalAmountInr` against the\n * provided fields per the tier matrix in constants.ts.\n */\nexport const createCrowdfundingBodySchema = z.object({\n title: z.string().trim().min(CROWDFUNDING_TITLE_MIN_CHARS).max(CROWDFUNDING_TITLE_MAX_CHARS),\n description: z\n .string()\n .trim()\n .min(CROWDFUNDING_DESCRIPTION_MIN_CHARS)\n .max(CROWDFUNDING_DESCRIPTION_MAX_CHARS),\n category: crowdfundingCategorySchema,\n beneficiaryName: z.string().trim().min(2).max(CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS),\n beneficiaryRelation: z\n .string()\n .trim()\n .max(CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS)\n .optional(),\n /** Audience picker — drives the relation chip set + the\n * organization-specific identity sub-steps on the composer. */\n audience: crowdfundingAudienceSchema.optional(),\n /** When `category === 'other'`, the writer's short label for the\n * custom cause. Bounded to keep the database column sane. */\n categoryOther: z.string().trim().max(80).optional(),\n /** Up to 3 sub-causes within the chosen category. */\n subCauses: z.array(z.string().trim().max(60)).max(3).optional(),\n /** Writer's clarification when one of the picked sub-causes is\n * \"Other\". */\n subCauseOther: z.string().trim().max(80).optional(),\n /** Org-registration class. Only set when `audience === 'organization'`. */\n organizationKind: crowdfundingOrgKindSchema.optional(),\n /** Writer's clarification when `organizationKind === 'other'`. */\n organizationKindOther: z.string().trim().max(80).optional(),\n images: z.array(z.string().url()).max(CROWDFUNDING_MAX_IMAGES).optional(),\n /** Optional YouTube video URL. Validated as a URL here; the\n * client-side validator additionally checks the host/path matches\n * a recognised YouTube shape and extracts the video id for the\n * preview component. */\n youtubeUrl: z.string().url().optional(),\n\n goalAmountInr: z.number().int().min(CROWDFUNDING_MIN_GOAL_INR).max(CROWDFUNDING_MAX_GOAL_INR),\n /** Duration in days. The server resolves `closesAt = now +\n * durationDays * 86400 * 1000` so client clock skew can't push\n * the close-time into the past. */\n durationDays: z\n .number()\n .int()\n .min(CROWDFUNDING_MIN_DURATION_DAYS)\n .max(CROWDFUNDING_MAX_DURATION_DAYS),\n\n scope: crowdfundingScopeSchema,\n\n // ─── Payment fields (server keeps full account + IFSC encrypted;\n // wire only carries last-4 + holder name + optional UPI ID) ──\n upiQrUrl: z.string().url(),\n upiId: z.string().trim().max(50).optional(),\n /** Full bank account number — 9-18 digits per RBI's range. Stored\n * encrypted server-side; never on the public wire. */\n bankAccountNumber: z\n .string()\n .trim()\n .regex(/^[0-9]{9,18}$/),\n bankAccountHolderName: z.string().trim().min(2).max(100),\n /** Indian IFSC code — 4 letters + 0 + 6 alphanumerics. Stored\n * encrypted; truncated on the wire. */\n ifsc: z\n .string()\n .trim()\n .regex(/^[A-Z]{4}0[A-Z0-9]{6}$/),\n bankName: z.string().trim().max(100).optional(),\n\n // ─── Identity (tier-conditional, validated server-side) ──────────\n /** PAN — 5 letters + 4 digits + 1 letter. Required for goal ≥\n * ₹25k (Standard tier). Stored encrypted; never on the wire (the\n * audit log surfaces a masked \"ABCDE****F\" form to verifiers). */\n pan: z\n .string()\n .trim()\n .regex(/^[A-Z]{5}[0-9]{4}[A-Z]$/)\n .optional(),\n /** Aadhaar last-4 only (never the full number — Aadhaar Act\n * restricts storage). Required for goal ≥ ₹2L (Enhanced tier). */\n aadhaarLast4: z\n .string()\n .trim()\n .regex(/^[0-9]{4}$/)\n .optional(),\n /** GCS URLs of supporting documents (hospital invoice / school\n * admission letter / FIR / etc.). Required for goal ≥ ₹2L.\n * Verifier sees these on the review queue; donors do not. */\n supportingDocs: z.array(z.string().url()).max(CROWDFUNDING_MAX_SUPPORTING_DOCS).optional(),\n\n /** Optional community scoping. If set the creator must be an active\n * member; non-members get a 403 server-side. */\n communityId: z.string().optional(),\n\n /**\n * How the platform fee is settled — set on the composer's Pricing\n * step. Optional on the wire so legacy clients (and older drafts\n * being resumed) still validate; the backend defaults a missing\n * value to `'deferred'` (the no-money-now path) since that's the\n * non-destructive default — if the creator never explicitly picks\n * upfront the platform won't surprise-charge them. The submit-for-\n * review handler enforces that an `'upfront'` choice has actually\n * been paid before the campaign enters the verifier queue.\n */\n feeBillingMode: crowdfundingFeeBillingModeSchema.optional(),\n});\nexport type CreateCrowdfundingBody = z.infer<typeof createCrowdfundingBodySchema>;\n\n/**\n * Update body — only fields that are safe to change on a `draft` or\n * `rejected` campaign before resubmission. Verification + lifecycle\n * fields cannot be updated through this endpoint. Tier + identity\n * fields stay editable so a rejected campaign can fix what the\n * verifier flagged.\n */\nexport const updateCrowdfundingBodySchema = createCrowdfundingBodySchema.partial();\nexport type UpdateCrowdfundingBody = z.infer<typeof updateCrowdfundingBodySchema>;\n\n/**\n * What the verifier sends when approving. The `verifierScope`\n * lets a higher-tier leader claim their tier at action time (a\n * district leader approving a local campaign records `district`).\n */\nexport const approveCrowdfundingBodySchema = z.object({\n verifierScope: crowdfundingScopeSchema,\n});\nexport type ApproveCrowdfundingBody = z.infer<typeof approveCrowdfundingBodySchema>;\n\n/**\n * Rejection body. Reason is required and surfaces back to the creator\n * so they can fix the gap and resubmit.\n */\nexport const rejectCrowdfundingBodySchema = z.object({\n reason: z\n .string()\n .trim()\n .min(CROWDFUNDING_REJECTION_REASON_MIN_CHARS)\n .max(CROWDFUNDING_REJECTION_REASON_MAX_CHARS),\n});\nexport type RejectCrowdfundingBody = z.infer<typeof rejectCrowdfundingBodySchema>;\n\n// ─── Donation bodies ───────────────────────────────────────────────────────\n\n/**\n * Donor self-attests a donation. Receipt is OPTIONAL — the\n * attestation creates a `pending` row that the donor can attach a\n * receipt to later (anytime, from settings → My Donations) which\n * promotes it to `verified` and counts toward the progress bar.\n */\nexport const attestCrowdfundingDonationBodySchema = z.object({\n amountInr: z.number().int().min(1).max(CROWDFUNDING_MAX_DONATION_INR),\n isAnonymous: z.boolean().default(false),\n /** GCS URL of the receipt screenshot. When omitted the donation\n * enters `pending` state. */\n receiptUrl: z.string().url().optional(),\n});\nexport type AttestCrowdfundingDonationBody = z.infer<typeof attestCrowdfundingDonationBodySchema>;\n\n/**\n * Upload (or re-upload) a receipt for a previously-attested donation.\n * Promotes a `pending` row to `verified`; for an already-`verified`\n * row it replaces the receipt.\n */\nexport const uploadCrowdfundingReceiptBodySchema = z.object({\n receiptUrl: z.string().url(),\n});\nexport type UploadCrowdfundingReceiptBody = z.infer<typeof uploadCrowdfundingReceiptBodySchema>;\n\n// ─── Listing query ─────────────────────────────────────────────────────────\n\nexport const listCrowdfundingDonationsQuerySchema = z.object({\n page: z.number().int().positive().optional(),\n limit: z.number().int().positive().max(100).optional(),\n state: crowdfundingDonationStateSchema.optional(),\n});\nexport type ListCrowdfundingDonationsQuery = z.infer<typeof listCrowdfundingDonationsQuerySchema>;\n\n/**\n * Per-donor \"My Donations\" surface — different from the per-campaign\n * donor list. Returns every donation the viewer has attested, across\n * all campaigns, so the donor can spot any row that's still\n * `pending` and upload a receipt.\n */\nexport const listMyCrowdfundingDonationsQuerySchema = z.object({\n page: z.number().int().positive().optional(),\n limit: z.number().int().positive().max(100).optional(),\n state: crowdfundingDonationStateSchema.optional(),\n});\nexport type ListMyCrowdfundingDonationsQuery = z.infer<\n typeof listMyCrowdfundingDonationsQuerySchema\n>;\n"]}
1
+ {"version":3,"file":"crowdfunding.js","sourceRoot":"","sources":["../src/crowdfunding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,uCAAuC,EACvC,2CAA2C,EAC3C,kCAAkC,EAClC,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,EAC9B,yBAAyB,EACzB,uCAAuC,EACvC,uCAAuC,EACvC,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,SAAS;IACT,WAAW;IACX,aAAa;IACb,eAAe;IACf,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,OAAO;IACP,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB;;;;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,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC","sourcesContent":["/**\n * Community crowdfunding wire shapes.\n *\n * A crowdfunding campaign is a verified civic fundraiser surfaced in\n * the feed alongside posts / polls / lost-found / voice-box / donate-\n * item. The model is:\n *\n * 1. Creator drafts a campaign, fills bank + UPI QR + identity tier\n * based on the goal amount, picks an area scope.\n * 2. A leader at the matching scope (or any leader higher up the\n * hierarchy) reviews and approves OR rejects with reason.\n * Approved campaigns transition to ACTIVE and appear in the feed.\n * 3. Donors view the card, tap \"Donate\", pay externally via UPI\n * directly to the creator's bank — the platform never sees the\n * money. After paying, the donor self-attests amount + uploads a\n * receipt screenshot (optional). Without a screenshot the\n * donation enters PENDING state — the donor can upload the\n * receipt later (anytime, from settings → My Donations).\n * 4. The live progress bar shows ONLY verified amount (receipt\n * uploaded). Pending donations are counted separately and\n * surfaced as a secondary \"₹X pending receipt\" note. This is the\n * product decision: the visible progress reflects trust-grounded\n * money, not claims.\n *\n * Privacy: bank account number, IFSC, PAN, Aadhaar last-4, and\n * supporting documents are NEVER on the wire. Only `bankAccountLast4`,\n * `bankAccountHolderName`, and a UPI QR URL surface to donors.\n *\n * @module community-schema/crowdfunding\n */\n\nimport { z } from 'zod';\nimport { areaLineageSnapshotSchema } from './area.js';\nimport {\n CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS,\n CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS,\n CROWDFUNDING_DESCRIPTION_MAX_CHARS,\n CROWDFUNDING_DESCRIPTION_MIN_CHARS,\n CROWDFUNDING_MAX_DONATION_INR,\n CROWDFUNDING_MAX_DURATION_DAYS,\n CROWDFUNDING_MAX_GOAL_INR,\n CROWDFUNDING_MAX_IMAGES,\n CROWDFUNDING_MAX_SUPPORTING_DOCS,\n CROWDFUNDING_MIN_DURATION_DAYS,\n CROWDFUNDING_MIN_GOAL_INR,\n CROWDFUNDING_REJECTION_REASON_MAX_CHARS,\n CROWDFUNDING_REJECTION_REASON_MIN_CHARS,\n CROWDFUNDING_TITLE_MAX_CHARS,\n CROWDFUNDING_TITLE_MIN_CHARS,\n} from './constants.js';\nimport { voteValueSchema } from './engagement.js';\nimport { postAuthorSnapshotSchema } from './post.js';\n\n// ─── Enums ─────────────────────────────────────────────────────────────────\n\n/**\n * Top-level categories — drives the chip + icon on the card and the\n * verifier's per-category supporting-doc requirements (medical needs\n * hospital invoice; education needs admission letter; etc.).\n */\nexport const CROWDFUNDING_CATEGORY_VALUES = [\n 'medical',\n 'maternity',\n 'senior_care',\n 'special_needs',\n 'education',\n 'memorial',\n 'disaster',\n 'civic',\n 'faith',\n 'sports_talent',\n 'animal_welfare',\n 'environment',\n 'legal_aid',\n 'arts_culture',\n 'self_improvement',\n /**\n * Startup / prototype building — distinct from `self_improvement`\n * (which is now strictly skill / coursework). Covers MVP builds,\n * tooling, initial inventory, working capital, registration fees,\n * marketing for genuine first-stage entrepreneurs.\n */\n 'startup_prototype',\n 'other',\n] as const;\n\n/**\n * Who the campaign is for — drives the relation chip set and the\n * organization-specific identity asks on the composer. Captured so the\n * verifier can match the campaign narrative to the supporting docs\n * (e.g. an `organization` audience should produce 12A / 80G papers,\n * not a personal hospital bill).\n */\nexport const CROWDFUNDING_AUDIENCE_VALUES = [\n 'self',\n 'family',\n 'friend',\n 'community',\n 'organization',\n] as const;\nexport const crowdfundingAudienceSchema = z.enum(CROWDFUNDING_AUDIENCE_VALUES);\nexport type CrowdfundingAudience = z.infer<typeof crowdfundingAudienceSchema>;\n\n/**\n * Org-registration class — only meaningful when `audience ===\n * 'organization'`. Drives the verifier's expected document set\n * (12A/80G for trust, FCRA-style papers for NGO, etc.).\n */\nexport const CROWDFUNDING_ORG_KIND_VALUES = [\n 'ngo',\n 'trust',\n 'society',\n 'section_8',\n 'other',\n] as const;\nexport const crowdfundingOrgKindSchema = z.enum(CROWDFUNDING_ORG_KIND_VALUES);\nexport type CrowdfundingOrgKind = z.infer<typeof crowdfundingOrgKindSchema>;\nexport const crowdfundingCategorySchema = z.enum(CROWDFUNDING_CATEGORY_VALUES);\nexport type CrowdfundingCategory = z.infer<typeof crowdfundingCategorySchema>;\n\n/**\n * Area scope — drives the required verifier role. A higher-tier\n * leader can always verify a lower-tier campaign (escalation path);\n * the reverse is rejected.\n */\nexport const CROWDFUNDING_SCOPE_VALUES = [\n 'local',\n 'district',\n 'state',\n 'national',\n 'global',\n] as const;\nexport const crowdfundingScopeSchema = z.enum(CROWDFUNDING_SCOPE_VALUES);\nexport type CrowdfundingScope = z.infer<typeof crowdfundingScopeSchema>;\n\n/**\n * Lifecycle state. `submitted` is the verifier's queue; `active` is\n * publishable in the feed; the three `closed_*` are terminal end-states\n * with different reasons.\n */\nexport const CROWDFUNDING_STATUS_VALUES = [\n 'draft',\n 'submitted',\n 'rejected',\n 'active',\n 'closed_success',\n 'closed_timeout',\n 'closed_by_creator',\n] as const;\nexport const crowdfundingStatusSchema = z.enum(CROWDFUNDING_STATUS_VALUES);\nexport type CrowdfundingStatus = z.infer<typeof crowdfundingStatusSchema>;\n\n/**\n * Per-donation verification state. `pending` = attested but no\n * receipt. `verified` = receipt uploaded (creator confirmation\n * optional). `disputed` = creator marked \"I didn't receive this\".\n * Only `verified` rolls into the campaign's `verifiedAmountInr`\n * which drives the visible progress bar.\n */\nexport const CROWDFUNDING_DONATION_STATE_VALUES = ['pending', 'verified', 'disputed'] as const;\nexport const crowdfundingDonationStateSchema = z.enum(CROWDFUNDING_DONATION_STATE_VALUES);\nexport type CrowdfundingDonationState = z.infer<typeof crowdfundingDonationStateSchema>;\n\n/**\n * When the platform fee is settled:\n * - `'upfront'` — Creator pays a FLAT scope-tiered fee via Razorpay\n * BEFORE the campaign goes to leader review (₹500 local / ₹1,000\n * district / ₹2,000 state / ₹5,000 national / ₹10,000 global —\n * see `CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE`). Approved\n * campaigns then disburse 100 % of donations to the creator.\n * - `'deferred'` — Nothing paid upfront. At disbursement time the\n * platform deducts 5 % of COLLECTED donations (see\n * `CROWDFUNDING_DEFERRED_FEE_RATE`) before transferring the rest\n * to the creator. The creator accepts an \"I promise to pay\"\n * attestation on the Pricing step to take this path.\n *\n * The choice is captured at submit time on the composer's Pricing\n * step and surfaced on the wire so the My Campaigns surface can show\n * \"Paid ₹X\" / \"Will deduct at payout\" badges per campaign.\n */\nexport const CROWDFUNDING_FEE_BILLING_MODE_VALUES = ['upfront', 'deferred'] as const;\nexport const crowdfundingFeeBillingModeSchema = z.enum(CROWDFUNDING_FEE_BILLING_MODE_VALUES);\nexport type CrowdfundingFeeBillingMode = z.infer<typeof crowdfundingFeeBillingModeSchema>;\n\n/**\n * Server-tracked state of the upfront-billing payment. Always\n * `'deferred'` when the creator picked the on-collection mode (there\n * is nothing to pay until disbursement). For upfront mode it starts\n * at `'pending'` on draft create, flips to `'paid'` after Razorpay\n * verify, and stays `'paid'` for the campaign lifetime.\n *\n * No `'failed'` state today — if Razorpay fails or the user dismisses\n * the modal, the row stays `'pending'` and the next retry transitions\n * via the same flow. A failure state can be added when (and if) the\n * My Campaigns surface needs a distinct \"retry needed\" badge.\n */\nexport const CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES = [\n 'pending',\n 'paid',\n 'deferred',\n] as const;\nexport const crowdfundingFeePaymentStatusSchema = z.enum(CROWDFUNDING_FEE_PAYMENT_STATUS_VALUES);\nexport type CrowdfundingFeePaymentStatus = z.infer<typeof crowdfundingFeePaymentStatusSchema>;\n\n// ─── Sub-shapes ────────────────────────────────────────────────────────────\n\n/**\n * Per-campaign verification block. `approved` is the only state that\n * lets the campaign go ACTIVE; `pending` keeps it queued; `rejected`\n * is terminal-with-resubmit-allowed.\n */\nexport const crowdfundingVerificationSchema = z.object({\n status: z.enum(['pending', 'approved', 'rejected']),\n /** The leader who acted on this submission (display name —\n * live-joined from User at projection time). */\n verifiedByDisplayName: z.string().optional(),\n verifiedByUserId: z.string().optional(),\n /** When the leader acted. Approved + rejected both stamp this. */\n verifiedAt: z.string().datetime().optional(),\n /** The scope the verifier claimed when acting. A district leader\n * acting on a local campaign records `district` here so the\n * audit log shows the escalation path. */\n verifierScope: crowdfundingScopeSchema.optional(),\n /** Required when `status === 'rejected'`. Why the leader said no. */\n rejectionReason: z.string().optional(),\n});\nexport type CrowdfundingVerification = z.infer<typeof crowdfundingVerificationSchema>;\n\n/**\n * Public-facing payment surface — what the donor sees in the Donate\n * dialog. The full account number, IFSC, PAN, Aadhaar, supporting\n * docs etc. are kept server-side; only what's needed for the donor\n * to send money + recognise the recipient is exposed.\n */\nexport const crowdfundingPaymentSchema = z.object({\n /** GCS URL of the UPI QR code image uploaded by the creator. The\n * Donate dialog renders this for the donor to scan. */\n upiQrUrl: z.string().url(),\n /** Optional VPA — lets the donor tap a one-tap UPI deep link\n * instead of scanning the QR. e.g. \"ravi@okhdfcbank\". */\n upiId: z.string().optional(),\n /** Last 4 digits of the bank account — shown to the donor as\n * reassurance (\"ending in ••1234\"). Full number never surfaces. */\n bankAccountLast4: z.string().length(4),\n /** Account holder's name — must match the verified author display\n * name (penny-drop + UDP cross-check at submission time). */\n bankAccountHolderName: z.string(),\n /** Optional bank short name surfaced on the dialog. */\n bankName: z.string().optional(),\n});\nexport type CrowdfundingPayment = z.infer<typeof crowdfundingPaymentSchema>;\n\n// ─── Wire shape — feed item ────────────────────────────────────────────────\n\n/**\n * The card-renderable wire shape. Mirrors the engagement + author +\n * area-lineage shape of other feed kinds so the existing\n * EngagementBar, AuthorByline, and feed-projection helpers slot in\n * 1:1 without per-kind branches.\n */\nexport const crowdfundingFeedItemSchema = z.object({\n _id: z.string(),\n contentKind: z.literal('crowdfunding'),\n author: postAuthorSnapshotSchema,\n\n // ─── Campaign content ────────────────────────────────────────────\n title: z.string(),\n description: z.string(),\n category: crowdfundingCategorySchema,\n beneficiaryName: z.string(),\n beneficiaryRelation: z.string().optional(),\n /** Who the campaign is for. Optional on the wire so historic\n * campaigns created before this field landed still validate. */\n audience: crowdfundingAudienceSchema.optional(),\n /** Optional explainer when `category === 'other'` — the writer's\n * short label for the custom cause (e.g. \"Wedding emergency\"). */\n categoryOther: z.string().optional(),\n /** Up to 3 sub-causes within the chosen category, e.g.\n * [\"Cancer treatment\", \"ICU / critical care\"] for `medical`. */\n subCauses: z.array(z.string()).max(3).optional(),\n /** When one of the picked sub-causes is \"Other\", this carries the\n * writer's clarification (e.g. \"Reconstructive surgery\"). */\n subCauseOther: z.string().optional(),\n /** Org-registration class. Only meaningful when\n * `audience === 'organization'`. */\n organizationKind: crowdfundingOrgKindSchema.optional(),\n /** When `organizationKind === 'other'`, the writer's clarification\n * (e.g. \"Religious body\", \"Cooperative\"). */\n organizationKindOther: z.string().optional(),\n /** Story images (separate from supporting documents, which are\n * verifier-only). Up to `CROWDFUNDING_MAX_IMAGES`. */\n images: z.array(z.string().url()).max(CROWDFUNDING_MAX_IMAGES).optional(),\n /** Optional YouTube URL surfaced as a preview/playback embed\n * alongside the story photos. Accepted forms: youtube.com/watch?v=,\n * youtu.be/, youtube.com/shorts/, youtube.com/embed/,\n * m.youtube.com/watch?v=. The wire stores whatever the creator\n * pasted; clients extract the video id themselves at render time. */\n youtubeUrl: z.string().url().optional(),\n\n // ─── Goal + progress ─────────────────────────────────────────────\n goalAmountInr: z.number().int().positive(),\n /** Sum of donations whose `verificationState === 'verified'`\n * (receipt uploaded or creator confirmed). THIS drives the visible\n * progress bar — the product decision is that only trust-grounded\n * money counts visually. */\n verifiedAmountInr: z.number().int().nonnegative(),\n /** Total attested amount — verified + pending + disputed\n * combined. Surfaced as secondary text (\"₹X pending receipt\")\n * so creator + donors can see the full attested pipeline without\n * it inflating the headline progress. */\n attestedAmountInr: z.number().int().nonnegative(),\n /** Distinct donors who attested any state. */\n donorCount: z.number().int().nonnegative(),\n /** Distinct donors whose latest donation is `verified`. The card\n * uses this for \"47 verified supporters\" copy. */\n verifiedDonorCount: z.number().int().nonnegative(),\n\n closesAt: z.string().datetime(),\n\n // ─── Verification surface ────────────────────────────────────────\n scope: crowdfundingScopeSchema,\n verification: crowdfundingVerificationSchema,\n\n // ─── Payment surface (donor-facing) ──────────────────────────────\n payment: crowdfundingPaymentSchema,\n\n // ─── Lifecycle ───────────────────────────────────────────────────\n status: crowdfundingStatusSchema,\n closedAt: z.string().datetime().nullable().optional(),\n\n // ─── Platform fee — set on the composer's Pricing step ───────────\n /**\n * Creator's choice for how the platform fee is settled. Optional\n * on the wire so legacy campaigns created before this field landed\n * still validate; the My Campaigns surface falls back to \"deferred\n * (legacy)\" copy when missing.\n */\n feeBillingMode: crowdfundingFeeBillingModeSchema.optional(),\n /**\n * Server-tracked state of the upfront-billing payment. Always\n * `'deferred'` when `feeBillingMode === 'deferred'`. For upfront\n * campaigns: `'pending'` while the Razorpay flow is open or\n * incomplete, `'paid'` after verify.\n */\n feePaymentStatus: crowdfundingFeePaymentStatusSchema.optional(),\n /**\n * Platform fee in rupees recorded on the campaign:\n * - UPFRONT campaigns: the flat scope-tiered amount that was (or\n * will be) charged — looked up from\n * `CROWDFUNDING_UPFRONT_FEE_INR_BY_SCOPE[scope]` at draft time\n * and frozen on `feePaymentStatus === 'paid'`.\n * - DEFERRED campaigns: `0` until disbursement, then the actual\n * `5 % × verifiedAmountInr` written by the payout job.\n *\n * Surfaced so the My Campaigns surface can show \"Paid ₹500\" /\n * \"Will deduct ₹X at payout\" badges without recomputing.\n */\n platformFeeAmountInr: z.number().int().nonnegative().optional(),\n\n // ─── Standard engagement (same axis as other kinds) ──────────────\n score: z.number().int(),\n commentCount: z.number().int().nonnegative(),\n repostCount: z.number().int().nonnegative(),\n reactionCounts: z.record(z.string(), z.number().int().nonnegative()),\n\n areaLineage: areaLineageSnapshotSchema,\n /** When set, the campaign is scoped to a topical community and the\n * geo-cascade feed query skips it (mirrors the post + poll\n * community-scoping rule). */\n communityId: z.string().optional(),\n\n createdAt: z.string().datetime(),\n\n viewer: z\n .object({\n vote: voteValueSchema.nullable(),\n reaction: z.string().nullable(),\n bookmarked: z.boolean(),\n isAuthor: z.boolean(),\n reposted: z.boolean(),\n /** The viewer's own donation state on THIS campaign. `null`\n * means they haven't attested anything yet. Populated from\n * the latest CrowdfundingDonation row keyed by\n * (campaignId, viewerUserId). */\n donationState: crowdfundingDonationStateSchema.nullable(),\n /** Amount the viewer last attested, in ₹. Null when no\n * attestation. The card uses this to render the \"You gave\n * ₹500 — upload receipt\" prompt. */\n donationAmountInr: z.number().int().positive().nullable(),\n /** True when the viewer is eligible to verify this campaign\n * (matching-or-higher leader at the campaign's scope, viewing\n * a `submitted` campaign). Renders the in-card Verify CTA. */\n canVerify: z.boolean(),\n })\n .optional(),\n});\nexport type CrowdfundingFeedItem = z.infer<typeof crowdfundingFeedItemSchema>;\n\n// Same shape mirrored as the public \"wire\" alias for parity with the\n// other kinds whose feed envelope === detail envelope.\nexport const communityCrowdfundingWireSchema = crowdfundingFeedItemSchema;\nexport type CommunityCrowdfundingWire = z.infer<typeof communityCrowdfundingWireSchema>;\n\n// ─── Donation wire ─────────────────────────────────────────────────────────\n\n/**\n * Single donation row — surfaced on the campaign's public donor list\n * and on the donor's own \"My Donations\" surface. The full bank /\n * receipt URL stays server-side; the wire carries display info plus\n * the verification state.\n */\nexport const crowdfundingDonationWireSchema = z.object({\n _id: z.string(),\n campaignId: z.string(),\n /** Donor's userId — omitted when `isAnonymous`, so the wire is the\n * privacy boundary not the card. */\n donorUserId: z.string().optional(),\n donorDisplayName: z.string(),\n amountInr: z.number().int().positive(),\n isAnonymous: z.boolean(),\n attestedAt: z.string().datetime(),\n /** When the receipt was uploaded. Absent on pending donations. */\n receiptUploadedAt: z.string().datetime().nullable().optional(),\n /** Signed URL for the receipt screenshot. Visible only to:\n * - the donor (their own row)\n * - the campaign creator\n * - the verifier on review\n * - admin / moderators\n * The list endpoint scrubs this for all other viewers. */\n receiptUrl: z.string().url().nullable().optional(),\n verificationState: crowdfundingDonationStateSchema,\n /** Set when the creator confirmed receipt independently of a\n * receipt upload. e.g. \"I see ₹500 from Ravi in my account\". */\n creatorConfirmed: z.boolean().optional(),\n /** Set when the creator marked \"I didn't receive this\". Donor is\n * notified to upload the receipt; auto-reverts after 7 days. */\n disputeReason: z.string().optional(),\n});\nexport type CrowdfundingDonationWire = z.infer<typeof crowdfundingDonationWireSchema>;\n\n// ─── Create / update / lifecycle bodies ────────────────────────────────────\n\n/**\n * Composer payload. Identity + bank fields are tier-conditional —\n * the server cross-checks the chosen `goalAmountInr` against the\n * provided fields per the tier matrix in constants.ts.\n */\nexport const createCrowdfundingBodySchema = z.object({\n title: z.string().trim().min(CROWDFUNDING_TITLE_MIN_CHARS).max(CROWDFUNDING_TITLE_MAX_CHARS),\n description: z\n .string()\n .trim()\n .min(CROWDFUNDING_DESCRIPTION_MIN_CHARS)\n .max(CROWDFUNDING_DESCRIPTION_MAX_CHARS),\n category: crowdfundingCategorySchema,\n beneficiaryName: z.string().trim().min(2).max(CROWDFUNDING_BENEFICIARY_NAME_MAX_CHARS),\n beneficiaryRelation: z\n .string()\n .trim()\n .max(CROWDFUNDING_BENEFICIARY_RELATION_MAX_CHARS)\n .optional(),\n /** Audience picker — drives the relation chip set + the\n * organization-specific identity sub-steps on the composer. */\n audience: crowdfundingAudienceSchema.optional(),\n /** When `category === 'other'`, the writer's short label for the\n * custom cause. Bounded to keep the database column sane. */\n categoryOther: z.string().trim().max(80).optional(),\n /** Up to 3 sub-causes within the chosen category. */\n subCauses: z.array(z.string().trim().max(60)).max(3).optional(),\n /** Writer's clarification when one of the picked sub-causes is\n * \"Other\". */\n subCauseOther: z.string().trim().max(80).optional(),\n /** Org-registration class. Only set when `audience === 'organization'`. */\n organizationKind: crowdfundingOrgKindSchema.optional(),\n /** Writer's clarification when `organizationKind === 'other'`. */\n organizationKindOther: z.string().trim().max(80).optional(),\n images: z.array(z.string().url()).max(CROWDFUNDING_MAX_IMAGES).optional(),\n /** Optional YouTube video URL. Validated as a URL here; the\n * client-side validator additionally checks the host/path matches\n * a recognised YouTube shape and extracts the video id for the\n * preview component. */\n youtubeUrl: z.string().url().optional(),\n\n goalAmountInr: z.number().int().min(CROWDFUNDING_MIN_GOAL_INR).max(CROWDFUNDING_MAX_GOAL_INR),\n /** Duration in days. The server resolves `closesAt = now +\n * durationDays * 86400 * 1000` so client clock skew can't push\n * the close-time into the past. */\n durationDays: z\n .number()\n .int()\n .min(CROWDFUNDING_MIN_DURATION_DAYS)\n .max(CROWDFUNDING_MAX_DURATION_DAYS),\n\n scope: crowdfundingScopeSchema,\n\n // ─── Payment fields (server keeps full account + IFSC encrypted;\n // wire only carries last-4 + holder name + optional UPI ID) ──\n upiQrUrl: z.string().url(),\n upiId: z.string().trim().max(50).optional(),\n /** Full bank account number — 9-18 digits per RBI's range. Stored\n * encrypted server-side; never on the public wire. */\n bankAccountNumber: z\n .string()\n .trim()\n .regex(/^[0-9]{9,18}$/),\n bankAccountHolderName: z.string().trim().min(2).max(100),\n /** Indian IFSC code — 4 letters + 0 + 6 alphanumerics. Stored\n * encrypted; truncated on the wire. */\n ifsc: z\n .string()\n .trim()\n .regex(/^[A-Z]{4}0[A-Z0-9]{6}$/),\n bankName: z.string().trim().max(100).optional(),\n\n // ─── Identity (tier-conditional, validated server-side) ──────────\n /** PAN — 5 letters + 4 digits + 1 letter. Required for goal ≥\n * ₹25k (Standard tier). Stored encrypted; never on the wire (the\n * audit log surfaces a masked \"ABCDE****F\" form to verifiers). */\n pan: z\n .string()\n .trim()\n .regex(/^[A-Z]{5}[0-9]{4}[A-Z]$/)\n .optional(),\n /** Aadhaar last-4 only (never the full number — Aadhaar Act\n * restricts storage). Required for goal ≥ ₹2L (Enhanced tier). */\n aadhaarLast4: z\n .string()\n .trim()\n .regex(/^[0-9]{4}$/)\n .optional(),\n /** GCS URLs of supporting documents (hospital invoice / school\n * admission letter / FIR / etc.). Required for goal ≥ ₹2L.\n * Verifier sees these on the review queue; donors do not. */\n supportingDocs: z.array(z.string().url()).max(CROWDFUNDING_MAX_SUPPORTING_DOCS).optional(),\n\n /** Optional community scoping. If set the creator must be an active\n * member; non-members get a 403 server-side. */\n communityId: z.string().optional(),\n\n /**\n * How the platform fee is settled — set on the composer's Pricing\n * step. Optional on the wire so legacy clients (and older drafts\n * being resumed) still validate; the backend defaults a missing\n * value to `'deferred'` (the no-money-now path) since that's the\n * non-destructive default — if the creator never explicitly picks\n * upfront the platform won't surprise-charge them. The submit-for-\n * review handler enforces that an `'upfront'` choice has actually\n * been paid before the campaign enters the verifier queue.\n */\n feeBillingMode: crowdfundingFeeBillingModeSchema.optional(),\n});\nexport type CreateCrowdfundingBody = z.infer<typeof createCrowdfundingBodySchema>;\n\n/**\n * Update body — only fields that are safe to change on a `draft` or\n * `rejected` campaign before resubmission. Verification + lifecycle\n * fields cannot be updated through this endpoint. Tier + identity\n * fields stay editable so a rejected campaign can fix what the\n * verifier flagged.\n */\nexport const updateCrowdfundingBodySchema = createCrowdfundingBodySchema.partial();\nexport type UpdateCrowdfundingBody = z.infer<typeof updateCrowdfundingBodySchema>;\n\n/**\n * What the verifier sends when approving. The `verifierScope`\n * lets a higher-tier leader claim their tier at action time (a\n * district leader approving a local campaign records `district`).\n */\nexport const approveCrowdfundingBodySchema = z.object({\n verifierScope: crowdfundingScopeSchema,\n});\nexport type ApproveCrowdfundingBody = z.infer<typeof approveCrowdfundingBodySchema>;\n\n/**\n * Rejection body. Reason is required and surfaces back to the creator\n * so they can fix the gap and resubmit.\n */\nexport const rejectCrowdfundingBodySchema = z.object({\n reason: z\n .string()\n .trim()\n .min(CROWDFUNDING_REJECTION_REASON_MIN_CHARS)\n .max(CROWDFUNDING_REJECTION_REASON_MAX_CHARS),\n});\nexport type RejectCrowdfundingBody = z.infer<typeof rejectCrowdfundingBodySchema>;\n\n// ─── Donation bodies ───────────────────────────────────────────────────────\n\n/**\n * Donor self-attests a donation. Receipt is OPTIONAL — the\n * attestation creates a `pending` row that the donor can attach a\n * receipt to later (anytime, from settings → My Donations) which\n * promotes it to `verified` and counts toward the progress bar.\n */\nexport const attestCrowdfundingDonationBodySchema = z.object({\n amountInr: z.number().int().min(1).max(CROWDFUNDING_MAX_DONATION_INR),\n isAnonymous: z.boolean().default(false),\n /** GCS URL of the receipt screenshot. When omitted the donation\n * enters `pending` state. */\n receiptUrl: z.string().url().optional(),\n});\nexport type AttestCrowdfundingDonationBody = z.infer<typeof attestCrowdfundingDonationBodySchema>;\n\n/**\n * Upload (or re-upload) a receipt for a previously-attested donation.\n * Promotes a `pending` row to `verified`; for an already-`verified`\n * row it replaces the receipt.\n */\nexport const uploadCrowdfundingReceiptBodySchema = z.object({\n receiptUrl: z.string().url(),\n});\nexport type UploadCrowdfundingReceiptBody = z.infer<typeof uploadCrowdfundingReceiptBodySchema>;\n\n// ─── Listing query ─────────────────────────────────────────────────────────\n\nexport const listCrowdfundingDonationsQuerySchema = z.object({\n page: z.number().int().positive().optional(),\n limit: z.number().int().positive().max(100).optional(),\n state: crowdfundingDonationStateSchema.optional(),\n});\nexport type ListCrowdfundingDonationsQuery = z.infer<typeof listCrowdfundingDonationsQuerySchema>;\n\n/**\n * Per-donor \"My Donations\" surface — different from the per-campaign\n * donor list. Returns every donation the viewer has attested, across\n * all campaigns, so the donor can spot any row that's still\n * `pending` and upload a receipt.\n */\nexport const listMyCrowdfundingDonationsQuerySchema = z.object({\n page: z.number().int().positive().optional(),\n limit: z.number().int().positive().max(100).optional(),\n state: crowdfundingDonationStateSchema.optional(),\n});\nexport type ListMyCrowdfundingDonationsQuery = z.infer<\n typeof listMyCrowdfundingDonationsQuerySchema\n>;\n"]}
package/dist/feed.d.ts CHANGED
@@ -1067,7 +1067,6 @@ export declare const feedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1067
1067
  pending: "pending";
1068
1068
  deferred: "deferred";
1069
1069
  paid: "paid";
1070
- failed: "failed";
1071
1070
  }>>;
1072
1071
  platformFeeAmountInr: z.ZodOptional<z.ZodNumber>;
1073
1072
  score: z.ZodNumber;
@@ -1735,7 +1734,6 @@ export declare const feedResponseSchema: z.ZodObject<{
1735
1734
  pending: "pending";
1736
1735
  deferred: "deferred";
1737
1736
  paid: "paid";
1738
- failed: "failed";
1739
1737
  }>>;
1740
1738
  platformFeeAmountInr: z.ZodOptional<z.ZodNumber>;
1741
1739
  score: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAShD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,4IAY7B,CAAC;AACX,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAAqC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4CAA6C,CAAC;AACnF,eAAO,MAAM,qBAAqB;;;;EAAmC,CAAC;AACtE,MAAM,MAAM,eAAe,G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kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jansathi-community-schema",
3
- "version": "0.29.1",
3
+ "version": "0.30.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",