@atproto/bsky 0.0.4 → 0.0.6

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.
@@ -3472,6 +3472,50 @@ export declare const schemaDict: {
3472
3472
  };
3473
3473
  };
3474
3474
  };
3475
+ feedViewPref: {
3476
+ type: string;
3477
+ required: string[];
3478
+ properties: {
3479
+ feed: {
3480
+ type: string;
3481
+ description: string;
3482
+ };
3483
+ hideReplies: {
3484
+ type: string;
3485
+ description: string;
3486
+ };
3487
+ hideRepliesByUnfollowed: {
3488
+ type: string;
3489
+ description: string;
3490
+ };
3491
+ hideRepliesByLikeCount: {
3492
+ type: string;
3493
+ description: string;
3494
+ };
3495
+ hideReposts: {
3496
+ type: string;
3497
+ description: string;
3498
+ };
3499
+ hideQuotePosts: {
3500
+ type: string;
3501
+ description: string;
3502
+ };
3503
+ };
3504
+ };
3505
+ threadViewPref: {
3506
+ type: string;
3507
+ properties: {
3508
+ sort: {
3509
+ type: string;
3510
+ description: string;
3511
+ knownValues: string[];
3512
+ };
3513
+ prioritizeFollowedUsers: {
3514
+ type: string;
3515
+ description: string;
3516
+ };
3517
+ };
3518
+ };
3475
3519
  };
3476
3520
  };
3477
3521
  AppBskyActorGetPreferences: {
@@ -5342,10 +5386,12 @@ export declare const schemaDict: {
5342
5386
  mentionRule: {
5343
5387
  type: string;
5344
5388
  description: string;
5389
+ properties: {};
5345
5390
  };
5346
5391
  followingRule: {
5347
5392
  type: string;
5348
5393
  description: string;
5394
+ properties: {};
5349
5395
  };
5350
5396
  listRule: {
5351
5397
  type: string;
@@ -53,7 +53,7 @@ export interface ViewerState {
53
53
  }
54
54
  export declare function isViewerState(v: unknown): v is ViewerState;
55
55
  export declare function validateViewerState(v: unknown): ValidationResult;
56
- export declare type Preferences = (AdultContentPref | ContentLabelPref | SavedFeedsPref | PersonalDetailsPref | {
56
+ export declare type Preferences = (AdultContentPref | ContentLabelPref | SavedFeedsPref | PersonalDetailsPref | FeedViewPref | ThreadViewPref | {
57
57
  $type: string;
58
58
  [k: string]: unknown;
59
59
  })[];
@@ -83,3 +83,21 @@ export interface PersonalDetailsPref {
83
83
  }
84
84
  export declare function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref;
85
85
  export declare function validatePersonalDetailsPref(v: unknown): ValidationResult;
86
+ export interface FeedViewPref {
87
+ feed: string;
88
+ hideReplies?: boolean;
89
+ hideRepliesByUnfollowed?: boolean;
90
+ hideRepliesByLikeCount?: number;
91
+ hideReposts?: boolean;
92
+ hideQuotePosts?: boolean;
93
+ [k: string]: unknown;
94
+ }
95
+ export declare function isFeedViewPref(v: unknown): v is FeedViewPref;
96
+ export declare function validateFeedViewPref(v: unknown): ValidationResult;
97
+ export interface ThreadViewPref {
98
+ sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {});
99
+ prioritizeFollowedUsers?: boolean;
100
+ [k: string]: unknown;
101
+ }
102
+ export declare function isThreadViewPref(v: unknown): v is ThreadViewPref;
103
+ export declare function validateThreadViewPref(v: unknown): ValidationResult;
@@ -11,10 +11,12 @@ export interface Record {
11
11
  export declare function isRecord(v: unknown): v is Record;
12
12
  export declare function validateRecord(v: unknown): ValidationResult;
13
13
  export interface MentionRule {
14
+ [k: string]: unknown;
14
15
  }
15
16
  export declare function isMentionRule(v: unknown): v is MentionRule;
16
17
  export declare function validateMentionRule(v: unknown): ValidationResult;
17
18
  export interface FollowingRule {
19
+ [k: string]: unknown;
18
20
  }
19
21
  export declare function isFollowingRule(v: unknown): v is FollowingRule;
20
22
  export declare function validateFollowingRule(v: unknown): ValidationResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsky",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,14 +31,14 @@
31
31
  "sharp": "^0.31.2",
32
32
  "typed-emitter": "^2.1.0",
33
33
  "uint8arrays": "3.0.0",
34
- "@atproto/api": "^0.6.13",
34
+ "@atproto/api": "^0.6.15",
35
35
  "@atproto/common": "^0.3.0",
36
36
  "@atproto/crypto": "^0.2.2",
37
- "@atproto/syntax": "^0.1.0",
37
+ "@atproto/syntax": "^0.1.1",
38
38
  "@atproto/identity": "^0.2.0",
39
- "@atproto/lexicon": "^0.2.0",
40
- "@atproto/repo": "^0.3.0",
41
- "@atproto/xrpc-server": "^0.3.0"
39
+ "@atproto/lexicon": "^0.2.1",
40
+ "@atproto/repo": "^0.3.1",
41
+ "@atproto/xrpc-server": "^0.3.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@did-plc/server": "^0.0.1",
@@ -49,11 +49,11 @@
49
49
  "@types/qs": "^6.9.7",
50
50
  "@types/sharp": "^0.31.0",
51
51
  "axios": "^0.27.2",
52
- "@atproto/api": "^0.6.13",
53
- "@atproto/dev-env": "^0.2.4",
54
- "@atproto/lex-cli": "^0.2.0",
55
- "@atproto/pds": "^0.1.13",
56
- "@atproto/xrpc": "^0.3.0"
52
+ "@atproto/api": "^0.6.15",
53
+ "@atproto/dev-env": "^0.2.6",
54
+ "@atproto/lex-cli": "^0.2.1",
55
+ "@atproto/pds": "^0.1.15",
56
+ "@atproto/xrpc": "^0.3.1"
57
57
  },
58
58
  "scripts": {
59
59
  "codegen": "lex gen-server ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
@@ -140,7 +140,9 @@ const composeThread = (
140
140
  // b. may not appear anywhere else in the thread.
141
141
  const isAnchorPost = state.threadData.post.uri === threadData.post.postUri
142
142
  const info = posts[threadData.post.postUri]
143
- const badReply = !!info?.invalidReplyRoot || !!info?.violatesThreadGate
143
+ // @TODO re-enable invalidReplyRoot check
144
+ // const badReply = !!info?.invalidReplyRoot || !!info?.violatesThreadGate
145
+ const badReply = !!info?.violatesThreadGate
144
146
  const omitBadReply = !isAnchorPost && badReply
145
147
 
146
148
  if (!post || blocks[post.uri]?.reply || omitBadReply) {
@@ -312,7 +314,9 @@ const checkViewerCanReply = async (
312
314
  threadgate: ThreadgateRecord | null,
313
315
  ) => {
314
316
  if (!viewer) return false
315
- if (anchor?.invalidReplyRoot || anchor?.violatesThreadGate) return false
317
+ // @TODO re-enable invalidReplyRoot check
318
+ // if (anchor?.invalidReplyRoot || anchor?.violatesThreadGate) return false
319
+ if (anchor?.violatesThreadGate) return false
316
320
  const viewerViolatesThreadGate = await violatesThreadGate(
317
321
  db,
318
322
  viewer,
@@ -3687,6 +3687,8 @@ export const schemaDict = {
3687
3687
  'lex:app.bsky.actor.defs#contentLabelPref',
3688
3688
  'lex:app.bsky.actor.defs#savedFeedsPref',
3689
3689
  'lex:app.bsky.actor.defs#personalDetailsPref',
3690
+ 'lex:app.bsky.actor.defs#feedViewPref',
3691
+ 'lex:app.bsky.actor.defs#threadViewPref',
3690
3692
  ],
3691
3693
  },
3692
3694
  },
@@ -3743,6 +3745,53 @@ export const schemaDict = {
3743
3745
  },
3744
3746
  },
3745
3747
  },
3748
+ feedViewPref: {
3749
+ type: 'object',
3750
+ required: ['feed'],
3751
+ properties: {
3752
+ feed: {
3753
+ type: 'string',
3754
+ description:
3755
+ 'The URI of the feed, or an identifier which describes the feed.',
3756
+ },
3757
+ hideReplies: {
3758
+ type: 'boolean',
3759
+ description: 'Hide replies in the feed.',
3760
+ },
3761
+ hideRepliesByUnfollowed: {
3762
+ type: 'boolean',
3763
+ description:
3764
+ 'Hide replies in the feed if they are not by followed users.',
3765
+ },
3766
+ hideRepliesByLikeCount: {
3767
+ type: 'integer',
3768
+ description:
3769
+ 'Hide replies in the feed if they do not have this number of likes.',
3770
+ },
3771
+ hideReposts: {
3772
+ type: 'boolean',
3773
+ description: 'Hide reposts in the feed.',
3774
+ },
3775
+ hideQuotePosts: {
3776
+ type: 'boolean',
3777
+ description: 'Hide quote posts in the feed.',
3778
+ },
3779
+ },
3780
+ },
3781
+ threadViewPref: {
3782
+ type: 'object',
3783
+ properties: {
3784
+ sort: {
3785
+ type: 'string',
3786
+ description: 'Sorting mode.',
3787
+ knownValues: ['oldest', 'newest', 'most-likes', 'random'],
3788
+ },
3789
+ prioritizeFollowedUsers: {
3790
+ type: 'boolean',
3791
+ description: 'Show followed users at the top of all replies.',
3792
+ },
3793
+ },
3794
+ },
3746
3795
  },
3747
3796
  },
3748
3797
  AppBskyActorGetPreferences: {
@@ -5693,10 +5742,12 @@ export const schemaDict = {
5693
5742
  mentionRule: {
5694
5743
  type: 'object',
5695
5744
  description: 'Allow replies from actors mentioned in your post.',
5745
+ properties: {},
5696
5746
  },
5697
5747
  followingRule: {
5698
5748
  type: 'object',
5699
5749
  description: 'Allow replies from actors you follow.',
5750
+ properties: {},
5700
5751
  },
5701
5752
  listRule: {
5702
5753
  type: 'object',
@@ -109,6 +109,8 @@ export type Preferences = (
109
109
  | ContentLabelPref
110
110
  | SavedFeedsPref
111
111
  | PersonalDetailsPref
112
+ | FeedViewPref
113
+ | ThreadViewPref
112
114
  | { $type: string; [k: string]: unknown }
113
115
  )[]
114
116
 
@@ -182,3 +184,51 @@ export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref {
182
184
  export function validatePersonalDetailsPref(v: unknown): ValidationResult {
183
185
  return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v)
184
186
  }
187
+
188
+ export interface FeedViewPref {
189
+ /** The URI of the feed, or an identifier which describes the feed. */
190
+ feed: string
191
+ /** Hide replies in the feed. */
192
+ hideReplies?: boolean
193
+ /** Hide replies in the feed if they are not by followed users. */
194
+ hideRepliesByUnfollowed?: boolean
195
+ /** Hide replies in the feed if they do not have this number of likes. */
196
+ hideRepliesByLikeCount?: number
197
+ /** Hide reposts in the feed. */
198
+ hideReposts?: boolean
199
+ /** Hide quote posts in the feed. */
200
+ hideQuotePosts?: boolean
201
+ [k: string]: unknown
202
+ }
203
+
204
+ export function isFeedViewPref(v: unknown): v is FeedViewPref {
205
+ return (
206
+ isObj(v) &&
207
+ hasProp(v, '$type') &&
208
+ v.$type === 'app.bsky.actor.defs#feedViewPref'
209
+ )
210
+ }
211
+
212
+ export function validateFeedViewPref(v: unknown): ValidationResult {
213
+ return lexicons.validate('app.bsky.actor.defs#feedViewPref', v)
214
+ }
215
+
216
+ export interface ThreadViewPref {
217
+ /** Sorting mode. */
218
+ sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {})
219
+ /** Show followed users at the top of all replies. */
220
+ prioritizeFollowedUsers?: boolean
221
+ [k: string]: unknown
222
+ }
223
+
224
+ export function isThreadViewPref(v: unknown): v is ThreadViewPref {
225
+ return (
226
+ isObj(v) &&
227
+ hasProp(v, '$type') &&
228
+ v.$type === 'app.bsky.actor.defs#threadViewPref'
229
+ )
230
+ }
231
+
232
+ export function validateThreadViewPref(v: unknown): ValidationResult {
233
+ return lexicons.validate('app.bsky.actor.defs#threadViewPref', v)
234
+ }
@@ -32,7 +32,9 @@ export function validateRecord(v: unknown): ValidationResult {
32
32
  }
33
33
 
34
34
  /** Allow replies from actors mentioned in your post. */
35
- export interface MentionRule {}
35
+ export interface MentionRule {
36
+ [k: string]: unknown
37
+ }
36
38
 
37
39
  export function isMentionRule(v: unknown): v is MentionRule {
38
40
  return (
@@ -47,7 +49,9 @@ export function validateMentionRule(v: unknown): ValidationResult {
47
49
  }
48
50
 
49
51
  /** Allow replies from actors you follow. */
50
- export interface FollowingRule {}
52
+ export interface FollowingRule {
53
+ [k: string]: unknown
54
+ }
51
55
 
52
56
  export function isFollowingRule(v: unknown): v is FollowingRule {
53
57
  return (