founder-schema 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +110 -3
  2. package/dist/access/permissions.d.ts +3 -3
  3. package/dist/access/permissions.d.ts.map +1 -1
  4. package/dist/access/permissions.js.map +1 -1
  5. package/dist/core/common.d.ts +49 -28
  6. package/dist/core/common.d.ts.map +1 -1
  7. package/dist/core/common.js +65 -26
  8. package/dist/core/common.js.map +1 -1
  9. package/dist/core/deletion.d.ts +40 -0
  10. package/dist/core/deletion.d.ts.map +1 -0
  11. package/dist/core/deletion.js +39 -0
  12. package/dist/core/deletion.js.map +1 -0
  13. package/dist/core/limits.d.ts +25 -0
  14. package/dist/core/limits.d.ts.map +1 -1
  15. package/dist/core/limits.js +25 -0
  16. package/dist/core/limits.js.map +1 -1
  17. package/dist/core/validation.d.ts +13 -0
  18. package/dist/core/validation.d.ts.map +1 -1
  19. package/dist/core/validation.js +13 -0
  20. package/dist/core/validation.js.map +1 -1
  21. package/dist/domains/audit/audit.d.ts +36 -12
  22. package/dist/domains/audit/audit.d.ts.map +1 -1
  23. package/dist/domains/audit/audit.js +9 -10
  24. package/dist/domains/audit/audit.js.map +1 -1
  25. package/dist/domains/billing/billing.d.ts +29 -13
  26. package/dist/domains/billing/billing.d.ts.map +1 -1
  27. package/dist/domains/billing/billing.js +2 -3
  28. package/dist/domains/billing/billing.js.map +1 -1
  29. package/dist/domains/chat/chat.d.ts +19 -5
  30. package/dist/domains/chat/chat.d.ts.map +1 -1
  31. package/dist/domains/chat/chat.js +10 -10
  32. package/dist/domains/chat/chat.js.map +1 -1
  33. package/dist/domains/communities/communities.d.ts +95 -57
  34. package/dist/domains/communities/communities.d.ts.map +1 -1
  35. package/dist/domains/contributions/contributions.d.ts +28 -12
  36. package/dist/domains/contributions/contributions.d.ts.map +1 -1
  37. package/dist/domains/contributions/contributions.js +3 -0
  38. package/dist/domains/contributions/contributions.js.map +1 -1
  39. package/dist/domains/discover/discover.d.ts +2 -2
  40. package/dist/domains/feed/feed.d.ts +111 -63
  41. package/dist/domains/feed/feed.d.ts.map +1 -1
  42. package/dist/domains/feed/feed.js +3 -0
  43. package/dist/domains/feed/feed.js.map +1 -1
  44. package/dist/domains/location/areas.d.ts +338 -0
  45. package/dist/domains/location/areas.d.ts.map +1 -0
  46. package/dist/domains/location/areas.js +241 -0
  47. package/dist/domains/location/areas.js.map +1 -0
  48. package/dist/domains/location/india.d.ts +31 -123
  49. package/dist/domains/location/india.d.ts.map +1 -1
  50. package/dist/domains/location/india.js +98 -64
  51. package/dist/domains/location/india.js.map +1 -1
  52. package/dist/domains/media/media.d.ts +22 -0
  53. package/dist/domains/media/media.d.ts.map +1 -1
  54. package/dist/domains/media/media.js +20 -0
  55. package/dist/domains/media/media.js.map +1 -1
  56. package/dist/domains/members/members.d.ts +26 -9
  57. package/dist/domains/members/members.d.ts.map +1 -1
  58. package/dist/domains/members/members.js +9 -10
  59. package/dist/domains/members/members.js.map +1 -1
  60. package/dist/domains/membership/membership.d.ts +19 -0
  61. package/dist/domains/membership/membership.d.ts.map +1 -1
  62. package/dist/domains/membership/membership.js +10 -0
  63. package/dist/domains/membership/membership.js.map +1 -1
  64. package/dist/domains/moderation/moderation.d.ts +8 -2
  65. package/dist/domains/moderation/moderation.d.ts.map +1 -1
  66. package/dist/domains/moderation/moderation.js +3 -6
  67. package/dist/domains/moderation/moderation.js.map +1 -1
  68. package/dist/domains/notifications/notifications.d.ts +10 -6
  69. package/dist/domains/notifications/notifications.d.ts.map +1 -1
  70. package/dist/domains/onboarding/onboarding-answers.d.ts +9 -12
  71. package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
  72. package/dist/domains/onboarding/onboarding-answers.js +12 -19
  73. package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
  74. package/dist/domains/onboarding/onboarding.d.ts +121 -98
  75. package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
  76. package/dist/domains/onboarding/onboarding.js +30 -28
  77. package/dist/domains/onboarding/onboarding.js.map +1 -1
  78. package/dist/domains/people/person.d.ts +54 -0
  79. package/dist/domains/people/person.d.ts.map +1 -0
  80. package/dist/domains/people/person.js +73 -0
  81. package/dist/domains/people/person.js.map +1 -0
  82. package/dist/domains/products/products.d.ts +62 -33
  83. package/dist/domains/products/products.d.ts.map +1 -1
  84. package/dist/domains/products/products.js +3 -0
  85. package/dist/domains/products/products.js.map +1 -1
  86. package/dist/domains/profile/founder-profile.d.ts +93 -60
  87. package/dist/domains/profile/founder-profile.d.ts.map +1 -1
  88. package/dist/domains/profile/founder-profile.js +55 -25
  89. package/dist/domains/profile/founder-profile.js.map +1 -1
  90. package/dist/domains/reviews/reviews.d.ts +25 -15
  91. package/dist/domains/reviews/reviews.d.ts.map +1 -1
  92. package/dist/domains/support/support.d.ts +47 -10
  93. package/dist/domains/support/support.d.ts.map +1 -1
  94. package/dist/domains/support/support.js +4 -2
  95. package/dist/domains/support/support.js.map +1 -1
  96. package/dist/domains/team/team.d.ts +9 -3
  97. package/dist/domains/team/team.d.ts.map +1 -1
  98. package/dist/domains/team/team.js +3 -6
  99. package/dist/domains/team/team.js.map +1 -1
  100. package/dist/index.d.ts +13 -10
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +17 -11
  103. package/dist/index.js.map +1 -1
  104. package/package.json +3 -2
  105. package/dist/account.d.ts +0 -40
  106. package/dist/account.d.ts.map +0 -1
  107. package/dist/account.js +0 -39
  108. package/dist/account.js.map +0 -1
  109. package/dist/chat.d.ts +0 -187
  110. package/dist/chat.d.ts.map +0 -1
  111. package/dist/chat.js +0 -189
  112. package/dist/chat.js.map +0 -1
  113. package/dist/common.d.ts +0 -304
  114. package/dist/common.d.ts.map +0 -1
  115. package/dist/common.js +0 -340
  116. package/dist/common.js.map +0 -1
  117. package/dist/discover.d.ts +0 -245
  118. package/dist/discover.d.ts.map +0 -1
  119. package/dist/discover.js +0 -68
  120. package/dist/discover.js.map +0 -1
  121. package/dist/errors.d.ts +0 -85
  122. package/dist/errors.d.ts.map +0 -1
  123. package/dist/errors.js +0 -89
  124. package/dist/errors.js.map +0 -1
  125. package/dist/feed.d.ts +0 -1658
  126. package/dist/feed.d.ts.map +0 -1
  127. package/dist/feed.js +0 -623
  128. package/dist/feed.js.map +0 -1
  129. package/dist/founder-profile.d.ts +0 -387
  130. package/dist/founder-profile.d.ts.map +0 -1
  131. package/dist/founder-profile.js +0 -180
  132. package/dist/founder-profile.js.map +0 -1
  133. package/dist/limits.d.ts +0 -76
  134. package/dist/limits.d.ts.map +0 -1
  135. package/dist/limits.js +0 -84
  136. package/dist/limits.js.map +0 -1
  137. package/dist/onboarding.d.ts +0 -1018
  138. package/dist/onboarding.d.ts.map +0 -1
  139. package/dist/onboarding.js +0 -717
  140. package/dist/onboarding.js.map +0 -1
  141. package/dist/responses/common.d.ts +0 -167
  142. package/dist/responses/common.d.ts.map +0 -1
  143. package/dist/responses/common.js +0 -67
  144. package/dist/responses/common.js.map +0 -1
  145. package/dist/responses/index.d.ts +0 -7
  146. package/dist/responses/index.d.ts.map +0 -1
  147. package/dist/responses/index.js +0 -7
  148. package/dist/responses/index.js.map +0 -1
  149. package/dist/uploads.d.ts +0 -113
  150. package/dist/uploads.d.ts.map +0 -1
  151. package/dist/uploads.js +0 -106
  152. package/dist/uploads.js.map +0 -1
  153. package/dist/validation.d.ts +0 -136
  154. package/dist/validation.d.ts.map +0 -1
  155. package/dist/validation.js +0 -142
  156. package/dist/validation.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,6BAA6B;IAC7B,SAAS,EAAE,WAAW;IACtB,6D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O,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * founder-schema — How a validation failure is described, on both sides\n *\n * TWO RULES, and they are what let the web client show any error, its own or\n * the server's, on the right field in the member's language:\n *\n * 1. A CUSTOM MESSAGE IS A KEY, NEVER A SENTENCE. Where a schema needs its own\n * message (a refine, a regex), the message is one of `VALIDATION_MESSAGE`,\n * such as `phoneInvalid`. The client turns the key into text in English or\n * Hindi. Before 0.2.0 these were English sentences, so a Hindi screen showed\n * an English error, and a client that wanted to translate one had to match\n * on the wording.\n *\n * Plain bounds carry NO custom message. `.min(1)` and `.max(80)` produce\n * Zod's own `too_small` / `too_big` issues, which already say which bound\n * and what it was (`minimum`, `maximum`, `origin`), and the client words\n * them from those. A hand-written \"at most 80 characters\" would only\n * restate the number in one language.\n *\n * 2. THE SERVER SENDS EVERY ISSUE, IN THIS SHAPE. A 400 answers with\n * `error.details.issues`, built by `toValidationIssues`, so the client can\n * put each one under its field. Until 0.2.0 the backend sent only the\n * first issue's message, with no path at all.\n *\n * ⚠️ `toValidationIssues` COPIES A WHITELIST OF FIELDS, it never spreads an\n * issue. Zod can carry the rejected `input` on an issue, and these bodies hold a\n * date of birth and a phone number. Echoing them into an error response sends\n * them back to the client, into logs and into any proxy in between. A test\n * proves `input` never survives.\n *\n * @module founder-schema/core/validation\n */\n\nimport { z } from 'zod';\n\n/**\n * Every custom message a schema in this package can produce. Each is a\n * translation key the clients define in every language they ship.\n *\n * ⚠️ Append only, and add the translation in the same change. Renaming one\n * shows the raw key to every member until each client ships the new name.\n */\nexport const VALIDATION_MESSAGE = {\n /** Not a 24-hex Mongo id. */\n invalidId: 'invalidId',\n /** Handle: wrong characters, or a dot in the wrong place. */\n usernameInvalid: 'usernameInvalid',\n /** Not a 10-digit Indian mobile number. */\n phoneInvalid: 'phoneInvalid',\n /** Not a `YYYY-MM-DD` date. */\n dateInvalid: 'dateInvalid',\n /** A date that does not exist, such as 30 February. */\n dobInvalid: 'dobInvalid',\n /** Under the minimum age. */\n dobUnderAge: 'dobUnderAge',\n /** Over the sanity ceiling: almost always a mistyped year. */\n dobTooOld: 'dobTooOld',\n /** A founding year after this year. */\n foundedYearFuture: 'foundedYearFuture',\n /** A request body over the server's size limit (0.18.0: it answered in English). On `body`. */\n bodyTooLarge: 'bodyTooLarge',\n /** A request body that is not valid JSON (0.18.0: it answered in English). On `body`. */\n bodyNotJson: 'bodyNotJson',\n /** The same option twice in one vote (0.18.0). */\n pollVoteDuplicate: 'pollVoteDuplicate',\n /** The same uploaded image attached twice to one post. */\n mediaDuplicate: 'mediaDuplicate',\n /** A post with neither text nor media. */\n postEmpty: 'postEmpty',\n /** Two poll options with the same label. */\n pollOptionsDuplicate: 'pollOptionsDuplicate',\n /** An empty string sent to clear a patch field; clearing is `null`. */\n clearWithNull: 'clearWithNull',\n /** Not a plain http(s) URL on a real domain (`javascript:`, `localhost`, an IP...). */\n urlInvalid: 'urlInvalid',\n /** A handle this product keeps for itself (`admin`, `support`...). */\n usernameReserved: 'usernameReserved',\n /** Agreed to a version of the guidelines that is not the current one. */\n guidelinesOutdated: 'guidelinesOutdated',\n /** An MPIN that is not exactly six digits. */\n mpinInvalid: 'mpinInvalid',\n /** The MPIN and its confirmation differ. */\n mpinMismatch: 'mpinMismatch',\n /** Switching to a staff role without the MPIN. */\n mpinRequired: 'mpinRequired',\n /** The same role twice in one list. */\n rolesDuplicate: 'rolesDuplicate',\n /** An ask (\"testers wanted\") on a post or poll that names no product. */\n askWithoutProduct: 'askWithoutProduct',\n /** An App Store link that is not on apps.apple.com. */\n appStoreLinkHost: 'appStoreLinkHost',\n /** A Play Store link that is not on play.google.com. */\n playStoreLinkHost: 'playStoreLinkHost',\n /** A GitHub link that is not on github.com. */\n githubLinkHost: 'githubLinkHost',\n /** A demo video that is not a YouTube link. Video is shared, never uploaded. */\n videoLinkHost: 'videoLinkHost',\n /** The same screenshot twice in one gallery. */\n screenshotsDuplicate: 'screenshotsDuplicate',\n /** The same platform twice in one list. */\n platformsDuplicate: 'platformsDuplicate',\n /** The same topic twice in one list (0.9.0). */\n topicsDuplicate: 'topicsDuplicate',\n /** A post or poll in a community naming a product or an ask (0.9.0): community content carries neither. */\n communityWithProduct: 'communityWithProduct',\n /** The same capability twice in one list (0.9.0). */\n capabilitiesDuplicate: 'capabilitiesDuplicate',\n /** Not a GSTIN: 15 characters in its pattern, with a check character that adds up (0.12.0). */\n gstinInvalid: 'gstinInvalid',\n /** A GSTIN registered in another state than the one chosen: the state is the GSTIN's own (0.12.0). */\n gstinStateMismatch: 'gstinStateMismatch',\n /** A GSTIN without the legal name and address a B2B invoice must carry (0.12.0). */\n gstinNeedsNameAndAddress: 'gstinNeedsNameAndAddress',\n /** A coupon code with characters other than letters, digits and hyphens (0.12.0). */\n couponCodeInvalid: 'couponCodeInvalid',\n /** A coupon window that ends before it starts (0.12.0). */\n couponWindowInvalid: 'couponWindowInvalid',\n /** The same item twice in a coupon's list of what it applies to (0.12.0). */\n couponTargetsDuplicate: 'couponTargetsDuplicate',\n /** A paid purchase without the buyer's state: the invoice's place of supply (0.12.0). */\n billingStateRequired: 'billingStateRequired',\n /**\n * The guidelines not agreed to at all: the tick box left empty (0.17.0).\n * Distinct from `guidelinesOutdated`, which is agreement to an OLDER text;\n * \"the guidelines have changed\" is the wrong thing to tell someone who has\n * not ticked the box yet.\n */\n guidelinesRequired: 'guidelinesRequired',\n /**\n * The photo cannot be used (0.17.0): it is not the member's processed avatar\n * upload any more, most often because it expired before it was saved. Sent\n * by the server on the photo field with `UPLOAD_NOT_ATTACHABLE`.\n */\n photoUnavailable: 'photoUnavailable',\n /** A business type or registration with no business to describe (0.17.0). */\n ventureRequired: 'ventureRequired',\n /** A state that is not one of India's states and union territories (0.17.0). */\n stateUnknown: 'stateUnknown',\n /** The same goal twice in one list (0.17.0). */\n goalsDuplicate: 'goalsDuplicate',\n /** The same skill twice in one list (0.17.0). */\n skillsDuplicate: 'skillsDuplicate',\n /**\n * A location with no state (0.17.0): India's places are chosen state first.\n * Its own key, so the refusal does not carry all 36 names as its message.\n */\n stateRequired: 'stateRequired',\n} as const;\nexport type ValidationMessageKey = (typeof VALIDATION_MESSAGE)[keyof typeof VALIDATION_MESSAGE];\n\n/**\n * Which part of the request an issue is about.\n *\n * ONE PATH CONVENTION: `path` is ALWAYS relative to this part, so a body field\n * reads `['venture', 'name']` with `location: 'body'`, never\n * `['body', 'venture', 'name']`. A form maps body issues straight onto its\n * fields without stripping a prefix, and a client that sees `query` or\n * `params` knows the problem is the URL, not anything the member typed.\n */\nexport const REQUEST_PART_VALUES = ['body', 'query', 'params'] as const;\nexport const requestPartSchema = z.enum(REQUEST_PART_VALUES);\nexport type RequestPart = z.infer<typeof requestPartSchema>;\n\n/**\n * One problem with one field, as it crosses the wire.\n *\n * `code` is Zod's issue code (`too_small`, `too_big`, `invalid_type`,\n * `invalid_format`, `custom`...). `message` is either one of\n * `VALIDATION_MESSAGE` or, for a plain bound, Zod's own English text, which the\n * client ignores in favour of `code` plus `minimum` / `maximum`.\n */\nexport const validationIssueSchema = z.object({\n /** Set by the server on every issue it sends; absent on a client's own parse. */\n location: requestPartSchema.optional(),\n /**\n * Where the problem is, RELATIVE TO `location`: `['venture', 'name']`,\n * `['options', 2, 'label']`, `['contentId']`.\n */\n path: z.array(z.union([z.string(), z.number()])),\n code: z.string(),\n message: z.string(),\n /** `too_small`: the bound that was missed. */\n minimum: z.number().optional(),\n /** `too_big`: the bound that was passed. */\n maximum: z.number().optional(),\n /** What was measured: `string`, `array`, `number`... */\n origin: z.string().optional(),\n /** `invalid_format`: which format, e.g. `url`, `regex`, `email`. */\n format: z.string().optional(),\n});\nexport type ValidationIssue = z.infer<typeof validationIssueSchema>;\n\n/** The loosest shape this needs from a Zod issue, so it works across 4.x. */\ninterface ZodIssueLike {\n path: readonly PropertyKey[];\n code: string;\n message: string;\n minimum?: unknown;\n maximum?: unknown;\n origin?: unknown;\n format?: unknown;\n}\n\nconst toNumber = (v: unknown): number | undefined =>\n typeof v === 'number' ? v : typeof v === 'bigint' ? Number(v) : undefined;\n\n/**\n * A Zod error as the wire shape. Use this on the server for every 400, and on\n * the client to treat its own errors and the server's the same way.\n *\n * `location` is stamped on every issue when given; the server always gives it.\n *\n * Copies a WHITELIST of fields (see the module note). A path segment that is a\n * symbol, which JSON cannot carry, becomes its description.\n */\nexport function toValidationIssues(\n error: { issues: readonly ZodIssueLike[] },\n location?: RequestPart,\n): ValidationIssue[] {\n return error.issues.map((issue) => {\n const out: ValidationIssue = {\n ...(location ? { location } : {}),\n path: issue.path.map((p) =>\n typeof p === 'number' ? p : typeof p === 'string' ? p : String(p.description ?? ''),\n ),\n code: issue.code,\n message: issue.message,\n };\n const minimum = toNumber(issue.minimum);\n const maximum = toNumber(issue.maximum);\n if (minimum !== undefined) out.minimum = minimum;\n if (maximum !== undefined) out.maximum = maximum;\n if (typeof issue.origin === 'string') out.origin = issue.origin;\n if (typeof issue.format === 'string') out.format = issue.format;\n return out;\n });\n}\n"]}
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;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AC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CACpF;YACD,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * founder-schema — How a validation failure is described, on both sides\n *\n * TWO RULES, and they are what let the web client show any error, its own or\n * the server's, on the right field in the member's language:\n *\n * 1. A CUSTOM MESSAGE IS A KEY, NEVER A SENTENCE. Where a schema needs its own\n * message (a refine, a regex), the message is one of `VALIDATION_MESSAGE`,\n * such as `phoneInvalid`. The client turns the key into text in English or\n * Hindi. Before 0.2.0 these were English sentences, so a Hindi screen showed\n * an English error, and a client that wanted to translate one had to match\n * on the wording.\n *\n * Plain bounds carry NO custom message. `.min(1)` and `.max(80)` produce\n * Zod's own `too_small` / `too_big` issues, which already say which bound\n * and what it was (`minimum`, `maximum`, `origin`), and the client words\n * them from those. A hand-written \"at most 80 characters\" would only\n * restate the number in one language.\n *\n * 2. THE SERVER SENDS EVERY ISSUE, IN THIS SHAPE. A 400 answers with\n * `error.details.issues`, built by `toValidationIssues`, so the client can\n * put each one under its field. Until 0.2.0 the backend sent only the\n * first issue's message, with no path at all.\n *\n * ⚠️ `toValidationIssues` COPIES A WHITELIST OF FIELDS, it never spreads an\n * issue. Zod can carry the rejected `input` on an issue, and these bodies hold a\n * date of birth and a phone number. Echoing them into an error response sends\n * them back to the client, into logs and into any proxy in between. A test\n * proves `input` never survives.\n *\n * @module founder-schema/core/validation\n */\n\nimport { z } from 'zod';\n\n/**\n * Every custom message a schema in this package can produce. Each is a\n * translation key the clients define in every language they ship.\n *\n * ⚠️ Append only, and add the translation in the same change. Renaming one\n * shows the raw key to every member until each client ships the new name.\n */\nexport const VALIDATION_MESSAGE = {\n /** Not a 24-hex Mongo id. */\n invalidId: 'invalidId',\n /** Handle: wrong characters, or a dot in the wrong place. */\n usernameInvalid: 'usernameInvalid',\n /** Not a 10-digit Indian mobile number. */\n phoneInvalid: 'phoneInvalid',\n /** Not a `YYYY-MM-DD` date. */\n dateInvalid: 'dateInvalid',\n /** A date that does not exist, such as 30 February. */\n dobInvalid: 'dobInvalid',\n /** Under the minimum age. */\n dobUnderAge: 'dobUnderAge',\n /** Over the sanity ceiling: almost always a mistyped year. */\n dobTooOld: 'dobTooOld',\n /** A founding year after this year. */\n foundedYearFuture: 'foundedYearFuture',\n /** A request body over the server's size limit (0.18.0: it answered in English). On `body`. */\n bodyTooLarge: 'bodyTooLarge',\n /** A request body that is not valid JSON (0.18.0: it answered in English). On `body`. */\n bodyNotJson: 'bodyNotJson',\n /** The same option twice in one vote (0.18.0). */\n pollVoteDuplicate: 'pollVoteDuplicate',\n /** The same uploaded image attached twice to one post. */\n mediaDuplicate: 'mediaDuplicate',\n /** A post with neither text nor media. */\n postEmpty: 'postEmpty',\n /** Two poll options with the same label. */\n pollOptionsDuplicate: 'pollOptionsDuplicate',\n /** An empty string sent to clear a patch field; clearing is `null`. */\n clearWithNull: 'clearWithNull',\n /** Not a plain http(s) URL on a real domain (`javascript:`, `localhost`, an IP...). */\n urlInvalid: 'urlInvalid',\n /** A handle this product keeps for itself (`admin`, `support`...). */\n usernameReserved: 'usernameReserved',\n /** Agreed to a version of the guidelines that is not the current one. */\n guidelinesOutdated: 'guidelinesOutdated',\n /** An MPIN that is not exactly six digits. */\n mpinInvalid: 'mpinInvalid',\n /** The MPIN and its confirmation differ. */\n mpinMismatch: 'mpinMismatch',\n /** Switching to a staff role without the MPIN. */\n mpinRequired: 'mpinRequired',\n /** The same role twice in one list. */\n rolesDuplicate: 'rolesDuplicate',\n /** An ask (\"testers wanted\") on a post or poll that names no product. */\n askWithoutProduct: 'askWithoutProduct',\n /** An App Store link that is not on apps.apple.com. */\n appStoreLinkHost: 'appStoreLinkHost',\n /** A Play Store link that is not on play.google.com. */\n playStoreLinkHost: 'playStoreLinkHost',\n /** A GitHub link that is not on github.com. */\n githubLinkHost: 'githubLinkHost',\n /** A demo video that is not a YouTube link. Video is shared, never uploaded. */\n videoLinkHost: 'videoLinkHost',\n /** The same screenshot twice in one gallery. */\n screenshotsDuplicate: 'screenshotsDuplicate',\n /** The same platform twice in one list. */\n platformsDuplicate: 'platformsDuplicate',\n /** The same topic twice in one list (0.9.0). */\n topicsDuplicate: 'topicsDuplicate',\n /** A post or poll in a community naming a product or an ask (0.9.0): community content carries neither. */\n communityWithProduct: 'communityWithProduct',\n /** The same capability twice in one list (0.9.0). */\n capabilitiesDuplicate: 'capabilitiesDuplicate',\n /** Not a GSTIN: 15 characters in its pattern, with a check character that adds up (0.12.0). */\n gstinInvalid: 'gstinInvalid',\n /** A GSTIN registered in another state than the one chosen: the state is the GSTIN's own (0.12.0). */\n gstinStateMismatch: 'gstinStateMismatch',\n /** A GSTIN without the legal name and address a B2B invoice must carry (0.12.0). */\n gstinNeedsNameAndAddress: 'gstinNeedsNameAndAddress',\n /** A coupon code with characters other than letters, digits and hyphens (0.12.0). */\n couponCodeInvalid: 'couponCodeInvalid',\n /** A coupon window that ends before it starts (0.12.0). */\n couponWindowInvalid: 'couponWindowInvalid',\n /** The same item twice in a coupon's list of what it applies to (0.12.0). */\n couponTargetsDuplicate: 'couponTargetsDuplicate',\n /** A paid purchase without the buyer's state: the invoice's place of supply (0.12.0). */\n billingStateRequired: 'billingStateRequired',\n /**\n * The guidelines not agreed to at all: the tick box left empty (0.17.0).\n * Distinct from `guidelinesOutdated`, which is agreement to an OLDER text;\n * \"the guidelines have changed\" is the wrong thing to tell someone who has\n * not ticked the box yet.\n */\n guidelinesRequired: 'guidelinesRequired',\n /**\n * The photo cannot be used (0.17.0): it is not the member's processed avatar\n * upload any more, most often because it expired before it was saved. Sent\n * by the server on the photo field with `UPLOAD_NOT_ATTACHABLE`.\n */\n photoUnavailable: 'photoUnavailable',\n /** A business type or registration with no business to describe (0.17.0). */\n ventureRequired: 'ventureRequired',\n /** A state that is not one of India's states and union territories (0.17.0). */\n stateUnknown: 'stateUnknown',\n /** The same goal twice in one list (0.17.0). */\n goalsDuplicate: 'goalsDuplicate',\n /** The same skill twice in one list (0.17.0). */\n skillsDuplicate: 'skillsDuplicate',\n /**\n * A location with no state (0.17.0): India's places are chosen state first.\n * Its own key, so the refusal does not carry all 36 names as its message.\n */\n stateRequired: 'stateRequired',\n /** A location picked without its district (0.19.0: state, district, then locality). */\n districtRequired: 'districtRequired',\n /**\n * A pick that does not say its locality: a locality's id, or `null` for the\n * whole district (0.19.0). Worded as the choice it is.\n */\n localityRequired: 'localityRequired',\n /**\n * An area id the tree does not have, or not where the pick puts it (a\n * district outside the chosen state, a locality outside the district):\n * \"choose it again\" (0.19.0).\n */\n areaNotListed: 'areaNotListed',\n} as const;\nexport type ValidationMessageKey = (typeof VALIDATION_MESSAGE)[keyof typeof VALIDATION_MESSAGE];\n\n/**\n * Which part of the request an issue is about.\n *\n * ONE PATH CONVENTION: `path` is ALWAYS relative to this part, so a body field\n * reads `['venture', 'name']` with `location: 'body'`, never\n * `['body', 'venture', 'name']`. A form maps body issues straight onto its\n * fields without stripping a prefix, and a client that sees `query` or\n * `params` knows the problem is the URL, not anything the member typed.\n */\nexport const REQUEST_PART_VALUES = ['body', 'query', 'params'] as const;\nexport const requestPartSchema = z.enum(REQUEST_PART_VALUES);\nexport type RequestPart = z.infer<typeof requestPartSchema>;\n\n/**\n * One problem with one field, as it crosses the wire.\n *\n * `code` is Zod's issue code (`too_small`, `too_big`, `invalid_type`,\n * `invalid_format`, `custom`...). `message` is either one of\n * `VALIDATION_MESSAGE` or, for a plain bound, Zod's own English text, which the\n * client ignores in favour of `code` plus `minimum` / `maximum`.\n */\nexport const validationIssueSchema = z.object({\n /** Set by the server on every issue it sends; absent on a client's own parse. */\n location: requestPartSchema.optional(),\n /**\n * Where the problem is, RELATIVE TO `location`: `['venture', 'name']`,\n * `['options', 2, 'label']`, `['contentId']`.\n */\n path: z.array(z.union([z.string(), z.number()])),\n code: z.string(),\n message: z.string(),\n /** `too_small`: the bound that was missed. */\n minimum: z.number().optional(),\n /** `too_big`: the bound that was passed. */\n maximum: z.number().optional(),\n /** What was measured: `string`, `array`, `number`... */\n origin: z.string().optional(),\n /** `invalid_format`: which format, e.g. `url`, `regex`, `email`. */\n format: z.string().optional(),\n});\nexport type ValidationIssue = z.infer<typeof validationIssueSchema>;\n\n/** The loosest shape this needs from a Zod issue, so it works across 4.x. */\ninterface ZodIssueLike {\n path: readonly PropertyKey[];\n code: string;\n message: string;\n minimum?: unknown;\n maximum?: unknown;\n origin?: unknown;\n format?: unknown;\n}\n\nconst toNumber = (v: unknown): number | undefined =>\n typeof v === 'number' ? v : typeof v === 'bigint' ? Number(v) : undefined;\n\n/**\n * A Zod error as the wire shape. Use this on the server for every 400, and on\n * the client to treat its own errors and the server's the same way.\n *\n * `location` is stamped on every issue when given; the server always gives it.\n *\n * Copies a WHITELIST of fields (see the module note). A path segment that is a\n * symbol, which JSON cannot carry, becomes its description.\n */\nexport function toValidationIssues(\n error: { issues: readonly ZodIssueLike[] },\n location?: RequestPart,\n): ValidationIssue[] {\n return error.issues.map((issue) => {\n const out: ValidationIssue = {\n ...(location ? { location } : {}),\n path: issue.path.map((p) =>\n typeof p === 'number' ? p : typeof p === 'string' ? p : String(p.description ?? ''),\n ),\n code: issue.code,\n message: issue.message,\n };\n const minimum = toNumber(issue.minimum);\n const maximum = toNumber(issue.maximum);\n if (minimum !== undefined) out.minimum = minimum;\n if (maximum !== undefined) out.maximum = maximum;\n if (typeof issue.origin === 'string') out.origin = issue.origin;\n if (typeof issue.format === 'string') out.format = issue.format;\n return out;\n });\n}\n"]}
@@ -57,9 +57,13 @@ export type AuditAction = z.infer<typeof auditActionSchema>;
57
57
  * community they run, who is not staff.
58
58
  */
59
59
  export declare const auditActorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
- kind: z.ZodLiteral<"staff">;
61
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
60
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
61
+ username: z.ZodNullable<z.ZodString>;
62
62
  displayName: z.ZodString;
63
+ firstName: z.ZodString;
64
+ avatarUrl: z.ZodNullable<z.ZodURL>;
65
+ former: z.ZodBoolean;
66
+ kind: z.ZodLiteral<"staff">;
63
67
  actingAs: z.ZodEnum<{
64
68
  moderator: "moderator";
65
69
  superadmin: "superadmin";
@@ -71,17 +75,25 @@ export declare const auditActorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
75
  kind: z.ZodLiteral<"script">;
72
76
  name: z.ZodString;
73
77
  }, z.core.$strip>, z.ZodObject<{
74
- kind: z.ZodLiteral<"member">;
75
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
78
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
79
+ username: z.ZodNullable<z.ZodString>;
76
80
  displayName: z.ZodString;
81
+ firstName: z.ZodString;
82
+ avatarUrl: z.ZodNullable<z.ZodURL>;
83
+ former: z.ZodBoolean;
84
+ kind: z.ZodLiteral<"member">;
77
85
  }, z.core.$strip>], "kind">;
78
86
  export type AuditActor = z.infer<typeof auditActorSchema>;
79
87
  export declare const auditEntrySchema: z.ZodObject<{
80
88
  id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
81
89
  actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
82
- kind: z.ZodLiteral<"staff">;
83
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
90
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
91
+ username: z.ZodNullable<z.ZodString>;
84
92
  displayName: z.ZodString;
93
+ firstName: z.ZodString;
94
+ avatarUrl: z.ZodNullable<z.ZodURL>;
95
+ former: z.ZodBoolean;
96
+ kind: z.ZodLiteral<"staff">;
85
97
  actingAs: z.ZodEnum<{
86
98
  moderator: "moderator";
87
99
  superadmin: "superadmin";
@@ -93,9 +105,13 @@ export declare const auditEntrySchema: z.ZodObject<{
93
105
  kind: z.ZodLiteral<"script">;
94
106
  name: z.ZodString;
95
107
  }, z.core.$strip>, z.ZodObject<{
96
- kind: z.ZodLiteral<"member">;
97
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
108
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
109
+ username: z.ZodNullable<z.ZodString>;
98
110
  displayName: z.ZodString;
111
+ firstName: z.ZodString;
112
+ avatarUrl: z.ZodNullable<z.ZodURL>;
113
+ former: z.ZodBoolean;
114
+ kind: z.ZodLiteral<"member">;
99
115
  }, z.core.$strip>], "kind">;
100
116
  action: z.ZodEnum<{
101
117
  "role.granted": "role.granted";
@@ -158,9 +174,13 @@ export declare const auditPageSchema: z.ZodObject<{
158
174
  items: z.ZodArray<z.ZodObject<{
159
175
  id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
160
176
  actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
161
- kind: z.ZodLiteral<"staff">;
162
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
177
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
178
+ username: z.ZodNullable<z.ZodString>;
163
179
  displayName: z.ZodString;
180
+ firstName: z.ZodString;
181
+ avatarUrl: z.ZodNullable<z.ZodURL>;
182
+ former: z.ZodBoolean;
183
+ kind: z.ZodLiteral<"staff">;
164
184
  actingAs: z.ZodEnum<{
165
185
  moderator: "moderator";
166
186
  superadmin: "superadmin";
@@ -172,9 +192,13 @@ export declare const auditPageSchema: z.ZodObject<{
172
192
  kind: z.ZodLiteral<"script">;
173
193
  name: z.ZodString;
174
194
  }, z.core.$strip>, z.ZodObject<{
175
- kind: z.ZodLiteral<"member">;
176
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
195
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
196
+ username: z.ZodNullable<z.ZodString>;
177
197
  displayName: z.ZodString;
198
+ firstName: z.ZodString;
199
+ avatarUrl: z.ZodNullable<z.ZodURL>;
200
+ former: z.ZodBoolean;
201
+ kind: z.ZodLiteral<"member">;
178
202
  }, z.core.$strip>], "kind">;
179
203
  action: z.ZodEnum<{
180
204
  "role.granted": "role.granted";
@@ -1 +1 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB,ohBAmEtB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;2BAyB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;iBAAoC,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -26,6 +26,7 @@ import { subjectSchema } from '../../access/permissions.js';
26
26
  import { roleSchema } from '../../access/roles.js';
27
27
  import { objectIdSchema } from '../../core/common.js';
28
28
  import { paginatedSchema } from '../../core/responses.js';
29
+ import { personSchema } from '../people/person.js';
29
30
  export const AUDIT_ACTION_VALUES = [
30
31
  /** A platform role was granted. `detail.role`. */
31
32
  'role.granted',
@@ -101,11 +102,13 @@ export const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);
101
102
  * community they run, who is not staff.
102
103
  */
103
104
  export const auditActorSchema = z.discriminatedUnion('kind', [
104
- z.object({
105
+ /**
106
+ * The person (0.20.0, `personSchema`). ⚠ `displayName` and `firstName` are
107
+ * their name WHEN THEY DID IT: an entry is a record, so it is not renamed
108
+ * later. The picture and handle are live, and empty once the account is gone.
109
+ */
110
+ personSchema.extend({
105
111
  kind: z.literal('staff'),
106
- id: objectIdSchema,
107
- /** Their name when they did it. An entry is a record, so it is not renamed later. */
108
- displayName: z.string(),
109
112
  /** The role they were acting as. */
110
113
  actingAs: roleSchema,
111
114
  }),
@@ -119,12 +122,8 @@ export const auditActorSchema = z.discriminatedUnion('kind', [
119
122
  * its type, say. Its own kind, so nobody reading the log mistakes a
120
123
  * community admin for staff.
121
124
  */
122
- z.object({
123
- kind: z.literal('member'),
124
- id: objectIdSchema,
125
- /** Their name when they did it. */
126
- displayName: z.string(),
127
- }),
125
+ /** The person; their name as it was when they did it, like `staff`. */
126
+ personSchema.extend({ kind: z.literal('member') }),
128
127
  ]);
129
128
  export const auditEntrySchema = z.object({
130
129
  id: objectIdSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAA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sourcesContent":["/**\n * founder-schema: the audit log\n *\n * GET /api/v1/audit staff actions, newest first\n *\n * Every action a staff member takes on a MEMBER or on what a member wrote\n * (roles, MPIN resets, suspensions, moderation decisions, taking and closing\n * tickets) is written here, at the moment it happens, by the server: who did\n * it, AS WHICH ROLE, what they did, to what, and anything that explains it.\n * The support team's own library (saved replies) is not a member's, so its\n * edits are not entries. Entries are never edited or\n * deleted. It is how a dispute (\"who removed my post, and why\") gets an\n * answer, and how a misused staff account is noticed.\n *\n * WHO READS WHAT is the reader's permissions, applied to the query: a\n * superadmin reads every entry; any other staff role reads the entries it\n * wrote itself (its History).\n *\n * The action list grows with the staff features; it never shrinks, because an\n * old entry must still parse.\n *\n * @module founder-schema/domains/audit\n */\n\nimport { z } from 'zod';\nimport { subjectSchema } from '../../access/permissions.js';\nimport { roleSchema } from '../../access/roles.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\n\nexport const AUDIT_ACTION_VALUES = [\n /** A platform role was granted. `detail.role`. */\n 'role.granted',\n /** A platform role was taken away. `detail.role`. */\n 'role.revoked',\n /** Someone's forgotten MPIN was cleared, so they can set a new one. */\n 'mpin.cleared',\n /** Staff removed someone else's post, poll, comment or review (`target.subject` says which). */\n 'content.removed',\n /**\n * Staff hid a post, poll, comment, product or review: out of every feed and\n * list, restorable. `detail.note`. Since 0.9.0 also a community's\n * moderators hiding a post, poll or comment in it (actor kind `member`, or\n * staff), with `detail.communityId`.\n */\n 'content.hidden',\n /** Hidden content (a product or review too) put back, by staff or (0.9.0) a community's moderators. */\n 'content.restored',\n /** Staff looked at what was reported and left it up. `detail.reports`: how many closed. */\n 'report.dismissed',\n /** A member was suspended from the product. `detail.reason`. */\n 'member.suspended',\n /** A suspension was lifted. */\n 'member.unsuspended',\n /** A support agent took a ticket. */\n 'ticket.claimed',\n /** A support agent closed a ticket as resolved. */\n 'ticket.resolved',\n /** A capability was granted (0.9.0). `detail.capability`. */\n 'capability.granted',\n /** A capability was taken away (0.9.0). `detail.capability`. */\n 'capability.revoked',\n /** A community was created (0.9.0). `detail.visibility`; `detail.suggestionId` when from a suggestion. */\n 'community.created',\n /** A community's type changed (0.9.0). `detail.from`, `detail.to`, `detail.exposed`. */\n 'community.visibility_changed',\n /** Staff archived a community (0.9.0). */\n 'community.archived',\n /** Staff restored an archived community (0.9.0). */\n 'community.restored',\n /** Staff deleted a community (0.9.0). */\n 'community.deleted',\n /** Staff declined a community suggestion (0.9.0). `detail.reason`. Approving is `community.created`. */\n 'community_suggestion.declined',\n /**\n * A community was left with no admin (0.9.0): its last admin's account was\n * deleted where that cannot be refused. Written by the deletion (actor\n * kind `script`); managers then make a member admin.\n */\n 'community.orphaned',\n /** Staff gave someone a membership (0.12.0). `detail.reason`. Target subject `Membership`. */\n 'membership.granted',\n /**\n * Staff took a founding, coupon or granted membership away (0.12.0): a fake\n * or duplicate account. `detail.reason`, `detail.kind`. A paid one is\n * refunded instead (`payment.refunded`).\n */\n 'membership.revoked',\n /**\n * Staff refunded a payment (0.12.0). `detail.reason`, `detail.amount`\n * (paise), `detail.item`. Target subject `Payment`.\n */\n 'payment.refunded',\n /** Staff created a coupon (0.12.0). `detail.code`, `detail.benefit`, `detail.max`. */\n 'coupon.created',\n /** Staff changed a coupon (0.12.0): switched it off or on, its cap, window or label. `detail.changes`. */\n 'coupon.updated',\n] as const;\nexport const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);\nexport type AuditAction = z.infer<typeof auditActionSchema>;\n\n/**\n * Who did it. A person, acting as one of their roles; a server script, which\n * is the only way a superadmin is ever made; or (0.9.0) a member acting in a\n * community they run, who is not staff.\n */\nexport const auditActorSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('staff'),\n id: objectIdSchema,\n /** Their name when they did it. An entry is a record, so it is not renamed later. */\n displayName: z.string(),\n /** The role they were acting as. */\n actingAs: roleSchema,\n }),\n z.object({\n kind: z.literal('script'),\n /** Which script, e.g. `grant-superadmin`. */\n name: z.string(),\n }),\n /**\n * A member who is not acting as staff (0.9.0): a community's admin changing\n * its type, say. Its own kind, so nobody reading the log mistakes a\n * community admin for staff.\n */\n z.object({\n kind: z.literal('member'),\n id: objectIdSchema,\n /** Their name when they did it. */\n displayName: z.string(),\n }),\n]);\nexport type AuditActor = z.infer<typeof auditActorSchema>;\n\nexport const auditEntrySchema = z.object({\n id: objectIdSchema,\n actor: auditActorSchema,\n action: auditActionSchema,\n /** What it was done to. `label` is its name at the time, when it has one. */\n target: z.object({ subject: subjectSchema, id: objectIdSchema, label: z.string().nullable() }),\n /** The specifics, by action (the role granted, a reason given). Never a secret. */\n detail: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),\n at: z.iso.datetime(),\n});\nexport type AuditEntry = z.infer<typeof auditEntrySchema>;\n\nexport const auditPageSchema = paginatedSchema(auditEntrySchema);\nexport type AuditPage = z.infer<typeof auditPageSchema>;\n"]}
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kDAAkD;IAClD,cAAc;IACd,qDAAqD;IACrD,cAAc;IACd,uEAAuE;IACvE,cAAc;IACd,gGAAgG;IAChG,iBAAiB;IACjB;;;;;OAKG;IACH,gBAAgB;IAChB,uGAAuG;IACvG,kBAAkB;IAClB,2FAA2F;IAC3F,kBAAkB;IAClB,gEAAgE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c;IAClB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,iBAAiB;IACzB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9F,mFAAmF;IACnF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtF,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CACrB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: the audit log\n *\n * GET /api/v1/audit staff actions, newest first\n *\n * Every action a staff member takes on a MEMBER or on what a member wrote\n * (roles, MPIN resets, suspensions, moderation decisions, taking and closing\n * tickets) is written here, at the moment it happens, by the server: who did\n * it, AS WHICH ROLE, what they did, to what, and anything that explains it.\n * The support team's own library (saved replies) is not a member's, so its\n * edits are not entries. Entries are never edited or\n * deleted. It is how a dispute (\"who removed my post, and why\") gets an\n * answer, and how a misused staff account is noticed.\n *\n * WHO READS WHAT is the reader's permissions, applied to the query: a\n * superadmin reads every entry; any other staff role reads the entries it\n * wrote itself (its History).\n *\n * The action list grows with the staff features; it never shrinks, because an\n * old entry must still parse.\n *\n * @module founder-schema/domains/audit\n */\n\nimport { z } from 'zod';\nimport { subjectSchema } from '../../access/permissions.js';\nimport { roleSchema } from '../../access/roles.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { personSchema } from '../people/person.js';\n\nexport const AUDIT_ACTION_VALUES = [\n /** A platform role was granted. `detail.role`. */\n 'role.granted',\n /** A platform role was taken away. `detail.role`. */\n 'role.revoked',\n /** Someone's forgotten MPIN was cleared, so they can set a new one. */\n 'mpin.cleared',\n /** Staff removed someone else's post, poll, comment or review (`target.subject` says which). */\n 'content.removed',\n /**\n * Staff hid a post, poll, comment, product or review: out of every feed and\n * list, restorable. `detail.note`. Since 0.9.0 also a community's\n * moderators hiding a post, poll or comment in it (actor kind `member`, or\n * staff), with `detail.communityId`.\n */\n 'content.hidden',\n /** Hidden content (a product or review too) put back, by staff or (0.9.0) a community's moderators. */\n 'content.restored',\n /** Staff looked at what was reported and left it up. `detail.reports`: how many closed. */\n 'report.dismissed',\n /** A member was suspended from the product. `detail.reason`. */\n 'member.suspended',\n /** A suspension was lifted. */\n 'member.unsuspended',\n /** A support agent took a ticket. */\n 'ticket.claimed',\n /** A support agent closed a ticket as resolved. */\n 'ticket.resolved',\n /** A capability was granted (0.9.0). `detail.capability`. */\n 'capability.granted',\n /** A capability was taken away (0.9.0). `detail.capability`. */\n 'capability.revoked',\n /** A community was created (0.9.0). `detail.visibility`; `detail.suggestionId` when from a suggestion. */\n 'community.created',\n /** A community's type changed (0.9.0). `detail.from`, `detail.to`, `detail.exposed`. */\n 'community.visibility_changed',\n /** Staff archived a community (0.9.0). */\n 'community.archived',\n /** Staff restored an archived community (0.9.0). */\n 'community.restored',\n /** Staff deleted a community (0.9.0). */\n 'community.deleted',\n /** Staff declined a community suggestion (0.9.0). `detail.reason`. Approving is `community.created`. */\n 'community_suggestion.declined',\n /**\n * A community was left with no admin (0.9.0): its last admin's account was\n * deleted where that cannot be refused. Written by the deletion (actor\n * kind `script`); managers then make a member admin.\n */\n 'community.orphaned',\n /** Staff gave someone a membership (0.12.0). `detail.reason`. Target subject `Membership`. */\n 'membership.granted',\n /**\n * Staff took a founding, coupon or granted membership away (0.12.0): a fake\n * or duplicate account. `detail.reason`, `detail.kind`. A paid one is\n * refunded instead (`payment.refunded`).\n */\n 'membership.revoked',\n /**\n * Staff refunded a payment (0.12.0). `detail.reason`, `detail.amount`\n * (paise), `detail.item`. Target subject `Payment`.\n */\n 'payment.refunded',\n /** Staff created a coupon (0.12.0). `detail.code`, `detail.benefit`, `detail.max`. */\n 'coupon.created',\n /** Staff changed a coupon (0.12.0): switched it off or on, its cap, window or label. `detail.changes`. */\n 'coupon.updated',\n] as const;\nexport const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);\nexport type AuditAction = z.infer<typeof auditActionSchema>;\n\n/**\n * Who did it. A person, acting as one of their roles; a server script, which\n * is the only way a superadmin is ever made; or (0.9.0) a member acting in a\n * community they run, who is not staff.\n */\nexport const auditActorSchema = z.discriminatedUnion('kind', [\n /**\n * The person (0.20.0, `personSchema`). ⚠ `displayName` and `firstName` are\n * their name WHEN THEY DID IT: an entry is a record, so it is not renamed\n * later. The picture and handle are live, and empty once the account is gone.\n */\n personSchema.extend({\n kind: z.literal('staff'),\n /** The role they were acting as. */\n actingAs: roleSchema,\n }),\n z.object({\n kind: z.literal('script'),\n /** Which script, e.g. `grant-superadmin`. */\n name: z.string(),\n }),\n /**\n * A member who is not acting as staff (0.9.0): a community's admin changing\n * its type, say. Its own kind, so nobody reading the log mistakes a\n * community admin for staff.\n */\n /** The person; their name as it was when they did it, like `staff`. */\n personSchema.extend({ kind: z.literal('member') }),\n]);\nexport type AuditActor = z.infer<typeof auditActorSchema>;\n\nexport const auditEntrySchema = z.object({\n id: objectIdSchema,\n actor: auditActorSchema,\n action: auditActionSchema,\n /** What it was done to. `label` is its name at the time, when it has one. */\n target: z.object({ subject: subjectSchema, id: objectIdSchema, label: z.string().nullable() }),\n /** The specifics, by action (the role granted, a reason given). Never a secret. */\n detail: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),\n at: z.iso.datetime(),\n});\nexport type AuditEntry = z.infer<typeof auditEntrySchema>;\n\nexport const auditPageSchema = paginatedSchema(auditEntrySchema);\nexport type AuditPage = z.infer<typeof auditPageSchema>;\n"]}
@@ -241,11 +241,11 @@ export type Quote = z.infer<typeof quoteSchema>;
241
241
  export declare const ORDER_STATUS_VALUES: readonly ["created", "paid", "granted_free", "expired", "refund_pending", "refunded", "refund_failed"];
242
242
  export declare const orderStatusSchema: z.ZodEnum<{
243
243
  paid: "paid";
244
+ refunded: "refunded";
244
245
  created: "created";
245
246
  granted_free: "granted_free";
246
247
  expired: "expired";
247
248
  refund_pending: "refund_pending";
248
- refunded: "refunded";
249
249
  refund_failed: "refund_failed";
250
250
  }>;
251
251
  export type OrderStatus = z.infer<typeof orderStatusSchema>;
@@ -375,11 +375,11 @@ export declare const orderStateSchema: z.ZodObject<{
375
375
  }, z.core.$strip>], "kind">;
376
376
  status: z.ZodEnum<{
377
377
  paid: "paid";
378
+ refunded: "refunded";
378
379
  created: "created";
379
380
  granted_free: "granted_free";
380
381
  expired: "expired";
381
382
  refund_pending: "refund_pending";
382
- refunded: "refunded";
383
383
  refund_failed: "refund_failed";
384
384
  }>;
385
385
  notApplied: z.ZodBoolean;
@@ -586,11 +586,11 @@ export declare const paymentSummarySchema: z.ZodObject<{
586
586
  total: z.ZodNumber;
587
587
  status: z.ZodEnum<{
588
588
  paid: "paid";
589
+ refunded: "refunded";
589
590
  created: "created";
590
591
  granted_free: "granted_free";
591
592
  expired: "expired";
592
593
  refund_pending: "refund_pending";
593
- refunded: "refunded";
594
594
  refund_failed: "refund_failed";
595
595
  }>;
596
596
  paidAt: z.ZodISODateTime;
@@ -620,11 +620,11 @@ export declare const paymentPageSchema: z.ZodObject<{
620
620
  total: z.ZodNumber;
621
621
  status: z.ZodEnum<{
622
622
  paid: "paid";
623
+ refunded: "refunded";
623
624
  created: "created";
624
625
  granted_free: "granted_free";
625
626
  expired: "expired";
626
627
  refund_pending: "refund_pending";
627
- refunded: "refunded";
628
628
  refund_failed: "refund_failed";
629
629
  }>;
630
630
  paidAt: z.ZodISODateTime;
@@ -655,11 +655,11 @@ export declare const paymentDetailSchema: z.ZodObject<{
655
655
  total: z.ZodNumber;
656
656
  status: z.ZodEnum<{
657
657
  paid: "paid";
658
+ refunded: "refunded";
658
659
  created: "created";
659
660
  granted_free: "granted_free";
660
661
  expired: "expired";
661
662
  refund_pending: "refund_pending";
662
- refunded: "refunded";
663
663
  refund_failed: "refund_failed";
664
664
  }>;
665
665
  paidAt: z.ZodISODateTime;
@@ -798,8 +798,12 @@ export declare const paymentDetailSchema: z.ZodObject<{
798
798
  export type PaymentDetail = z.infer<typeof paymentDetailSchema>;
799
799
  /** Who paid, as they are now, so staff can find them. Email only for a role that may read it. */
800
800
  export declare const payerSchema: z.ZodObject<{
801
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
801
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
802
+ username: z.ZodNullable<z.ZodString>;
802
803
  displayName: z.ZodString;
804
+ firstName: z.ZodString;
805
+ avatarUrl: z.ZodNullable<z.ZodURL>;
806
+ former: z.ZodBoolean;
803
807
  email: z.ZodNullable<z.ZodString>;
804
808
  }, z.core.$strip>;
805
809
  export type Payer = z.infer<typeof payerSchema>;
@@ -808,11 +812,11 @@ export declare const staffPaymentsQuerySchema: z.ZodObject<{
808
812
  cursor: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
809
813
  status: z.ZodOptional<z.ZodEnum<{
810
814
  paid: "paid";
815
+ refunded: "refunded";
811
816
  created: "created";
812
817
  granted_free: "granted_free";
813
818
  expired: "expired";
814
819
  refund_pending: "refund_pending";
815
- refunded: "refunded";
816
820
  refund_failed: "refund_failed";
817
821
  }>>;
818
822
  memberId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
@@ -841,19 +845,23 @@ export declare const staffPaymentSummarySchema: z.ZodObject<{
841
845
  total: z.ZodNumber;
842
846
  status: z.ZodEnum<{
843
847
  paid: "paid";
848
+ refunded: "refunded";
844
849
  created: "created";
845
850
  granted_free: "granted_free";
846
851
  expired: "expired";
847
852
  refund_pending: "refund_pending";
848
- refunded: "refunded";
849
853
  refund_failed: "refund_failed";
850
854
  }>;
851
855
  paidAt: z.ZodISODateTime;
852
856
  invoiceNumber: z.ZodNullable<z.ZodString>;
853
857
  refundableUntil: z.ZodNullable<z.ZodISODateTime>;
854
858
  payer: z.ZodObject<{
855
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
859
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
860
+ username: z.ZodNullable<z.ZodString>;
856
861
  displayName: z.ZodString;
862
+ firstName: z.ZodString;
863
+ avatarUrl: z.ZodNullable<z.ZodURL>;
864
+ former: z.ZodBoolean;
857
865
  email: z.ZodNullable<z.ZodString>;
858
866
  }, z.core.$strip>;
859
867
  needsAction: z.ZodBoolean;
@@ -881,19 +889,23 @@ export declare const staffPaymentPageSchema: z.ZodObject<{
881
889
  total: z.ZodNumber;
882
890
  status: z.ZodEnum<{
883
891
  paid: "paid";
892
+ refunded: "refunded";
884
893
  created: "created";
885
894
  granted_free: "granted_free";
886
895
  expired: "expired";
887
896
  refund_pending: "refund_pending";
888
- refunded: "refunded";
889
897
  refund_failed: "refund_failed";
890
898
  }>;
891
899
  paidAt: z.ZodISODateTime;
892
900
  invoiceNumber: z.ZodNullable<z.ZodString>;
893
901
  refundableUntil: z.ZodNullable<z.ZodISODateTime>;
894
902
  payer: z.ZodObject<{
895
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
903
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
904
+ username: z.ZodNullable<z.ZodString>;
896
905
  displayName: z.ZodString;
906
+ firstName: z.ZodString;
907
+ avatarUrl: z.ZodNullable<z.ZodURL>;
908
+ former: z.ZodBoolean;
897
909
  email: z.ZodNullable<z.ZodString>;
898
910
  }, z.core.$strip>;
899
911
  needsAction: z.ZodBoolean;
@@ -922,11 +934,11 @@ export declare const staffPaymentDetailSchema: z.ZodObject<{
922
934
  total: z.ZodNumber;
923
935
  status: z.ZodEnum<{
924
936
  paid: "paid";
937
+ refunded: "refunded";
925
938
  created: "created";
926
939
  granted_free: "granted_free";
927
940
  expired: "expired";
928
941
  refund_pending: "refund_pending";
929
- refunded: "refunded";
930
942
  refund_failed: "refund_failed";
931
943
  }>;
932
944
  paidAt: z.ZodISODateTime;
@@ -1062,8 +1074,12 @@ export declare const staffPaymentDetailSchema: z.ZodObject<{
1062
1074
  }, z.core.$strip>>;
1063
1075
  refundedAt: z.ZodNullable<z.ZodISODateTime>;
1064
1076
  payer: z.ZodObject<{
1065
- id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1077
+ userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1078
+ username: z.ZodNullable<z.ZodString>;
1066
1079
  displayName: z.ZodString;
1080
+ firstName: z.ZodString;
1081
+ avatarUrl: z.ZodNullable<z.ZodURL>;
1082
+ former: z.ZodBoolean;
1067
1083
  email: z.ZodNullable<z.ZodString>;
1068
1084
  }, z.core.$strip>;
1069
1085
  razorpay: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,KAAK,YAAY,EACjB,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC;AAIlB,4CAA4C;AAC5C,eAAO,MAAM,oBAAoB,4CAA6C,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;2BAI7B,C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eAAO,MAAM,kBAAkB;;iBAAyC,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAK9D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAS4D,CAAC;AAChG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;iBAQ4D,CAAC;AAChG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -39,6 +39,7 @@ import { BILLING_REASON_MAX, BILLING_REASON_MIN, COUPON_CODE_MAX, COUPON_CODE_MI
39
39
  import { paginatedSchema } from '../../core/responses.js';
40
40
  import { VALIDATION_MESSAGE } from '../../core/validation.js';
41
41
  import { paiseSchema, planPeriodSchema, planTierSchema } from '../membership/membership.js';
42
+ import { personSchema } from '../people/person.js';
42
43
  import { billingDetailsSchema, gstStateCodeSchema } from './gst.js';
43
44
  export { billingDetailsSchema, GST_RATE_PERCENT, GST_STATE_CODE_VALUES, GST_STATES, gstinChecksumValid, gstinSchema, gstStateCodeSchema, gstStateName, } from './gst.js';
44
45
  // ─── What can be bought ──────────────────────────────────────────────────────
@@ -285,9 +286,7 @@ export const paymentDetailSchema = paymentSummarySchema.extend({
285
286
  });
286
287
  // ─── Staff: payments and refunds ─────────────────────────────────────────────
287
288
  /** Who paid, as they are now, so staff can find them. Email only for a role that may read it. */
288
- export const payerSchema = z.object({
289
- id: objectIdSchema,
290
- displayName: z.string(),
289
+ export const payerSchema = personSchema.extend({
291
290
  email: z.string().nullable(),
292
291
  });
293
292
  export const staffPaymentsQuerySchema = paginationQuerySchema.extend({