@meith/threads 0.31.0 → 0.33.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.
- package/package.json +5 -5
- package/src/compose.ts +5 -0
- package/src/index.ts +2 -1
- package/src/read-state.ts +6 -0
- package/src/reply.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/threads",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@meith/core": "0.
|
|
23
|
-
"@meith/i18n": "0.
|
|
24
|
-
"@meith/markdown": "0.
|
|
25
|
-
"@meith/polls": "0.
|
|
22
|
+
"@meith/core": "0.33.0",
|
|
23
|
+
"@meith/i18n": "0.33.0",
|
|
24
|
+
"@meith/markdown": "0.33.0",
|
|
25
|
+
"@meith/polls": "0.33.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/compose.ts
CHANGED
|
@@ -30,11 +30,14 @@ export const UNRESTRICTED: AuthorRestriction = {
|
|
|
30
30
|
moderated: false,
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export type SubscriptionCadence = 'instant' | 'daily' | 'weekly'
|
|
34
|
+
|
|
33
35
|
export interface ComposeThreadInput {
|
|
34
36
|
readonly title: string
|
|
35
37
|
readonly message: string
|
|
36
38
|
readonly prefixId: number | null
|
|
37
39
|
readonly subscribe: boolean
|
|
40
|
+
readonly subscribeMode?: SubscriptionCadence
|
|
38
41
|
readonly poll?: NewPoll | undefined
|
|
39
42
|
readonly mayPostPoll?: boolean | undefined
|
|
40
43
|
readonly bypassesModeration: boolean
|
|
@@ -54,6 +57,7 @@ export interface NewThreadRecord {
|
|
|
54
57
|
readonly authorUsername: string
|
|
55
58
|
readonly visibility: 'visible' | 'unapproved'
|
|
56
59
|
readonly subscribe: boolean
|
|
60
|
+
readonly subscribeMode?: SubscriptionCadence
|
|
57
61
|
readonly poll?: ValidatedPoll | undefined
|
|
58
62
|
readonly createdAt: Date
|
|
59
63
|
}
|
|
@@ -179,6 +183,7 @@ export class ThreadComposer {
|
|
|
179
183
|
authorUsername: author.username,
|
|
180
184
|
visibility,
|
|
181
185
|
subscribe: input.subscribe,
|
|
186
|
+
subscribeMode: input.subscribeMode ?? 'instant',
|
|
182
187
|
poll,
|
|
183
188
|
createdAt: this.now(),
|
|
184
189
|
})
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export {
|
|
|
7
7
|
MESSAGE_MIN,
|
|
8
8
|
type NewThreadRecord,
|
|
9
9
|
type PrefixOption,
|
|
10
|
+
type SubscriptionCadence,
|
|
10
11
|
type ThreadAuthor,
|
|
11
12
|
ThreadComposer,
|
|
12
13
|
type ThreadComposerConfig,
|
|
@@ -17,7 +18,7 @@ export {
|
|
|
17
18
|
UNRESTRICTED,
|
|
18
19
|
} from './compose'
|
|
19
20
|
export type { ThreadLocation, ThreadRepository } from './ports'
|
|
20
|
-
export type { ReadState, ReadStateRepository } from './read-state'
|
|
21
|
+
export type { ReadState, ReadStateRepository, ThreadReadMarker } from './read-state'
|
|
21
22
|
export {
|
|
22
23
|
type ComposeReplyInput,
|
|
23
24
|
type CreatedReply,
|
package/src/read-state.ts
CHANGED
|
@@ -4,8 +4,14 @@ export interface ReadState {
|
|
|
4
4
|
readonly unreadForumIds: ReadonlySet<number>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export interface ThreadReadMarker {
|
|
8
|
+
readonly lastReadPostId: number | null
|
|
9
|
+
readonly forumReadAt: Date | null
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
export interface ReadStateRepository {
|
|
8
13
|
forUser(userId: number): Promise<ReadState>
|
|
14
|
+
markerFor(userId: number, threadId: number, forumId: number): Promise<ThreadReadMarker>
|
|
9
15
|
markForumsRead(userId: number, forumIds: readonly number[], at: Date): Promise<void>
|
|
10
16
|
markThreadRead(userId: number, threadId: number, postId: number, at: Date): Promise<void>
|
|
11
17
|
}
|
package/src/reply.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type AuthorRestriction,
|
|
7
7
|
type ForumPostingTarget,
|
|
8
8
|
MESSAGE_MIN,
|
|
9
|
+
type SubscriptionCadence,
|
|
9
10
|
type ThreadAuthor,
|
|
10
11
|
UNRESTRICTED,
|
|
11
12
|
} from './compose'
|
|
@@ -25,6 +26,7 @@ export interface ReplyTarget {
|
|
|
25
26
|
export interface ComposeReplyInput {
|
|
26
27
|
readonly message: string
|
|
27
28
|
readonly subscribe: boolean
|
|
29
|
+
readonly subscribeMode?: SubscriptionCadence
|
|
28
30
|
readonly seenLastPostId: number | null
|
|
29
31
|
readonly bypassesModeration: boolean
|
|
30
32
|
readonly heldAsNewMember: boolean
|
|
@@ -43,6 +45,7 @@ export interface NewReplyRecord {
|
|
|
43
45
|
readonly authorUsername: string
|
|
44
46
|
readonly visibility: 'visible' | 'unapproved'
|
|
45
47
|
readonly subscribe: boolean
|
|
48
|
+
readonly subscribeMode?: SubscriptionCadence
|
|
46
49
|
readonly createdAt: Date
|
|
47
50
|
}
|
|
48
51
|
|
|
@@ -130,6 +133,7 @@ export class ReplyComposer {
|
|
|
130
133
|
authorUsername: author.username,
|
|
131
134
|
visibility,
|
|
132
135
|
subscribe: input.subscribe,
|
|
136
|
+
subscribeMode: input.subscribeMode ?? 'instant',
|
|
133
137
|
createdAt: this.now(),
|
|
134
138
|
})
|
|
135
139
|
|