@openpeepshq/common 0.7.0 → 0.8.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.
@@ -0,0 +1,25 @@
1
+ export declare const visibleTextLength: (markdown?: string | null) => number;
2
+ /** Visible-text budget for note/question content. */
3
+ export declare const POST_MAX_VISIBLE_LENGTH = 500;
4
+ /** Raw markdown backstop for note/question content. */
5
+ export declare const POST_MAX_RAW_LENGTH = 5000;
6
+ /**
7
+ * Whitespace-only content is measured as empty (nothing renders), so the
8
+ * same "is there anything to send" test must ignore whitespace everywhere
9
+ * a composer or schema checks it.
10
+ */
11
+ export declare const hasVisibleText: (content?: string | null) => boolean;
12
+ /** True when note/question content fits the visible + raw budgets. */
13
+ export declare const postContentWithinBudget: (content?: string | null) => boolean;
14
+ /**
15
+ * Shared composer submit gate over the visible budget. Question composers
16
+ * need visible text for their poll to make sense; note composers accept an
17
+ * attachment instead. In-flight state (submitting, pending uploads,
18
+ * audience/group requirements) stays at the call site.
19
+ */
20
+ export declare const canSubmitPostContent: ({ visibleContentLength, attachmentsLength, composerType, pollOptionsValid, }: {
21
+ visibleContentLength: number;
22
+ attachmentsLength: number;
23
+ composerType?: "note" | "question";
24
+ pollOptionsValid?: boolean;
25
+ }) => boolean;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Visible-text measurement for the post content budget.
3
+ *
4
+ * Counts what a reader sees, not the raw markdown source:
5
+ * - fenced code counts its content verbatim (it renders as visible code)
6
+ * - links and images count their text/alt, not the URL
7
+ * - structural line syntax (table cells/pipes, list markers, setext
8
+ * underlines, thematic breaks, headings, blockquotes) and HTML tags
9
+ * render no characters and do not count
10
+ * - whitespace runs collapse and line edges trim, so the count tracks
11
+ * what renders
12
+ *
13
+ * This is a budget estimate, not a markdown parser: unbounded content is
14
+ * guarded by the raw-length cap (`POST_MAX_RAW_LENGTH`), not by this
15
+ * function.
16
+ */
17
+ const FENCE_RE = /^[ \t]*```[^\n]*\n?([\s\S]*?)^[ \t]*```[ \t]*$/gm;
18
+ // Built from a string, not a regex literal: ESLint's no-control-regex
19
+ // rejects control characters in regex sources. U+FFFE is a noncharacter
20
+ // no renderer emits, and stray occurrences are stripped from the content
21
+ // before fencing, so it cannot collide with real input.
22
+ const FENCE_SENTINEL_RE = () => new RegExp('\\uFFFE(\\d+)\\uFFFE', 'g');
23
+ /**
24
+ * A line that renders nothing: table delimiter rows (`| --- | --- |`),
25
+ * setext underlines (`---`, `===`), and thematic breaks (`---`, `***`,
26
+ * `___`). The character class mirrors their allowed symbols; `-` is last
27
+ * so it cannot form a range.
28
+ */
29
+ const INVISIBLE_LINE_RE = /^[ \t]*\|?[ \t]*[-=*_][ \t:|=*_-]*\|?[ \t]*$/;
30
+ export const visibleTextLength = (markdown) => {
31
+ if (!markdown)
32
+ return 0;
33
+ // Stray sentinels in user content must not collide with the fence
34
+ // sentinel (U+FFFE is a noncharacter no renderer emits).
35
+ let text = markdown
36
+ .replace(/\r\n?/g, '\n')
37
+ .replaceAll('\uFFFE', '')
38
+ .replaceAll('\u0000', '');
39
+ // Fenced code renders verbatim, so hold its content aside while the
40
+ // line-structural passes run on the surrounding text.
41
+ const fenced = [];
42
+ text = text.replace(FENCE_RE, (_match, content) => {
43
+ fenced.push(content);
44
+ return `\uFFFE${fenced.length - 1}\uFFFE`;
45
+ });
46
+ // Inline code counts its content, not the backticks.
47
+ text = text.replace(/`([^`]+)`/g, '$1');
48
+ // Autolinks: the URL is the visible text.
49
+ text = text.replace(/<(https?:\/\/[^>\s]+|mailto:[^>\s]+)>/gi, '$1');
50
+ // Images: count the alt text, drop the marker and URL.
51
+ text = text.replace(/!\[([^\]]*)\]\(((?:[^()]+|\([^()]*\))*)\)/g, '$1');
52
+ // Links: count the text, drop the URL (one level of nested parens ok).
53
+ text = text.replace(/\[([^\]]+)\]\(((?:[^()]+|\([^()]*\))*)\)/g, '$1');
54
+ // Reference-style links: count the text, drop the reference.
55
+ text = text.replace(/\[([^\]]+)\]\[[^\]]*\]/g, '$1');
56
+ // HTML tags: drop the tags, keep the inner text.
57
+ text = text.replace(/<\/?[a-zA-Z][^>]*>/g, '');
58
+ text = text
59
+ .split('\n')
60
+ .map((line) => {
61
+ if (INVISIBLE_LINE_RE.test(line))
62
+ return '';
63
+ return (line
64
+ // Heading and blockquote markers.
65
+ .replace(/^[ \t]*(?:#{1,6}|>)[ \t]*/, '')
66
+ // List markers ("-", "*", "+", "1.", "1)").
67
+ .replace(/^[ \t]*(?:[-*+]|\d{1,9}[.)])[ \t]+/, '')
68
+ // Table cells: the pipes and their padding are syntax.
69
+ .replace(/^[ \t]*\|/, '')
70
+ .replace(/\|[ \t]*$/, '')
71
+ .replace(/\|/g, ' ')
72
+ .replace(/^[ \t]+|[\t ]+$/g, ''));
73
+ })
74
+ .filter((line) => line.length > 0)
75
+ .join('\n');
76
+ // Emphasis/strikethrough markers. `_` inside a word (snake_case) is kept.
77
+ text = text.replace(/[*~]{1,3}/g, '');
78
+ text = text.replace(/(^|\s)_{1,3}(\S)/gm, '$1$2');
79
+ text = text.replace(/(\S)_{1,3}(\s|$)/gm, '$1$2');
80
+ // Whitespace runs collapse to single spaces (the renderer collapses
81
+ // them), so the count tracks what renders.
82
+ text = text.replace(/[\t ]{2,}/g, ' ');
83
+ // Restore the fenced code content verbatim.
84
+ text = text.replace(FENCE_SENTINEL_RE(), (_match, index) => {
85
+ return fenced[Number(index)] ?? '';
86
+ });
87
+ // Count code points so emoji and other astral characters cost what they
88
+ // render, not their UTF-16 surrogate pair.
89
+ return [...text].length;
90
+ };
91
+ /** Visible-text budget for note/question content. */
92
+ export const POST_MAX_VISIBLE_LENGTH = 500;
93
+ /** Raw markdown backstop for note/question content. */
94
+ export const POST_MAX_RAW_LENGTH = 5000;
95
+ /**
96
+ * Whitespace-only content is measured as empty (nothing renders), so the
97
+ * same "is there anything to send" test must ignore whitespace everywhere
98
+ * a composer or schema checks it.
99
+ */
100
+ export const hasVisibleText = (content) => visibleTextLength(content) > 0;
101
+ /** True when note/question content fits the visible + raw budgets. */
102
+ export const postContentWithinBudget = (content) => {
103
+ const raw = content ?? '';
104
+ return (visibleTextLength(raw) <= POST_MAX_VISIBLE_LENGTH &&
105
+ raw.length <= POST_MAX_RAW_LENGTH);
106
+ };
107
+ /**
108
+ * Shared composer submit gate over the visible budget. Question composers
109
+ * need visible text for their poll to make sense; note composers accept an
110
+ * attachment instead. In-flight state (submitting, pending uploads,
111
+ * audience/group requirements) stays at the call site.
112
+ */
113
+ export const canSubmitPostContent = ({ visibleContentLength, attachmentsLength, composerType, pollOptionsValid = true, }) => composerType === 'question'
114
+ ? visibleContentLength > 0 &&
115
+ visibleContentLength <= POST_MAX_VISIBLE_LENGTH &&
116
+ pollOptionsValid
117
+ : visibleContentLength <= POST_MAX_VISIBLE_LENGTH &&
118
+ (visibleContentLength > 0 || attachmentsLength > 0);
@@ -11,6 +11,7 @@ export * from './groupHelpers';
11
11
  export * from './groupTemplateHelpers';
12
12
  export * from './colors';
13
13
  export * from './markdownHelpers';
14
+ export * from './contentLength';
14
15
  export * from './attachmentHelpers';
15
16
  export * from './resources';
16
17
  export * from './eventIcs';
package/dist/lib/index.js CHANGED
@@ -11,6 +11,7 @@ export * from './groupHelpers.js';
11
11
  export * from './groupTemplateHelpers.js';
12
12
  export * from './colors.js';
13
13
  export * from './markdownHelpers.js';
14
+ export * from './contentLength.js';
14
15
  export * from './attachmentHelpers.js';
15
16
  export * from './resources.js';
16
17
  export * from './eventIcs.js';
@@ -104,9 +104,9 @@ export declare const analyticsMemberRowSchema: z.ZodObject<{
104
104
  }, z.core.$strip>;
105
105
  export type AnalyticsMemberRow = z.infer<typeof analyticsMemberRowSchema>;
106
106
  export declare const analyticsPostTypeKeySchema: z.ZodEnum<{
107
+ note: "note";
107
108
  jam: "jam";
108
109
  resource: "resource";
109
- note: "note";
110
110
  event: "event";
111
111
  article: "article";
112
112
  poll: "poll";
@@ -114,9 +114,9 @@ export declare const analyticsPostTypeKeySchema: z.ZodEnum<{
114
114
  export type AnalyticsPostTypeKey = z.infer<typeof analyticsPostTypeKeySchema>;
115
115
  export declare const analyticsPostTypeCountSchema: z.ZodObject<{
116
116
  type: z.ZodEnum<{
117
+ note: "note";
117
118
  jam: "jam";
118
119
  resource: "resource";
119
- note: "note";
120
120
  event: "event";
121
121
  article: "article";
122
122
  poll: "poll";
@@ -271,9 +271,9 @@ export declare const analyticsOverviewSchema: z.ZodObject<{
271
271
  }, z.core.$strip>>;
272
272
  postTypes: z.ZodArray<z.ZodObject<{
273
273
  type: z.ZodEnum<{
274
+ note: "note";
274
275
  jam: "jam";
275
276
  resource: "resource";
276
- note: "note";
277
277
  event: "event";
278
278
  article: "article";
279
279
  poll: "poll";
@@ -1882,9 +1882,9 @@ export type RepostWithPublicProfile = z.infer<typeof repostWithPublicProfileSche
1882
1882
  export declare const publicReplyPostSchema: z.ZodObject<{
1883
1883
  id: z.ZodString;
1884
1884
  type: z.ZodEnum<{
1885
- resource: "resource";
1886
1885
  note: "note";
1887
1886
  question: "question";
1887
+ resource: "resource";
1888
1888
  event: "event";
1889
1889
  article: "article";
1890
1890
  }>;
@@ -3573,9 +3573,9 @@ export declare const publicReplyPostSchema: z.ZodObject<{
3573
3573
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
3574
3574
  id: z.ZodString;
3575
3575
  type: z.ZodEnum<{
3576
- resource: "resource";
3577
3576
  note: "note";
3578
3577
  question: "question";
3578
+ resource: "resource";
3579
3579
  event: "event";
3580
3580
  article: "article";
3581
3581
  }>;
@@ -5396,9 +5396,9 @@ export type PublicRsvp = z.infer<typeof publicRsvpSchema>;
5396
5396
  export declare const publicPostSchema: z.ZodObject<{
5397
5397
  id: z.ZodString;
5398
5398
  type: z.ZodEnum<{
5399
- resource: "resource";
5400
5399
  note: "note";
5401
5400
  question: "question";
5401
+ resource: "resource";
5402
5402
  event: "event";
5403
5403
  article: "article";
5404
5404
  }>;
@@ -7315,9 +7315,9 @@ export declare const publicPostSchema: z.ZodObject<{
7315
7315
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
7316
7316
  id: z.ZodString;
7317
7317
  type: z.ZodEnum<{
7318
- resource: "resource";
7319
7318
  note: "note";
7320
7319
  question: "question";
7320
+ resource: "resource";
7321
7321
  event: "event";
7322
7322
  article: "article";
7323
7323
  }>;
@@ -9006,9 +9006,9 @@ export declare const publicPostSchema: z.ZodObject<{
9006
9006
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
9007
9007
  id: z.ZodString;
9008
9008
  type: z.ZodEnum<{
9009
- resource: "resource";
9010
9009
  note: "note";
9011
9010
  question: "question";
9011
+ resource: "resource";
9012
9012
  event: "event";
9013
9013
  article: "article";
9014
9014
  }>;
@@ -10963,9 +10963,9 @@ export declare const publicPostSchema: z.ZodObject<{
10963
10963
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
10964
10964
  id: z.ZodString;
10965
10965
  type: z.ZodEnum<{
10966
- resource: "resource";
10967
10966
  note: "note";
10968
10967
  question: "question";
10968
+ resource: "resource";
10969
10969
  event: "event";
10970
10970
  article: "article";
10971
10971
  }>;
@@ -12654,9 +12654,9 @@ export declare const publicPostSchema: z.ZodObject<{
12654
12654
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
12655
12655
  id: z.ZodString;
12656
12656
  type: z.ZodEnum<{
12657
- resource: "resource";
12658
12657
  note: "note";
12659
12658
  question: "question";
12659
+ resource: "resource";
12660
12660
  event: "event";
12661
12661
  article: "article";
12662
12662
  }>;
@@ -14347,9 +14347,9 @@ export declare const publicPostSchema: z.ZodObject<{
14347
14347
  repost: z.ZodNullable<z.ZodOptional<z.ZodObject<{
14348
14348
  id: z.ZodString;
14349
14349
  type: z.ZodEnum<{
14350
- resource: "resource";
14351
14350
  note: "note";
14352
14351
  question: "question";
14352
+ resource: "resource";
14353
14353
  event: "event";
14354
14354
  article: "article";
14355
14355
  }>;
@@ -16037,9 +16037,9 @@ export declare const publicPostSchema: z.ZodObject<{
16037
16037
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
16038
16038
  id: z.ZodString;
16039
16039
  type: z.ZodEnum<{
16040
- resource: "resource";
16041
16040
  note: "note";
16042
16041
  question: "question";
16042
+ resource: "resource";
16043
16043
  event: "event";
16044
16044
  article: "article";
16045
16045
  }>;
@@ -17959,9 +17959,9 @@ export declare const publicPostSchema: z.ZodObject<{
17959
17959
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
17960
17960
  id: z.ZodString;
17961
17961
  type: z.ZodEnum<{
17962
- resource: "resource";
17963
17962
  note: "note";
17964
17963
  question: "question";
17964
+ resource: "resource";
17965
17965
  event: "event";
17966
17966
  article: "article";
17967
17967
  }>;
@@ -19650,9 +19650,9 @@ export declare const publicPostSchema: z.ZodObject<{
19650
19650
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
19651
19651
  id: z.ZodString;
19652
19652
  type: z.ZodEnum<{
19653
- resource: "resource";
19654
19653
  note: "note";
19655
19654
  question: "question";
19655
+ resource: "resource";
19656
19656
  event: "event";
19657
19657
  article: "article";
19658
19658
  }>;
@@ -21871,9 +21871,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
21871
21871
  post: z.ZodOptional<z.ZodNullable<z.ZodObject<{
21872
21872
  id: z.ZodString;
21873
21873
  type: z.ZodEnum<{
21874
- resource: "resource";
21875
21874
  note: "note";
21876
21875
  question: "question";
21876
+ resource: "resource";
21877
21877
  event: "event";
21878
21878
  article: "article";
21879
21879
  }>;
@@ -23790,9 +23790,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
23790
23790
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
23791
23791
  id: z.ZodString;
23792
23792
  type: z.ZodEnum<{
23793
- resource: "resource";
23794
23793
  note: "note";
23795
23794
  question: "question";
23795
+ resource: "resource";
23796
23796
  event: "event";
23797
23797
  article: "article";
23798
23798
  }>;
@@ -25481,9 +25481,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
25481
25481
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
25482
25482
  id: z.ZodString;
25483
25483
  type: z.ZodEnum<{
25484
- resource: "resource";
25485
25484
  note: "note";
25486
25485
  question: "question";
25486
+ resource: "resource";
25487
25487
  event: "event";
25488
25488
  article: "article";
25489
25489
  }>;
@@ -27438,9 +27438,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
27438
27438
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
27439
27439
  id: z.ZodString;
27440
27440
  type: z.ZodEnum<{
27441
- resource: "resource";
27442
27441
  note: "note";
27443
27442
  question: "question";
27443
+ resource: "resource";
27444
27444
  event: "event";
27445
27445
  article: "article";
27446
27446
  }>;
@@ -29129,9 +29129,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
29129
29129
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
29130
29130
  id: z.ZodString;
29131
29131
  type: z.ZodEnum<{
29132
- resource: "resource";
29133
29132
  note: "note";
29134
29133
  question: "question";
29134
+ resource: "resource";
29135
29135
  event: "event";
29136
29136
  article: "article";
29137
29137
  }>;
@@ -30822,9 +30822,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
30822
30822
  repost: z.ZodNullable<z.ZodOptional<z.ZodObject<{
30823
30823
  id: z.ZodString;
30824
30824
  type: z.ZodEnum<{
30825
- resource: "resource";
30826
30825
  note: "note";
30827
30826
  question: "question";
30827
+ resource: "resource";
30828
30828
  event: "event";
30829
30829
  article: "article";
30830
30830
  }>;
@@ -32512,9 +32512,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
32512
32512
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
32513
32513
  id: z.ZodString;
32514
32514
  type: z.ZodEnum<{
32515
- resource: "resource";
32516
32515
  note: "note";
32517
32516
  question: "question";
32517
+ resource: "resource";
32518
32518
  event: "event";
32519
32519
  article: "article";
32520
32520
  }>;
@@ -34434,9 +34434,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
34434
34434
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
34435
34435
  id: z.ZodString;
34436
34436
  type: z.ZodEnum<{
34437
- resource: "resource";
34438
34437
  note: "note";
34439
34438
  question: "question";
34439
+ resource: "resource";
34440
34440
  event: "event";
34441
34441
  article: "article";
34442
34442
  }>;
@@ -36125,9 +36125,9 @@ export declare const publicNotificationSchema: z.ZodObject<{
36125
36125
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
36126
36126
  id: z.ZodString;
36127
36127
  type: z.ZodEnum<{
36128
- resource: "resource";
36129
36128
  note: "note";
36130
36129
  question: "question";
36130
+ resource: "resource";
36131
36131
  event: "event";
36132
36132
  article: "article";
36133
36133
  }>;
@@ -39367,9 +39367,9 @@ export declare const publicReportSchema: z.ZodObject<{
39367
39367
  reportedPosts: z.ZodArray<z.ZodObject<{
39368
39368
  id: z.ZodString;
39369
39369
  type: z.ZodEnum<{
39370
- resource: "resource";
39371
39370
  note: "note";
39372
39371
  question: "question";
39372
+ resource: "resource";
39373
39373
  event: "event";
39374
39374
  article: "article";
39375
39375
  }>;
@@ -41286,9 +41286,9 @@ export declare const publicReportSchema: z.ZodObject<{
41286
41286
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
41287
41287
  id: z.ZodString;
41288
41288
  type: z.ZodEnum<{
41289
- resource: "resource";
41290
41289
  note: "note";
41291
41290
  question: "question";
41291
+ resource: "resource";
41292
41292
  event: "event";
41293
41293
  article: "article";
41294
41294
  }>;
@@ -42977,9 +42977,9 @@ export declare const publicReportSchema: z.ZodObject<{
42977
42977
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
42978
42978
  id: z.ZodString;
42979
42979
  type: z.ZodEnum<{
42980
- resource: "resource";
42981
42980
  note: "note";
42982
42981
  question: "question";
42982
+ resource: "resource";
42983
42983
  event: "event";
42984
42984
  article: "article";
42985
42985
  }>;
@@ -44934,9 +44934,9 @@ export declare const publicReportSchema: z.ZodObject<{
44934
44934
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
44935
44935
  id: z.ZodString;
44936
44936
  type: z.ZodEnum<{
44937
- resource: "resource";
44938
44937
  note: "note";
44939
44938
  question: "question";
44939
+ resource: "resource";
44940
44940
  event: "event";
44941
44941
  article: "article";
44942
44942
  }>;
@@ -46625,9 +46625,9 @@ export declare const publicReportSchema: z.ZodObject<{
46625
46625
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
46626
46626
  id: z.ZodString;
46627
46627
  type: z.ZodEnum<{
46628
- resource: "resource";
46629
46628
  note: "note";
46630
46629
  question: "question";
46630
+ resource: "resource";
46631
46631
  event: "event";
46632
46632
  article: "article";
46633
46633
  }>;
@@ -48318,9 +48318,9 @@ export declare const publicReportSchema: z.ZodObject<{
48318
48318
  repost: z.ZodNullable<z.ZodOptional<z.ZodObject<{
48319
48319
  id: z.ZodString;
48320
48320
  type: z.ZodEnum<{
48321
- resource: "resource";
48322
48321
  note: "note";
48323
48322
  question: "question";
48323
+ resource: "resource";
48324
48324
  event: "event";
48325
48325
  article: "article";
48326
48326
  }>;
@@ -50008,9 +50008,9 @@ export declare const publicReportSchema: z.ZodObject<{
50008
50008
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
50009
50009
  id: z.ZodString;
50010
50010
  type: z.ZodEnum<{
50011
- resource: "resource";
50012
50011
  note: "note";
50013
50012
  question: "question";
50013
+ resource: "resource";
50014
50014
  event: "event";
50015
50015
  article: "article";
50016
50016
  }>;
@@ -51930,9 +51930,9 @@ export declare const publicReportSchema: z.ZodObject<{
51930
51930
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
51931
51931
  id: z.ZodString;
51932
51932
  type: z.ZodEnum<{
51933
- resource: "resource";
51934
51933
  note: "note";
51935
51934
  question: "question";
51935
+ resource: "resource";
51936
51936
  event: "event";
51937
51937
  article: "article";
51938
51938
  }>;
@@ -53621,9 +53621,9 @@ export declare const publicReportSchema: z.ZodObject<{
53621
53621
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
53622
53622
  id: z.ZodString;
53623
53623
  type: z.ZodEnum<{
53624
- resource: "resource";
53625
53624
  note: "note";
53626
53625
  question: "question";
53626
+ resource: "resource";
53627
53627
  event: "event";
53628
53628
  article: "article";
53629
53629
  }>;
@@ -55624,9 +55624,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
55624
55624
  message: z.ZodObject<{
55625
55625
  id: z.ZodString;
55626
55626
  type: z.ZodEnum<{
55627
- resource: "resource";
55628
55627
  note: "note";
55629
55628
  question: "question";
55629
+ resource: "resource";
55630
55630
  event: "event";
55631
55631
  article: "article";
55632
55632
  }>;
@@ -57543,9 +57543,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
57543
57543
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
57544
57544
  id: z.ZodString;
57545
57545
  type: z.ZodEnum<{
57546
- resource: "resource";
57547
57546
  note: "note";
57548
57547
  question: "question";
57548
+ resource: "resource";
57549
57549
  event: "event";
57550
57550
  article: "article";
57551
57551
  }>;
@@ -59234,9 +59234,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
59234
59234
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
59235
59235
  id: z.ZodString;
59236
59236
  type: z.ZodEnum<{
59237
- resource: "resource";
59238
59237
  note: "note";
59239
59238
  question: "question";
59239
+ resource: "resource";
59240
59240
  event: "event";
59241
59241
  article: "article";
59242
59242
  }>;
@@ -61191,9 +61191,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
61191
61191
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
61192
61192
  id: z.ZodString;
61193
61193
  type: z.ZodEnum<{
61194
- resource: "resource";
61195
61194
  note: "note";
61196
61195
  question: "question";
61196
+ resource: "resource";
61197
61197
  event: "event";
61198
61198
  article: "article";
61199
61199
  }>;
@@ -62882,9 +62882,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
62882
62882
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
62883
62883
  id: z.ZodString;
62884
62884
  type: z.ZodEnum<{
62885
- resource: "resource";
62886
62885
  note: "note";
62887
62886
  question: "question";
62887
+ resource: "resource";
62888
62888
  event: "event";
62889
62889
  article: "article";
62890
62890
  }>;
@@ -64575,9 +64575,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
64575
64575
  repost: z.ZodNullable<z.ZodOptional<z.ZodObject<{
64576
64576
  id: z.ZodString;
64577
64577
  type: z.ZodEnum<{
64578
- resource: "resource";
64579
64578
  note: "note";
64580
64579
  question: "question";
64580
+ resource: "resource";
64581
64581
  event: "event";
64582
64582
  article: "article";
64583
64583
  }>;
@@ -66265,9 +66265,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
66265
66265
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
66266
66266
  id: z.ZodString;
66267
66267
  type: z.ZodEnum<{
66268
- resource: "resource";
66269
66268
  note: "note";
66270
66269
  question: "question";
66270
+ resource: "resource";
66271
66271
  event: "event";
66272
66272
  article: "article";
66273
66273
  }>;
@@ -68187,9 +68187,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
68187
68187
  latestReplies: z.ZodOptional<z.ZodArray<z.ZodObject<{
68188
68188
  id: z.ZodString;
68189
68189
  type: z.ZodEnum<{
68190
- resource: "resource";
68191
68190
  note: "note";
68192
68191
  question: "question";
68192
+ resource: "resource";
68193
68193
  event: "event";
68194
68194
  article: "article";
68195
68195
  }>;
@@ -69878,9 +69878,9 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
69878
69878
  replyTo: z.ZodNullable<z.ZodOptional<z.ZodObject<{
69879
69879
  id: z.ZodString;
69880
69880
  type: z.ZodEnum<{
69881
- resource: "resource";
69882
69881
  note: "note";
69883
69882
  question: "question";
69883
+ resource: "resource";
69884
69884
  event: "event";
69885
69885
  article: "article";
69886
69886
  }>;
@@ -71846,9 +71846,9 @@ export declare const postCreationDataSchema: z.ZodObject<{
71846
71846
  direct: "direct";
71847
71847
  }>;
71848
71848
  type: z.ZodEnum<{
71849
- resource: "resource";
71850
71849
  note: "note";
71851
71850
  question: "question";
71851
+ resource: "resource";
71852
71852
  event: "event";
71853
71853
  article: "article";
71854
71854
  }>;
@@ -72374,9 +72374,9 @@ export declare const postCreationDataFormSchema: z.ZodObject<{
72374
72374
  direct: "direct";
72375
72375
  }>;
72376
72376
  type: z.ZodEnum<{
72377
- resource: "resource";
72378
72377
  note: "note";
72379
72378
  question: "question";
72379
+ resource: "resource";
72380
72380
  event: "event";
72381
72381
  article: "article";
72382
72382
  }>;
package/dist/types/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { notificationStatsSchema, pushNotificationSchema, } from './notifications.js';
3
- import { accessTokenSchema, accountInteractionsSchema, accountNameSchema, federatedHandleSchema, accountSchema, answerSchema, applicationDataSchema, groupDataSchema, groupRoleSchema, groupSchema, guestDataSchema, hashtagSchema, inviteLinkSchema, jamRecordingStatusSchema, latLngSchema, locationSchema, mediaAttachmentSchema, mentionDataSchema, postDataUnionSchema, postTypeSchema, profileDataSchema, profileStatsSchema, reactionDataSchema, roleDataSchema, reportDataSchema, reportSchema, resourceSchema, rsvpSchema, scopeSchema, visibilityTypeSchema, } from './models.js';
3
+ import { accessTokenSchema, accountInteractionsSchema, accountNameSchema, federatedHandleSchema, accountSchema, answerSchema, applicationDataSchema, groupDataSchema, groupRoleSchema, groupSchema, guestDataSchema, hashtagSchema, inviteLinkSchema, jamRecordingStatusSchema, latLngSchema, locationSchema, mediaAttachmentSchema, mentionDataSchema, postDataInputUnionSchema, postDataUnionSchema, postTypeSchema, profileDataSchema, profileStatsSchema, reactionDataSchema, roleDataSchema, reportDataSchema, reportSchema, resourceSchema, rsvpSchema, scopeSchema, visibilityTypeSchema, } from './models.js';
4
4
  import { groupWithMetaSchema } from './internal.js';
5
5
  import { communityConfigSchema } from './config.js';
6
6
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
@@ -515,7 +515,7 @@ export const directMessageSearchHitSchema = z.object({
515
515
  export const postCreationDataSchema = z.object({
516
516
  visibility: visibilityTypeSchema,
517
517
  type: postTypeSchema,
518
- data: postDataUnionSchema,
518
+ data: postDataInputUnionSchema,
519
519
  inReplyToId: z.uuid().nullable().optional(),
520
520
  mentions: mentionWithPublicProfileSchema.array().nullable().optional(),
521
521
  audience: publicProfileSchema.array().nullable().optional(),