founder-schema 0.19.0 → 0.21.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 (142) hide show
  1. package/README.md +46 -0
  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 +42 -15
  6. package/dist/core/common.d.ts.map +1 -1
  7. package/dist/core/common.js +58 -15
  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/domains/audit/audit.d.ts +36 -12
  14. package/dist/domains/audit/audit.d.ts.map +1 -1
  15. package/dist/domains/audit/audit.js +9 -10
  16. package/dist/domains/audit/audit.js.map +1 -1
  17. package/dist/domains/billing/billing.d.ts +29 -13
  18. package/dist/domains/billing/billing.d.ts.map +1 -1
  19. package/dist/domains/billing/billing.js +2 -3
  20. package/dist/domains/billing/billing.js.map +1 -1
  21. package/dist/domains/chat/chat.d.ts +19 -5
  22. package/dist/domains/chat/chat.d.ts.map +1 -1
  23. package/dist/domains/chat/chat.js +10 -10
  24. package/dist/domains/chat/chat.js.map +1 -1
  25. package/dist/domains/communities/communities.d.ts +95 -57
  26. package/dist/domains/communities/communities.d.ts.map +1 -1
  27. package/dist/domains/contributions/contributions.d.ts +28 -12
  28. package/dist/domains/contributions/contributions.d.ts.map +1 -1
  29. package/dist/domains/contributions/contributions.js +3 -0
  30. package/dist/domains/contributions/contributions.js.map +1 -1
  31. package/dist/domains/discover/discover.d.ts +2 -2
  32. package/dist/domains/feed/feed.d.ts +111 -63
  33. package/dist/domains/feed/feed.d.ts.map +1 -1
  34. package/dist/domains/feed/feed.js +3 -0
  35. package/dist/domains/feed/feed.js.map +1 -1
  36. package/dist/domains/location/areas.d.ts +7 -0
  37. package/dist/domains/location/areas.d.ts.map +1 -1
  38. package/dist/domains/location/areas.js +3 -0
  39. package/dist/domains/location/areas.js.map +1 -1
  40. package/dist/domains/media/media.d.ts +22 -0
  41. package/dist/domains/media/media.d.ts.map +1 -1
  42. package/dist/domains/media/media.js +20 -0
  43. package/dist/domains/media/media.js.map +1 -1
  44. package/dist/domains/members/members.d.ts +27 -9
  45. package/dist/domains/members/members.d.ts.map +1 -1
  46. package/dist/domains/members/members.js +9 -10
  47. package/dist/domains/members/members.js.map +1 -1
  48. package/dist/domains/membership/membership.d.ts +42 -1
  49. package/dist/domains/membership/membership.d.ts.map +1 -1
  50. package/dist/domains/membership/membership.js +42 -1
  51. package/dist/domains/membership/membership.js.map +1 -1
  52. package/dist/domains/moderation/moderation.d.ts +8 -2
  53. package/dist/domains/moderation/moderation.d.ts.map +1 -1
  54. package/dist/domains/moderation/moderation.js +3 -6
  55. package/dist/domains/moderation/moderation.js.map +1 -1
  56. package/dist/domains/notifications/notifications.d.ts +10 -6
  57. package/dist/domains/notifications/notifications.d.ts.map +1 -1
  58. package/dist/domains/onboarding/onboarding-answers.js +1 -1
  59. package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
  60. package/dist/domains/onboarding/onboarding.d.ts +11 -10
  61. package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
  62. package/dist/domains/onboarding/onboarding.js +16 -9
  63. package/dist/domains/onboarding/onboarding.js.map +1 -1
  64. package/dist/domains/people/person.d.ts +54 -0
  65. package/dist/domains/people/person.d.ts.map +1 -0
  66. package/dist/domains/people/person.js +73 -0
  67. package/dist/domains/people/person.js.map +1 -0
  68. package/dist/domains/products/products.d.ts +62 -33
  69. package/dist/domains/products/products.d.ts.map +1 -1
  70. package/dist/domains/products/products.js +3 -0
  71. package/dist/domains/products/products.js.map +1 -1
  72. package/dist/domains/profile/founder-profile.d.ts +36 -19
  73. package/dist/domains/profile/founder-profile.d.ts.map +1 -1
  74. package/dist/domains/profile/founder-profile.js +43 -21
  75. package/dist/domains/profile/founder-profile.js.map +1 -1
  76. package/dist/domains/reviews/reviews.d.ts +25 -15
  77. package/dist/domains/reviews/reviews.d.ts.map +1 -1
  78. package/dist/domains/support/support.d.ts +47 -10
  79. package/dist/domains/support/support.d.ts.map +1 -1
  80. package/dist/domains/support/support.js +4 -2
  81. package/dist/domains/support/support.js.map +1 -1
  82. package/dist/domains/team/team.d.ts +9 -3
  83. package/dist/domains/team/team.d.ts.map +1 -1
  84. package/dist/domains/team/team.js +3 -6
  85. package/dist/domains/team/team.js.map +1 -1
  86. package/dist/index.d.ts +11 -9
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +13 -9
  89. package/dist/index.js.map +1 -1
  90. package/package.json +3 -2
  91. package/dist/account.d.ts +0 -40
  92. package/dist/account.d.ts.map +0 -1
  93. package/dist/account.js +0 -39
  94. package/dist/account.js.map +0 -1
  95. package/dist/chat.d.ts +0 -187
  96. package/dist/chat.d.ts.map +0 -1
  97. package/dist/chat.js +0 -189
  98. package/dist/chat.js.map +0 -1
  99. package/dist/common.d.ts +0 -304
  100. package/dist/common.d.ts.map +0 -1
  101. package/dist/common.js +0 -340
  102. package/dist/common.js.map +0 -1
  103. package/dist/discover.d.ts +0 -245
  104. package/dist/discover.d.ts.map +0 -1
  105. package/dist/discover.js +0 -68
  106. package/dist/discover.js.map +0 -1
  107. package/dist/errors.d.ts +0 -85
  108. package/dist/errors.d.ts.map +0 -1
  109. package/dist/errors.js +0 -89
  110. package/dist/errors.js.map +0 -1
  111. package/dist/feed.d.ts +0 -1658
  112. package/dist/feed.d.ts.map +0 -1
  113. package/dist/feed.js +0 -623
  114. package/dist/feed.js.map +0 -1
  115. package/dist/founder-profile.d.ts +0 -387
  116. package/dist/founder-profile.d.ts.map +0 -1
  117. package/dist/founder-profile.js +0 -180
  118. package/dist/founder-profile.js.map +0 -1
  119. package/dist/limits.d.ts +0 -76
  120. package/dist/limits.d.ts.map +0 -1
  121. package/dist/limits.js +0 -84
  122. package/dist/limits.js.map +0 -1
  123. package/dist/onboarding.d.ts +0 -1018
  124. package/dist/onboarding.d.ts.map +0 -1
  125. package/dist/onboarding.js +0 -717
  126. package/dist/onboarding.js.map +0 -1
  127. package/dist/responses/common.d.ts +0 -167
  128. package/dist/responses/common.d.ts.map +0 -1
  129. package/dist/responses/common.js +0 -67
  130. package/dist/responses/common.js.map +0 -1
  131. package/dist/responses/index.d.ts +0 -7
  132. package/dist/responses/index.d.ts.map +0 -1
  133. package/dist/responses/index.js +0 -7
  134. package/dist/responses/index.js.map +0 -1
  135. package/dist/uploads.d.ts +0 -113
  136. package/dist/uploads.d.ts.map +0 -1
  137. package/dist/uploads.js +0 -106
  138. package/dist/uploads.js.map +0 -1
  139. package/dist/validation.d.ts +0 -136
  140. package/dist/validation.d.ts.map +0 -1
  141. package/dist/validation.js +0 -142
  142. package/dist/validation.js.map +0 -1
package/dist/discover.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * founder-schema — Discover search and filters
3
- *
4
- * Search is by name; the filters are industry, skill, startup stage and
5
- * location. The community surface the Discover tab will grow later is not
6
- * modelled yet.
7
- *
8
- * @module founder-schema/discover
9
- */
10
- import { z } from 'zod';
11
- import { industrySchema, optionalTrimmedString, paginationQuerySchema, skillSchema, startupStageSchema, } from './common.js';
12
- import { founderCardSchema } from './founder-profile.js';
13
- import { DISCOVER_FILTER_VALUES_MAX, DISCOVER_TEXT_MAX } from './limits.js';
14
- import { paginatedSchema } from './responses/common.js';
15
- /**
16
- * Accepts a repeated query param (`?skill=growth&skill=sales`) or a single
17
- * value, and always produces an array.
18
- *
19
- * Express gives `string` for one occurrence and `string[]` for several, so
20
- * without this the same URL shape parses two different ways.
21
- */
22
- const multiValue = (inner) => z.preprocess((value) => {
23
- if (value === undefined || value === null)
24
- return undefined;
25
- return Array.isArray(value) ? value : [value];
26
- }, z.array(inner).max(DISCOVER_FILTER_VALUES_MAX).optional());
27
- /**
28
- * Every free-text filter here is `optionalTrimmedString`, so an EMPTY one is
29
- * treated as "not provided" rather than as a validation failure.
30
- *
31
- * A search box the member has just cleared sends `?q=`, and a select they reset
32
- * sends `?city=`. Refusing those turns an ordinary interaction into a 400 with
33
- * nothing useful to show for it: the member asked for fewer filters, not for an
34
- * error. This is the one place the create-body rule and the patch-body rule
35
- * agree, because a query has nothing to erase.
36
- */
37
- export const discoverQuerySchema = paginationQuerySchema.extend({
38
- /** Free-text name search. Matched against display name and username. */
39
- q: optionalTrimmedString(DISCOVER_TEXT_MAX),
40
- industry: multiValue(industrySchema),
41
- skill: multiValue(skillSchema),
42
- stage: multiValue(startupStageSchema),
43
- city: optionalTrimmedString(DISCOVER_TEXT_MAX),
44
- country: optionalTrimmedString(DISCOVER_TEXT_MAX),
45
- });
46
- /** A page of founder cards, most recently updated first. */
47
- export const discoverPageSchema = paginatedSchema(founderCardSchema);
48
- /** One filter option and how many listed founders match it. */
49
- const facetOption = (value) => z.object({ value, count: z.number().int().nonnegative() });
50
- /**
51
- * The filter options the Discover drawer offers, with counts. The VALUES come
52
- * from the enums here, so the options cannot disagree with what the query
53
- * accepts.
54
- *
55
- * ⚠ NO LABELS. The value IS the translation key (`industries.<value>`,
56
- * `stages.<value>`, `skills.<value>`), and a client words it in the member's
57
- * language. Until 0.2.0 the server also sent an English `label` per option,
58
- * built by capitalising the value ("Ai ml"), which no client read and which
59
- * would have been wrong in Hindi if one had. Cities are member-typed place
60
- * names, so their value is shown as it is.
61
- */
62
- export const discoverFacetsSchema = z.object({
63
- industries: z.array(facetOption(industrySchema)),
64
- skills: z.array(facetOption(skillSchema)),
65
- stages: z.array(facetOption(startupStageSchema)),
66
- cities: z.array(facetOption(z.string())),
67
- });
68
- //# sourceMappingURL=discover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAsB,KAAQ,EAAE,EAAE,CACnD,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEhE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC9D,wEAAwE;IACxE,CAAC,EAAE,qBAAqB,CAAC,iBAAiB,CAAC;IAC3C,QAAQ,EAAE,UAAU,CAAC,cAAc,CAAC;IACpC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC,kBAAkB,CAAC;IACrC,IAAI,EAAE,qBAAqB,CAAC,iBAAiB,CAAC;IAC9C,OAAO,EAAE,qBAAqB,CAAC,iBAAiB,CAAC;CAClD,CAAC,CAAC;AAIH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAGrE,+DAA+D;AAC/D,MAAM,WAAW,GAAG,CAAsB,KAAQ,EAAE,EAAE,CACpD,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — Discover search and filters\n *\n * Search is by name; the filters are industry, skill, startup stage and\n * location. The community surface the Discover tab will grow later is not\n * modelled yet.\n *\n * @module founder-schema/discover\n */\n\nimport { z } from 'zod';\nimport {\n industrySchema,\n optionalTrimmedString,\n paginationQuerySchema,\n skillSchema,\n startupStageSchema,\n} from './common.js';\nimport { founderCardSchema } from './founder-profile.js';\nimport { DISCOVER_FILTER_VALUES_MAX, DISCOVER_TEXT_MAX } from './limits.js';\nimport { paginatedSchema } from './responses/common.js';\n\n/**\n * Accepts a repeated query param (`?skill=growth&skill=sales`) or a single\n * value, and always produces an array.\n *\n * Express gives `string` for one occurrence and `string[]` for several, so\n * without this the same URL shape parses two different ways.\n */\nconst multiValue = <T extends z.ZodType>(inner: T) =>\n z.preprocess((value) => {\n if (value === undefined || value === null) return undefined;\n return Array.isArray(value) ? value : [value];\n }, z.array(inner).max(DISCOVER_FILTER_VALUES_MAX).optional());\n\n/**\n * Every free-text filter here is `optionalTrimmedString`, so an EMPTY one is\n * treated as \"not provided\" rather than as a validation failure.\n *\n * A search box the member has just cleared sends `?q=`, and a select they reset\n * sends `?city=`. Refusing those turns an ordinary interaction into a 400 with\n * nothing useful to show for it: the member asked for fewer filters, not for an\n * error. This is the one place the create-body rule and the patch-body rule\n * agree, because a query has nothing to erase.\n */\nexport const discoverQuerySchema = paginationQuerySchema.extend({\n /** Free-text name search. Matched against display name and username. */\n q: optionalTrimmedString(DISCOVER_TEXT_MAX),\n industry: multiValue(industrySchema),\n skill: multiValue(skillSchema),\n stage: multiValue(startupStageSchema),\n city: optionalTrimmedString(DISCOVER_TEXT_MAX),\n country: optionalTrimmedString(DISCOVER_TEXT_MAX),\n});\nexport type DiscoverQuery = z.infer<typeof discoverQuerySchema>;\nexport type DiscoverQueryInput = z.input<typeof discoverQuerySchema>;\n\n/** A page of founder cards, most recently updated first. */\nexport const discoverPageSchema = paginatedSchema(founderCardSchema);\nexport type DiscoverPage = z.infer<typeof discoverPageSchema>;\n\n/** One filter option and how many listed founders match it. */\nconst facetOption = <T extends z.ZodType>(value: T) =>\n z.object({ value, count: z.number().int().nonnegative() });\n\n/**\n * The filter options the Discover drawer offers, with counts. The VALUES come\n * from the enums here, so the options cannot disagree with what the query\n * accepts.\n *\n * ⚠ NO LABELS. The value IS the translation key (`industries.<value>`,\n * `stages.<value>`, `skills.<value>`), and a client words it in the member's\n * language. Until 0.2.0 the server also sent an English `label` per option,\n * built by capitalising the value (\"Ai ml\"), which no client read and which\n * would have been wrong in Hindi if one had. Cities are member-typed place\n * names, so their value is shown as it is.\n */\nexport const discoverFacetsSchema = z.object({\n industries: z.array(facetOption(industrySchema)),\n skills: z.array(facetOption(skillSchema)),\n stages: z.array(facetOption(startupStageSchema)),\n cities: z.array(facetOption(z.string())),\n});\nexport type DiscoverFacets = z.infer<typeof discoverFacetsSchema>;\n"]}
package/dist/errors.d.ts DELETED
@@ -1,85 +0,0 @@
1
- /**
2
- * founder-schema — Every error code the API answers with
3
- *
4
- * THE CODE IS WHAT A CLIENT ACTS ON; the `message` beside it is English for
5
- * logs and for a client too old to know the code. A client words each code in
6
- * the member's language, and a test on the web side asserts every value here
7
- * has a message in every locale it ships.
8
- *
9
- * Before 0.2.0 the backend kept this list to itself, and every domain refusal
10
- * (a closed poll, a reply to a reply, the edit window) went out as
11
- * `VALIDATION_ERROR` with an English sentence, so the only way for a client to
12
- * tell them apart was to match on the wording.
13
- *
14
- * WHEN TO USE WHICH:
15
- * - A request that does not match its schema: `VALIDATION_ERROR`, with every
16
- * problem in `error.details.issues`.
17
- * - A well-formed request the current STATE of things refuses: its own code
18
- * below. These carry no issues; the code says it all.
19
- *
20
- * ⚠ Append freely; remove deliberately. A code removed here that an older
21
- * server still sends fails the client's parse of the error envelope.
22
- *
23
- * @module founder-schema/errors
24
- */
25
- import { z } from 'zod';
26
- /**
27
- * As a tuple, the way `GENDER_VALUES` is, so a consumer can iterate it (a
28
- * translation-coverage test does exactly that) and TypeScript keeps the union.
29
- */
30
- export declare const API_ERROR_CODE_VALUES: readonly ["INTERNAL_ERROR", "VALIDATION_ERROR", "NOT_FOUND", "CONFLICT", "RATE_LIMITED", "SERVICE_UNAVAILABLE", "UNAUTHORIZED", "INVALID_TOKEN", "TOKEN_EXPIRED", "SESSION_INVALIDATED", "FORBIDDEN", "ONBOARDING_INCOMPLETE", "ALREADY_ONBOARDED", "UNDER_AGE", "UPLOAD_NOT_ATTACHABLE", "UPLOAD_TOO_LARGE", "UPLOAD_WRONG_TYPE", "EDIT_WINDOW_CLOSED", "POLL_NOT_EDITABLE", "POLL_CLOSED", "POLL_CHOICE_INVALID", "REPLY_TOO_DEEP", "CANNOT_REPORT_OWN", "CHAT_WITH_SELF"];
31
- export declare const apiErrorCodeSchema: z.ZodEnum<{
32
- INTERNAL_ERROR: "INTERNAL_ERROR";
33
- VALIDATION_ERROR: "VALIDATION_ERROR";
34
- NOT_FOUND: "NOT_FOUND";
35
- CONFLICT: "CONFLICT";
36
- RATE_LIMITED: "RATE_LIMITED";
37
- SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
38
- UNAUTHORIZED: "UNAUTHORIZED";
39
- INVALID_TOKEN: "INVALID_TOKEN";
40
- TOKEN_EXPIRED: "TOKEN_EXPIRED";
41
- SESSION_INVALIDATED: "SESSION_INVALIDATED";
42
- FORBIDDEN: "FORBIDDEN";
43
- ONBOARDING_INCOMPLETE: "ONBOARDING_INCOMPLETE";
44
- ALREADY_ONBOARDED: "ALREADY_ONBOARDED";
45
- UNDER_AGE: "UNDER_AGE";
46
- UPLOAD_NOT_ATTACHABLE: "UPLOAD_NOT_ATTACHABLE";
47
- UPLOAD_TOO_LARGE: "UPLOAD_TOO_LARGE";
48
- UPLOAD_WRONG_TYPE: "UPLOAD_WRONG_TYPE";
49
- EDIT_WINDOW_CLOSED: "EDIT_WINDOW_CLOSED";
50
- POLL_NOT_EDITABLE: "POLL_NOT_EDITABLE";
51
- POLL_CLOSED: "POLL_CLOSED";
52
- POLL_CHOICE_INVALID: "POLL_CHOICE_INVALID";
53
- REPLY_TOO_DEEP: "REPLY_TOO_DEEP";
54
- CANNOT_REPORT_OWN: "CANNOT_REPORT_OWN";
55
- CHAT_WITH_SELF: "CHAT_WITH_SELF";
56
- }>;
57
- export type ApiErrorCode = z.infer<typeof apiErrorCodeSchema>;
58
- /** The same codes by name: `API_ERROR_CODE.POLL_CLOSED`. */
59
- export declare const API_ERROR_CODE: {
60
- INTERNAL_ERROR: "INTERNAL_ERROR";
61
- VALIDATION_ERROR: "VALIDATION_ERROR";
62
- NOT_FOUND: "NOT_FOUND";
63
- CONFLICT: "CONFLICT";
64
- RATE_LIMITED: "RATE_LIMITED";
65
- SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
66
- UNAUTHORIZED: "UNAUTHORIZED";
67
- INVALID_TOKEN: "INVALID_TOKEN";
68
- TOKEN_EXPIRED: "TOKEN_EXPIRED";
69
- SESSION_INVALIDATED: "SESSION_INVALIDATED";
70
- FORBIDDEN: "FORBIDDEN";
71
- ONBOARDING_INCOMPLETE: "ONBOARDING_INCOMPLETE";
72
- ALREADY_ONBOARDED: "ALREADY_ONBOARDED";
73
- UNDER_AGE: "UNDER_AGE";
74
- UPLOAD_NOT_ATTACHABLE: "UPLOAD_NOT_ATTACHABLE";
75
- UPLOAD_TOO_LARGE: "UPLOAD_TOO_LARGE";
76
- UPLOAD_WRONG_TYPE: "UPLOAD_WRONG_TYPE";
77
- EDIT_WINDOW_CLOSED: "EDIT_WINDOW_CLOSED";
78
- POLL_NOT_EDITABLE: "POLL_NOT_EDITABLE";
79
- POLL_CLOSED: "POLL_CLOSED";
80
- POLL_CHOICE_INVALID: "POLL_CHOICE_INVALID";
81
- REPLY_TOO_DEEP: "REPLY_TOO_DEEP";
82
- CANNOT_REPORT_OWN: "CANNOT_REPORT_OWN";
83
- CHAT_WITH_SELF: "CHAT_WITH_SELF";
84
- };
85
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,8cA4DxB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;EAAgC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,4DAA4D;AAC5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAA0B,CAAC"}
package/dist/errors.js DELETED
@@ -1,89 +0,0 @@
1
- /**
2
- * founder-schema — Every error code the API answers with
3
- *
4
- * THE CODE IS WHAT A CLIENT ACTS ON; the `message` beside it is English for
5
- * logs and for a client too old to know the code. A client words each code in
6
- * the member's language, and a test on the web side asserts every value here
7
- * has a message in every locale it ships.
8
- *
9
- * Before 0.2.0 the backend kept this list to itself, and every domain refusal
10
- * (a closed poll, a reply to a reply, the edit window) went out as
11
- * `VALIDATION_ERROR` with an English sentence, so the only way for a client to
12
- * tell them apart was to match on the wording.
13
- *
14
- * WHEN TO USE WHICH:
15
- * - A request that does not match its schema: `VALIDATION_ERROR`, with every
16
- * problem in `error.details.issues`.
17
- * - A well-formed request the current STATE of things refuses: its own code
18
- * below. These carry no issues; the code says it all.
19
- *
20
- * ⚠ Append freely; remove deliberately. A code removed here that an older
21
- * server still sends fails the client's parse of the error envelope.
22
- *
23
- * @module founder-schema/errors
24
- */
25
- import { z } from 'zod';
26
- /**
27
- * As a tuple, the way `GENDER_VALUES` is, so a consumer can iterate it (a
28
- * translation-coverage test does exactly that) and TypeScript keeps the union.
29
- */
30
- export const API_ERROR_CODE_VALUES = [
31
- // ── Anything ──
32
- /** A bug or an outage on our side. The message says nothing more on purpose. */
33
- 'INTERNAL_ERROR',
34
- /** The request did not match its schema. `details.issues` says where. */
35
- 'VALIDATION_ERROR',
36
- /** No such thing, or not one you may see. Deliberately the same answer. */
37
- 'NOT_FOUND',
38
- /** Two writes raced for something unique; retrying usually succeeds. */
39
- 'CONFLICT',
40
- /** Too many requests from this member or address. Wait, then retry. */
41
- 'RATE_LIMITED',
42
- /** Something we depend on (the chat server) is down or not switched on. */
43
- 'SERVICE_UNAVAILABLE',
44
- // ── Who you are ──
45
- /** No credential at all. */
46
- 'UNAUTHORIZED',
47
- /** A credential that is not ours, or not readable. */
48
- 'INVALID_TOKEN',
49
- /** A credential that was ours and has expired. Refresh and retry. */
50
- 'TOKEN_EXPIRED',
51
- /** Signed out everywhere, or the account changed. Sign in again. */
52
- 'SESSION_INVALIDATED',
53
- /** Signed in, and not allowed to do this. */
54
- 'FORBIDDEN',
55
- // ── Onboarding ──
56
- /** Finish onboarding first. The client routes here instead of showing an error. */
57
- 'ONBOARDING_INCOMPLETE',
58
- /** Onboarding is already finished; there is nothing to save or finish again. */
59
- 'ALREADY_ONBOARDED',
60
- /** Under `MIN_AGE_YEARS`. Refused at the draft and again at finish. */
61
- 'UNDER_AGE',
62
- // ── Uploads, at the moment one is attached ──
63
- /** Not an upload of yours, or nothing was ever uploaded under that key. */
64
- 'UPLOAD_NOT_ATTACHABLE',
65
- /** Larger than `UPLOAD_MAX_BYTES`. */
66
- 'UPLOAD_TOO_LARGE',
67
- /** Not one of the image types this product accepts, or not an image at all. */
68
- 'UPLOAD_WRONG_TYPE',
69
- // ── The feed ──
70
- /** The post is older than `EDIT_WINDOW_MS`. */
71
- 'EDIT_WINDOW_CLOSED',
72
- /** A poll is never editable: people have already voted on it. */
73
- 'POLL_NOT_EDITABLE',
74
- /** The poll has closed, by the server's clock. */
75
- 'POLL_CLOSED',
76
- /** No option, several on a single-choice poll, or an option that does not exist. */
77
- 'POLL_CHOICE_INVALID',
78
- /** A reply to a reply. One level of nesting only. */
79
- 'REPLY_TOO_DEEP',
80
- /** Reporting your own post, poll or comment. */
81
- 'CANNOT_REPORT_OWN',
82
- // ── Chat ──
83
- /** Opening a conversation with yourself. */
84
- 'CHAT_WITH_SELF',
85
- ];
86
- export const apiErrorCodeSchema = z.enum(API_ERROR_CODE_VALUES);
87
- /** The same codes by name: `API_ERROR_CODE.POLL_CLOSED`. */
88
- export const API_ERROR_CODE = apiErrorCodeSchema.enum;
89
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB;IACjB,gFAAgF;IAChF,gBAAgB;IAChB,yEAAyE;IACzE,kBAAkB;IAClB,2EAA2E;IAC3E,WAAW;IACX,wEAAwE;IACxE,UAAU;IACV,uEAAuE;IACvE,cAAc;IACd,2EAA2E;IAC3E,qBAAqB;IAErB,oBAAoB;IACpB,4BAA4B;IAC5B,cAAc;IACd,sDAAsD;IACtD,eAAe;IACf,qEAAqE;IACrE,eAAe;IACf,oEAAoE;IACpE,qBAAqB;IACrB,6CAA6C;IAC7C,WAAW;IAEX,mBAAmB;IACnB,mFAAmF;IACnF,uBAAuB;IACvB,gFAAgF;IAChF,mBAAmB;IACnB,uEAAuE;IACvE,WAAW;IAEX,+CAA+C;IAC/C,2EAA2E;IAC3E,uBAAuB;IACvB,sCAAsC;IACtC,kBAAkB;IAClB,+EAA+E;IAC/E,mBAAmB;IAEnB,iBAAiB;IACjB,+CAA+C;IAC/C,oBAAoB;IACpB,iEAAiE;IACjE,mBAAmB;IACnB,kDAAkD;IAClD,aAAa;IACb,oFAAoF;IACpF,qBAAqB;IACrB,qDAAqD;IACrD,gBAAgB;IAChB,gDAAgD;IAChD,mBAAmB;IAEnB,aAAa;IACb,4CAA4C;IAC5C,gBAAgB;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAGhE,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC,IAAI,CAAC","sourcesContent":["/**\n * founder-schema — Every error code the API answers with\n *\n * THE CODE IS WHAT A CLIENT ACTS ON; the `message` beside it is English for\n * logs and for a client too old to know the code. A client words each code in\n * the member's language, and a test on the web side asserts every value here\n * has a message in every locale it ships.\n *\n * Before 0.2.0 the backend kept this list to itself, and every domain refusal\n * (a closed poll, a reply to a reply, the edit window) went out as\n * `VALIDATION_ERROR` with an English sentence, so the only way for a client to\n * tell them apart was to match on the wording.\n *\n * WHEN TO USE WHICH:\n * - A request that does not match its schema: `VALIDATION_ERROR`, with every\n * problem in `error.details.issues`.\n * - A well-formed request the current STATE of things refuses: its own code\n * below. These carry no issues; the code says it all.\n *\n * ⚠ Append freely; remove deliberately. A code removed here that an older\n * server still sends fails the client's parse of the error envelope.\n *\n * @module founder-schema/errors\n */\n\nimport { z } from 'zod';\n\n/**\n * As a tuple, the way `GENDER_VALUES` is, so a consumer can iterate it (a\n * translation-coverage test does exactly that) and TypeScript keeps the union.\n */\nexport const API_ERROR_CODE_VALUES = [\n // ── Anything ──\n /** A bug or an outage on our side. The message says nothing more on purpose. */\n 'INTERNAL_ERROR',\n /** The request did not match its schema. `details.issues` says where. */\n 'VALIDATION_ERROR',\n /** No such thing, or not one you may see. Deliberately the same answer. */\n 'NOT_FOUND',\n /** Two writes raced for something unique; retrying usually succeeds. */\n 'CONFLICT',\n /** Too many requests from this member or address. Wait, then retry. */\n 'RATE_LIMITED',\n /** Something we depend on (the chat server) is down or not switched on. */\n 'SERVICE_UNAVAILABLE',\n\n // ── Who you are ──\n /** No credential at all. */\n 'UNAUTHORIZED',\n /** A credential that is not ours, or not readable. */\n 'INVALID_TOKEN',\n /** A credential that was ours and has expired. Refresh and retry. */\n 'TOKEN_EXPIRED',\n /** Signed out everywhere, or the account changed. Sign in again. */\n 'SESSION_INVALIDATED',\n /** Signed in, and not allowed to do this. */\n 'FORBIDDEN',\n\n // ── Onboarding ──\n /** Finish onboarding first. The client routes here instead of showing an error. */\n 'ONBOARDING_INCOMPLETE',\n /** Onboarding is already finished; there is nothing to save or finish again. */\n 'ALREADY_ONBOARDED',\n /** Under `MIN_AGE_YEARS`. Refused at the draft and again at finish. */\n 'UNDER_AGE',\n\n // ── Uploads, at the moment one is attached ──\n /** Not an upload of yours, or nothing was ever uploaded under that key. */\n 'UPLOAD_NOT_ATTACHABLE',\n /** Larger than `UPLOAD_MAX_BYTES`. */\n 'UPLOAD_TOO_LARGE',\n /** Not one of the image types this product accepts, or not an image at all. */\n 'UPLOAD_WRONG_TYPE',\n\n // ── The feed ──\n /** The post is older than `EDIT_WINDOW_MS`. */\n 'EDIT_WINDOW_CLOSED',\n /** A poll is never editable: people have already voted on it. */\n 'POLL_NOT_EDITABLE',\n /** The poll has closed, by the server's clock. */\n 'POLL_CLOSED',\n /** No option, several on a single-choice poll, or an option that does not exist. */\n 'POLL_CHOICE_INVALID',\n /** A reply to a reply. One level of nesting only. */\n 'REPLY_TOO_DEEP',\n /** Reporting your own post, poll or comment. */\n 'CANNOT_REPORT_OWN',\n\n // ── Chat ──\n /** Opening a conversation with yourself. */\n 'CHAT_WITH_SELF',\n] as const;\n\nexport const apiErrorCodeSchema = z.enum(API_ERROR_CODE_VALUES);\nexport type ApiErrorCode = z.infer<typeof apiErrorCodeSchema>;\n\n/** The same codes by name: `API_ERROR_CODE.POLL_CLOSED`. */\nexport const API_ERROR_CODE = apiErrorCodeSchema.enum;\n"]}