founder-schema 0.1.0 → 0.2.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 (54) hide show
  1. package/README.md +112 -40
  2. package/dist/chat.d.ts +63 -15
  3. package/dist/chat.d.ts.map +1 -1
  4. package/dist/chat.js +55 -17
  5. package/dist/chat.js.map +1 -1
  6. package/dist/common.d.ts +84 -8
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/common.js +109 -17
  9. package/dist/common.js.map +1 -1
  10. package/dist/discover.d.ts +98 -6
  11. package/dist/discover.d.ts.map +1 -1
  12. package/dist/discover.js +25 -11
  13. package/dist/discover.js.map +1 -1
  14. package/dist/errors.d.ts +85 -0
  15. package/dist/errors.d.ts.map +1 -0
  16. package/dist/errors.js +89 -0
  17. package/dist/errors.js.map +1 -0
  18. package/dist/feed.d.ts +400 -52
  19. package/dist/feed.d.ts.map +1 -1
  20. package/dist/feed.js +98 -68
  21. package/dist/feed.js.map +1 -1
  22. package/dist/founder-profile.d.ts +76 -46
  23. package/dist/founder-profile.d.ts.map +1 -1
  24. package/dist/founder-profile.js +46 -46
  25. package/dist/founder-profile.js.map +1 -1
  26. package/dist/index.d.ts +14 -9
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +20 -10
  29. package/dist/index.js.map +1 -1
  30. package/dist/limits.d.ts +76 -0
  31. package/dist/limits.d.ts.map +1 -0
  32. package/dist/limits.js +84 -0
  33. package/dist/limits.js.map +1 -0
  34. package/dist/onboarding.d.ts +407 -53
  35. package/dist/onboarding.d.ts.map +1 -1
  36. package/dist/onboarding.js +281 -234
  37. package/dist/onboarding.js.map +1 -1
  38. package/dist/responses/common.d.ts +122 -4
  39. package/dist/responses/common.d.ts.map +1 -1
  40. package/dist/responses/common.js +26 -3
  41. package/dist/responses/common.js.map +1 -1
  42. package/dist/responses/index.d.ts +1 -1
  43. package/dist/responses/index.d.ts.map +1 -1
  44. package/dist/responses/index.js +1 -1
  45. package/dist/responses/index.js.map +1 -1
  46. package/dist/uploads.d.ts +113 -0
  47. package/dist/uploads.d.ts.map +1 -0
  48. package/dist/uploads.js +106 -0
  49. package/dist/uploads.js.map +1 -0
  50. package/dist/validation.d.ts +136 -0
  51. package/dist/validation.d.ts.map +1 -0
  52. package/dist/validation.js +142 -0
  53. package/dist/validation.js.map +1 -0
  54. package/package.json +4 -3
@@ -0,0 +1,76 @@
1
+ /**
2
+ * founder-schema — Every length, size and count limit, by name
3
+ *
4
+ * ONE PLACE FOR EVERY NUMBER a client and the server must agree on. Before this,
5
+ * the limits lived inline (`.max(80)`, `.max(1000)`) where nothing else could
6
+ * read them, so the web client re-typed each one for its counters and the
7
+ * backend re-typed them as Mongoose `maxlength`. Three copies of one number is
8
+ * how the image alt text came to be 280 here and 500 in the backend.
9
+ *
10
+ * The rule from 0.2.0: a schema uses one of these constants, a consumer imports
11
+ * the same constant, and nobody writes the digits again.
12
+ *
13
+ * Imports nothing, so any module here can use it without a cycle. Limits that
14
+ * already had a name in their own module (POST_MAX_BODY_CHARS, POLL_*,
15
+ * USERNAME_*, INTERESTS_*, MIN_AGE_YEARS...) stay where they are and keep their
16
+ * names; this file holds the ones that had none.
17
+ *
18
+ * ⚠️ Lowering a limit is a breaking change for stored data: a value that was
19
+ * valid when written fails the next edit. Raise freely; lower deliberately.
20
+ *
21
+ * @module founder-schema/limits
22
+ */
23
+ export declare const DISPLAY_NAME_MAX = 80;
24
+ export declare const HEADLINE_MAX = 120;
25
+ export declare const ABOUT_MAX = 1000;
26
+ /** Skills a member may list. Discover filters on them. */
27
+ export declare const SKILLS_MAX = 8;
28
+ /** Goals a member must pick at onboarding. The list itself caps the maximum. */
29
+ export declare const GOALS_MIN = 1;
30
+ export declare const CITY_MAX = 80;
31
+ export declare const STATE_MAX = 80;
32
+ export declare const COUNTRY_MAX = 80;
33
+ export declare const VENTURE_NAME_MAX = 120;
34
+ export declare const VENTURE_TAGLINE_MAX = 160;
35
+ /** Team size including the founder. */
36
+ export declare const TEAM_SIZE_MIN = 1;
37
+ export declare const TEAM_SIZE_MAX = 100000;
38
+ /** Earliest founding year accepted. The ceiling is "this year", read per parse. */
39
+ export declare const FOUNDED_YEAR_MIN = 1900;
40
+ /**
41
+ * Longest URL a member may TYPE. Applied by `httpUrlSchema` itself, so every
42
+ * member URL carries it: profile links, a venture website.
43
+ *
44
+ * ⚠ NOT applied to URLs the server reads from elsewhere (a link preview's
45
+ * page or image), which use `safeUrlSchema`: a 314-character CDN image URL is
46
+ * ordinary, and one of them would otherwise fail a whole feed page.
47
+ */
48
+ export declare const LINK_URL_MAX = 300;
49
+ /** Author-supplied image description. The backend's stored copy uses this too. */
50
+ export declare const MEDIA_ALT_MAX = 280;
51
+ export declare const LINK_PREVIEW_TITLE_MAX = 200;
52
+ export declare const LINK_PREVIEW_DESCRIPTION_MAX = 500;
53
+ /** The free-text note on a report. */
54
+ export declare const REPORT_NOTE_MAX = 1000;
55
+ /**
56
+ * Largest file accepted for upload: 10 MB.
57
+ *
58
+ * Checked on BOTH sides and for different reasons. The server refuses a bigger
59
+ * object when it is attached. The client checks before uploading, because a
60
+ * presigned PUT caps the content type but not the size, so a member on a phone
61
+ * connection would otherwise watch a 40 MB upload finish and then fail.
62
+ */
63
+ export declare const UPLOAD_MAX_BYTES: number;
64
+ /** Values one Discover multi-select filter may carry (`?skill=a&skill=b`). */
65
+ export declare const DISCOVER_FILTER_VALUES_MAX = 10;
66
+ /** Discover's free-text inputs: the name search, city and country. */
67
+ export declare const DISCOVER_TEXT_MAX = 80;
68
+ /** Page size bounds for every cursor-paged list. */
69
+ export declare const PAGE_SIZE_MAX = 50;
70
+ export declare const PAGE_SIZE_DEFAULT = 20;
71
+ /**
72
+ * Members one participants lookup may name. Bounded so the lookup cannot be
73
+ * used to page through the directory.
74
+ */
75
+ export declare const CHAT_PARTICIPANTS_MAX = 100;
76
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sour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length, size and count limit, by name
3
+ *
4
+ * ONE PLACE FOR EVERY NUMBER a client and the server must agree on. Before this,
5
+ * the limits lived inline (`.max(80)`, `.max(1000)`) where nothing else could
6
+ * read them, so the web client re-typed each one for its counters and the
7
+ * backend re-typed them as Mongoose `maxlength`. Three copies of one number is
8
+ * how the image alt text came to be 280 here and 500 in the backend.
9
+ *
10
+ * The rule from 0.2.0: a schema uses one of these constants, a consumer imports
11
+ * the same constant, and nobody writes the digits again.
12
+ *
13
+ * Imports nothing, so any module here can use it without a cycle. Limits that
14
+ * already had a name in their own module (POST_MAX_BODY_CHARS, POLL_*,
15
+ * USERNAME_*, INTERESTS_*, MIN_AGE_YEARS...) stay where they are and keep their
16
+ * names; this file holds the ones that had none.
17
+ *
18
+ * ⚠️ Lowering a limit is a breaking change for stored data: a value that was
19
+ * valid when written fails the next edit. Raise freely; lower deliberately.
20
+ *
21
+ * @module founder-schema/limits
22
+ */
23
+ // ─── Profile ─────────────────────────────────────────────────────────────────
24
+ export const DISPLAY_NAME_MAX = 80;
25
+ export const HEADLINE_MAX = 120;
26
+ export const ABOUT_MAX = 1000;
27
+ /** Skills a member may list. Discover filters on them. */
28
+ export const SKILLS_MAX = 8;
29
+ /** Goals a member must pick at onboarding. The list itself caps the maximum. */
30
+ export const GOALS_MIN = 1;
31
+ // ─── Location ────────────────────────────────────────────────────────────────
32
+ export const CITY_MAX = 80;
33
+ export const STATE_MAX = 80;
34
+ export const COUNTRY_MAX = 80;
35
+ // ─── Venture ─────────────────────────────────────────────────────────────────
36
+ export const VENTURE_NAME_MAX = 120;
37
+ export const VENTURE_TAGLINE_MAX = 160;
38
+ /** Team size including the founder. */
39
+ export const TEAM_SIZE_MIN = 1;
40
+ export const TEAM_SIZE_MAX = 100_000;
41
+ /** Earliest founding year accepted. The ceiling is "this year", read per parse. */
42
+ export const FOUNDED_YEAR_MIN = 1900;
43
+ // ─── Links ───────────────────────────────────────────────────────────────────
44
+ /**
45
+ * Longest URL a member may TYPE. Applied by `httpUrlSchema` itself, so every
46
+ * member URL carries it: profile links, a venture website.
47
+ *
48
+ * ⚠ NOT applied to URLs the server reads from elsewhere (a link preview's
49
+ * page or image), which use `safeUrlSchema`: a 314-character CDN image URL is
50
+ * ordinary, and one of them would otherwise fail a whole feed page.
51
+ */
52
+ export const LINK_URL_MAX = 300;
53
+ // ─── Feed and moderation ─────────────────────────────────────────────────────
54
+ /** Author-supplied image description. The backend's stored copy uses this too. */
55
+ export const MEDIA_ALT_MAX = 280;
56
+ export const LINK_PREVIEW_TITLE_MAX = 200;
57
+ export const LINK_PREVIEW_DESCRIPTION_MAX = 500;
58
+ /** The free-text note on a report. */
59
+ export const REPORT_NOTE_MAX = 1000;
60
+ // ─── Uploads ─────────────────────────────────────────────────────────────────
61
+ /**
62
+ * Largest file accepted for upload: 10 MB.
63
+ *
64
+ * Checked on BOTH sides and for different reasons. The server refuses a bigger
65
+ * object when it is attached. The client checks before uploading, because a
66
+ * presigned PUT caps the content type but not the size, so a member on a phone
67
+ * connection would otherwise watch a 40 MB upload finish and then fail.
68
+ */
69
+ export const UPLOAD_MAX_BYTES = 10 * 1024 * 1024;
70
+ // ─── Lists and search ────────────────────────────────────────────────────────
71
+ /** Values one Discover multi-select filter may carry (`?skill=a&skill=b`). */
72
+ export const DISCOVER_FILTER_VALUES_MAX = 10;
73
+ /** Discover's free-text inputs: the name search, city and country. */
74
+ export const DISCOVER_TEXT_MAX = 80;
75
+ /** Page size bounds for every cursor-paged list. */
76
+ export const PAGE_SIZE_MAX = 50;
77
+ export const PAGE_SIZE_DEFAULT = 20;
78
+ // ─── Chat ────────────────────────────────────────────────────────────────────
79
+ /**
80
+ * Members one participants lookup may name. Bounded so the lookup cannot be
81
+ * used to page through the directory.
82
+ */
83
+ export const CHAT_PARTICIPANTS_MAX = 100;
84
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;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F,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,sEAAsE;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,oDAAoD;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC","sourcesContent":["/**\n * founder-schema — Every length, size and count limit, by name\n *\n * ONE PLACE FOR EVERY NUMBER a client and the server must agree on. Before this,\n * the limits lived inline (`.max(80)`, `.max(1000)`) where nothing else could\n * read them, so the web client re-typed each one for its counters and the\n * backend re-typed them as Mongoose `maxlength`. Three copies of one number is\n * how the image alt text came to be 280 here and 500 in the backend.\n *\n * The rule from 0.2.0: a schema uses one of these constants, a consumer imports\n * the same constant, and nobody writes the digits again.\n *\n * Imports nothing, so any module here can use it without a cycle. Limits that\n * already had a name in their own module (POST_MAX_BODY_CHARS, POLL_*,\n * USERNAME_*, INTERESTS_*, MIN_AGE_YEARS...) stay where they are and keep their\n * names; this file holds the ones that had none.\n *\n * ⚠️ Lowering a limit is a breaking change for stored data: a value that was\n * valid when written fails the next edit. Raise freely; lower deliberately.\n *\n * @module founder-schema/limits\n */\n\n// ─── Profile ─────────────────────────────────────────────────────────────────\n\nexport const DISPLAY_NAME_MAX = 80;\nexport const HEADLINE_MAX = 120;\nexport const ABOUT_MAX = 1000;\n/** Skills a member may list. Discover filters on them. */\nexport const SKILLS_MAX = 8;\n/** Goals a member must pick at onboarding. The list itself caps the maximum. */\nexport const GOALS_MIN = 1;\n\n// ─── Location ────────────────────────────────────────────────────────────────\n\nexport const CITY_MAX = 80;\nexport const STATE_MAX = 80;\nexport const COUNTRY_MAX = 80;\n\n// ─── Venture ─────────────────────────────────────────────────────────────────\n\nexport const VENTURE_NAME_MAX = 120;\nexport const VENTURE_TAGLINE_MAX = 160;\n/** Team size including the founder. */\nexport const TEAM_SIZE_MIN = 1;\nexport const TEAM_SIZE_MAX = 100_000;\n/** Earliest founding year accepted. The ceiling is \"this year\", read per parse. */\nexport const FOUNDED_YEAR_MIN = 1900;\n\n// ─── Links ───────────────────────────────────────────────────────────────────\n\n/**\n * Longest URL a member may TYPE. Applied by `httpUrlSchema` itself, so every\n * member URL carries it: profile links, a venture website.\n *\n * ⚠ NOT applied to URLs the server reads from elsewhere (a link preview's\n * page or image), which use `safeUrlSchema`: a 314-character CDN image URL is\n * ordinary, and one of them would otherwise fail a whole feed page.\n */\nexport const LINK_URL_MAX = 300;\n\n// ─── Feed and moderation ─────────────────────────────────────────────────────\n\n/** Author-supplied image description. The backend's stored copy uses this too. */\nexport const MEDIA_ALT_MAX = 280;\nexport const LINK_PREVIEW_TITLE_MAX = 200;\nexport const LINK_PREVIEW_DESCRIPTION_MAX = 500;\n/** The free-text note on a report. */\nexport const REPORT_NOTE_MAX = 1000;\n\n// ─── Uploads ─────────────────────────────────────────────────────────────────\n\n/**\n * Largest file accepted for upload: 10 MB.\n *\n * Checked on BOTH sides and for different reasons. The server refuses a bigger\n * object when it is attached. The client checks before uploading, because a\n * presigned PUT caps the content type but not the size, so a member on a phone\n * connection would otherwise watch a 40 MB upload finish and then fail.\n */\nexport const UPLOAD_MAX_BYTES = 10 * 1024 * 1024;\n\n// ─── Lists and search ────────────────────────────────────────────────────────\n\n/** Values one Discover multi-select filter may carry (`?skill=a&skill=b`). */\nexport const DISCOVER_FILTER_VALUES_MAX = 10;\n/** Discover's free-text inputs: the name search, city and country. */\nexport const DISCOVER_TEXT_MAX = 80;\n/** Page size bounds for every cursor-paged list. */\nexport const PAGE_SIZE_MAX = 50;\nexport const PAGE_SIZE_DEFAULT = 20;\n\n// ─── Chat ────────────────────────────────────────────────────────────────────\n\n/**\n * Members one participants lookup may name. Bounded so the lookup cannot be\n * used to page through the directory.\n */\nexport const CHAT_PARTICIPANTS_MAX = 100;\n"]}