@atproto/api 0.6.2 → 0.6.4
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/dist/client/lexicons.d.ts +28 -0
- package/dist/client/types/app/bsky/embed/record.d.ts +3 -0
- package/dist/client/types/com/atproto/admin/defs.d.ts +3 -0
- package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +1 -0
- package/dist/index.js +60 -9
- package/dist/index.js.map +2 -2
- package/dist/moderation/accumulator.d.ts +1 -0
- package/dist/moderation/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/client/lexicons.ts +34 -2
- package/src/client/types/app/bsky/embed/record.ts +3 -0
- package/src/client/types/com/atproto/admin/defs.ts +6 -0
- package/src/client/types/com/atproto/admin/takeModerationAction.ts +2 -0
- package/src/moderation/accumulator.ts +15 -1
- package/src/moderation/subjects/quoted-post.ts +18 -0
- package/src/moderation/types.ts +1 -0
- package/src/moderation/util.ts +2 -14
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/client/types/app/bsky/actor/createScene.d.ts +0 -32
- package/dist/client/types/app/bsky/actor/ref.d.ts +0 -28
- package/dist/client/types/app/bsky/actor/search.d.ts +0 -22
- package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +0 -20
- package/dist/client/types/app/bsky/actor/updateProfile.d.ts +0 -40
- package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +0 -28
- package/dist/client/types/app/bsky/feed/getSavedFeeds.d.ts +0 -21
- package/dist/client/types/app/bsky/feed/getVotes.d.ts +0 -36
- package/dist/client/types/app/bsky/feed/saveFeed.d.ts +0 -17
- package/dist/client/types/app/bsky/feed/setVote.d.ts +0 -25
- package/dist/client/types/app/bsky/feed/trend.d.ts +0 -9
- package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +0 -17
- package/dist/client/types/app/bsky/feed/vote.d.ts +0 -10
- package/dist/client/types/app/bsky/graph/assertCreator.d.ts +0 -1
- package/dist/client/types/app/bsky/graph/assertMember.d.ts +0 -1
- package/dist/client/types/app/bsky/graph/assertion.d.ts +0 -10
- package/dist/client/types/app/bsky/graph/confirmation.d.ts +0 -11
- package/dist/client/types/app/bsky/graph/getAssertions.d.ts +0 -48
- package/dist/client/types/app/bsky/graph/getListBlocks.d.ts +0 -21
- package/dist/client/types/app/bsky/graph/getMembers.d.ts +0 -36
- package/dist/client/types/app/bsky/graph/getMemberships.d.ts +0 -36
- package/dist/client/types/app/bsky/graph/listblock.d.ts +0 -8
- package/dist/client/types/app/bsky/graph/mute.d.ts +0 -17
- package/dist/client/types/app/bsky/graph/subscribeMuteList.d.ts +0 -17
- package/dist/client/types/app/bsky/graph/unmute.d.ts +0 -17
- package/dist/client/types/app/bsky/graph/unsubscribeMuteList.d.ts +0 -17
- package/dist/client/types/app/bsky/notification/getCount.d.ts +0 -17
- package/dist/client/types/app/bsky/notification/list.d.ts +0 -35
- package/dist/client/types/app/bsky/system/actorScene.d.ts +0 -1
- package/dist/client/types/app/bsky/system/actorUser.d.ts +0 -1
- package/dist/client/types/app/bsky/system/declRef.d.ts +0 -8
- package/dist/client/types/app/bsky/system/declaration.d.ts +0 -7
- package/dist/client/types/com/atproto/account/create.d.ts +0 -41
- package/dist/client/types/com/atproto/account/createInviteCode.d.ts +0 -22
- package/dist/client/types/com/atproto/account/delete.d.ts +0 -25
- package/dist/client/types/com/atproto/account/get.d.ts +0 -12
- package/dist/client/types/com/atproto/account/requestDelete.d.ts +0 -13
- package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +0 -17
- package/dist/client/types/com/atproto/account/resetPassword.d.ts +0 -24
- package/dist/client/types/com/atproto/admin/blob.d.ts +0 -37
- package/dist/client/types/com/atproto/admin/moderationAction.d.ts +0 -60
- package/dist/client/types/com/atproto/admin/moderationReport.d.ts +0 -37
- package/dist/client/types/com/atproto/admin/record.d.ts +0 -43
- package/dist/client/types/com/atproto/admin/repo.d.ts +0 -45
- package/dist/client/types/com/atproto/blob/upload.d.ts +0 -19
- package/dist/client/types/com/atproto/handle/resolve.d.ts +0 -18
- package/dist/client/types/com/atproto/handle/update.d.ts +0 -17
- package/dist/client/types/com/atproto/repo/batchWrite.d.ts +0 -46
- package/dist/client/types/com/atproto/repo/describe.d.ts +0 -22
- package/dist/client/types/com/atproto/repo/recordRef.d.ts +0 -8
- package/dist/client/types/com/atproto/repo/repoRef.d.ts +0 -7
- package/dist/client/types/com/atproto/report/create.d.ts +0 -39
- package/dist/client/types/com/atproto/report/reasonType.d.ts +0 -3
- package/dist/client/types/com/atproto/report/subject.d.ts +0 -23
- package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +0 -27
- package/dist/client/types/com/atproto/session/create.d.ts +0 -29
- package/dist/client/types/com/atproto/session/delete.d.ts +0 -13
- package/dist/client/types/com/atproto/session/get.d.ts +0 -18
- package/dist/client/types/com/atproto/session/refresh.d.ts +0 -24
- package/dist/client/types/com/atproto/sync/getRoot.d.ts +0 -18
- package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +0 -9
- package/dist/client/types/com/atproto/sync/updateRepo.d.ts +0 -15
- package/dist/helpers/bsky.d.ts +0 -20
- package/dist/mixins/bsky.d.ts +0 -23
- package/dist/rich-text/sanitize.d.ts +0 -4
- package/dist/session.d.ts +0 -42
|
@@ -7,6 +7,7 @@ export declare class ModerationCauseAccumulator {
|
|
|
7
7
|
setDid(did: string): void;
|
|
8
8
|
addBlocking(blocking: string | undefined): void;
|
|
9
9
|
addBlockedBy(blockedBy: boolean | undefined): void;
|
|
10
|
+
addBlockOther(blockOther: boolean | undefined): void;
|
|
10
11
|
addLabel(label: Label, opts: ModerationOpts): void;
|
|
11
12
|
addMuted(muted: boolean | undefined): void;
|
|
12
13
|
addMutedByList(mutedByList: AppBskyGraphDefs.ListViewBasic | undefined): void;
|
|
@@ -61,6 +61,10 @@ export declare type ModerationCause = {
|
|
|
61
61
|
type: 'blocked-by';
|
|
62
62
|
source: ModerationCauseSource;
|
|
63
63
|
priority: 4;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'block-other';
|
|
66
|
+
source: ModerationCauseSource;
|
|
67
|
+
priority: 4;
|
|
64
68
|
} | {
|
|
65
69
|
type: 'label';
|
|
66
70
|
source: ModerationCauseSource;
|
package/package.json
CHANGED
package/src/client/lexicons.ts
CHANGED
|
@@ -28,6 +28,11 @@ export const schemaDict = {
|
|
|
28
28
|
type: 'ref',
|
|
29
29
|
ref: 'lex:com.atproto.admin.defs#actionType',
|
|
30
30
|
},
|
|
31
|
+
durationInHours: {
|
|
32
|
+
type: 'integer',
|
|
33
|
+
description:
|
|
34
|
+
'Indicates how long this action was meant to be in effect before automatically expiring.',
|
|
35
|
+
},
|
|
31
36
|
subject: {
|
|
32
37
|
type: 'union',
|
|
33
38
|
refs: [
|
|
@@ -96,6 +101,11 @@ export const schemaDict = {
|
|
|
96
101
|
type: 'ref',
|
|
97
102
|
ref: 'lex:com.atproto.admin.defs#actionType',
|
|
98
103
|
},
|
|
104
|
+
durationInHours: {
|
|
105
|
+
type: 'integer',
|
|
106
|
+
description:
|
|
107
|
+
'Indicates how long this action was meant to be in effect before automatically expiring.',
|
|
108
|
+
},
|
|
99
109
|
subject: {
|
|
100
110
|
type: 'union',
|
|
101
111
|
refs: [
|
|
@@ -159,6 +169,11 @@ export const schemaDict = {
|
|
|
159
169
|
type: 'ref',
|
|
160
170
|
ref: 'lex:com.atproto.admin.defs#actionType',
|
|
161
171
|
},
|
|
172
|
+
durationInHours: {
|
|
173
|
+
type: 'integer',
|
|
174
|
+
description:
|
|
175
|
+
'Indicates how long this action was meant to be in effect before automatically expiring.',
|
|
176
|
+
},
|
|
162
177
|
},
|
|
163
178
|
},
|
|
164
179
|
actionReversal: {
|
|
@@ -1264,6 +1279,11 @@ export const schemaDict = {
|
|
|
1264
1279
|
reason: {
|
|
1265
1280
|
type: 'string',
|
|
1266
1281
|
},
|
|
1282
|
+
durationInHours: {
|
|
1283
|
+
type: 'integer',
|
|
1284
|
+
description:
|
|
1285
|
+
'Indicates how long this action was meant to be in effect before automatically expiring.',
|
|
1286
|
+
},
|
|
1267
1287
|
createdBy: {
|
|
1268
1288
|
type: 'string',
|
|
1269
1289
|
format: 'did',
|
|
@@ -4283,22 +4303,34 @@ export const schemaDict = {
|
|
|
4283
4303
|
},
|
|
4284
4304
|
viewNotFound: {
|
|
4285
4305
|
type: 'object',
|
|
4286
|
-
required: ['uri'],
|
|
4306
|
+
required: ['uri', 'notFound'],
|
|
4287
4307
|
properties: {
|
|
4288
4308
|
uri: {
|
|
4289
4309
|
type: 'string',
|
|
4290
4310
|
format: 'at-uri',
|
|
4291
4311
|
},
|
|
4312
|
+
notFound: {
|
|
4313
|
+
type: 'boolean',
|
|
4314
|
+
const: true,
|
|
4315
|
+
},
|
|
4292
4316
|
},
|
|
4293
4317
|
},
|
|
4294
4318
|
viewBlocked: {
|
|
4295
4319
|
type: 'object',
|
|
4296
|
-
required: ['uri'],
|
|
4320
|
+
required: ['uri', 'blocked', 'author'],
|
|
4297
4321
|
properties: {
|
|
4298
4322
|
uri: {
|
|
4299
4323
|
type: 'string',
|
|
4300
4324
|
format: 'at-uri',
|
|
4301
4325
|
},
|
|
4326
|
+
blocked: {
|
|
4327
|
+
type: 'boolean',
|
|
4328
|
+
const: true,
|
|
4329
|
+
},
|
|
4330
|
+
author: {
|
|
4331
|
+
type: 'ref',
|
|
4332
|
+
ref: 'lex:app.bsky.feed.defs#blockedAuthor',
|
|
4333
|
+
},
|
|
4302
4334
|
},
|
|
4303
4335
|
},
|
|
4304
4336
|
},
|
|
@@ -84,6 +84,7 @@ export function validateViewRecord(v: unknown): ValidationResult {
|
|
|
84
84
|
|
|
85
85
|
export interface ViewNotFound {
|
|
86
86
|
uri: string
|
|
87
|
+
notFound: true
|
|
87
88
|
[k: string]: unknown
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -101,6 +102,8 @@ export function validateViewNotFound(v: unknown): ValidationResult {
|
|
|
101
102
|
|
|
102
103
|
export interface ViewBlocked {
|
|
103
104
|
uri: string
|
|
105
|
+
blocked: true
|
|
106
|
+
author: AppBskyFeedDefs.BlockedAuthor
|
|
104
107
|
[k: string]: unknown
|
|
105
108
|
}
|
|
106
109
|
|
|
@@ -13,6 +13,8 @@ import * as ComAtprotoLabelDefs from '../label/defs'
|
|
|
13
13
|
export interface ActionView {
|
|
14
14
|
id: number
|
|
15
15
|
action: ActionType
|
|
16
|
+
/** Indicates how long this action was meant to be in effect before automatically expiring. */
|
|
17
|
+
durationInHours?: number
|
|
16
18
|
subject:
|
|
17
19
|
| RepoRef
|
|
18
20
|
| ComAtprotoRepoStrongRef.Main
|
|
@@ -43,6 +45,8 @@ export function validateActionView(v: unknown): ValidationResult {
|
|
|
43
45
|
export interface ActionViewDetail {
|
|
44
46
|
id: number
|
|
45
47
|
action: ActionType
|
|
48
|
+
/** Indicates how long this action was meant to be in effect before automatically expiring. */
|
|
49
|
+
durationInHours?: number
|
|
46
50
|
subject:
|
|
47
51
|
| RepoView
|
|
48
52
|
| RepoViewNotFound
|
|
@@ -75,6 +79,8 @@ export function validateActionViewDetail(v: unknown): ValidationResult {
|
|
|
75
79
|
export interface ActionViewCurrent {
|
|
76
80
|
id: number
|
|
77
81
|
action: ActionType
|
|
82
|
+
/** Indicates how long this action was meant to be in effect before automatically expiring. */
|
|
83
|
+
durationInHours?: number
|
|
78
84
|
[k: string]: unknown
|
|
79
85
|
}
|
|
80
86
|
|
|
@@ -25,6 +25,8 @@ export interface InputSchema {
|
|
|
25
25
|
createLabelVals?: string[]
|
|
26
26
|
negateLabelVals?: string[]
|
|
27
27
|
reason: string
|
|
28
|
+
/** Indicates how long this action was meant to be in effect before automatically expiring. */
|
|
29
|
+
durationInHours?: number
|
|
28
30
|
createdBy: string
|
|
29
31
|
[k: string]: unknown
|
|
30
32
|
}
|
|
@@ -38,6 +38,16 @@ export class ModerationCauseAccumulator {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
addBlockOther(blockOther: boolean | undefined) {
|
|
42
|
+
if (blockOther) {
|
|
43
|
+
this.causes.push({
|
|
44
|
+
type: 'block-other',
|
|
45
|
+
source: { type: 'user' },
|
|
46
|
+
priority: 4,
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
addLabel(label: Label, opts: ModerationOpts) {
|
|
42
52
|
// look up the label definition
|
|
43
53
|
const labelDef = LABELS[label.val]
|
|
@@ -134,7 +144,11 @@ export class ModerationCauseAccumulator {
|
|
|
134
144
|
mod.additionalCauses = this.causes.slice(1)
|
|
135
145
|
|
|
136
146
|
// blocked user
|
|
137
|
-
if (
|
|
147
|
+
if (
|
|
148
|
+
mod.cause.type === 'blocking' ||
|
|
149
|
+
mod.cause.type === 'blocked-by' ||
|
|
150
|
+
mod.cause.type === 'block-other'
|
|
151
|
+
) {
|
|
138
152
|
// filter and blur, dont allow override
|
|
139
153
|
mod.filter = true
|
|
140
154
|
mod.blur = true
|
|
@@ -17,6 +17,15 @@ export function decideQuotedPost(
|
|
|
17
17
|
acc.addLabel(label, opts)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
} else if (AppBskyEmbedRecord.isViewBlocked(subject.record)) {
|
|
21
|
+
acc.setDid(subject.record.author.did)
|
|
22
|
+
if (subject.record.author.viewer?.blocking) {
|
|
23
|
+
acc.addBlocking(subject.record.author.viewer?.blocking)
|
|
24
|
+
} else if (subject.record.author.viewer?.blockedBy) {
|
|
25
|
+
acc.addBlockedBy(subject.record.author.viewer?.blockedBy)
|
|
26
|
+
} else {
|
|
27
|
+
acc.addBlockOther(true)
|
|
28
|
+
}
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
return acc.finalizeDecision(opts)
|
|
@@ -46,6 +55,15 @@ export function decideQuotedPostWithMedia(
|
|
|
46
55
|
acc.addLabel(label, opts)
|
|
47
56
|
}
|
|
48
57
|
}
|
|
58
|
+
} else if (AppBskyEmbedRecord.isViewBlocked(subject.record.record)) {
|
|
59
|
+
acc.setDid(subject.record.record.author.did)
|
|
60
|
+
if (subject.record.record.author.viewer?.blocking) {
|
|
61
|
+
acc.addBlocking(subject.record.record.author.viewer?.blocking)
|
|
62
|
+
} else if (subject.record.record.author.viewer?.blockedBy) {
|
|
63
|
+
acc.addBlockedBy(subject.record.record.author.viewer?.blockedBy)
|
|
64
|
+
} else {
|
|
65
|
+
acc.addBlockOther(true)
|
|
66
|
+
}
|
|
49
67
|
}
|
|
50
68
|
|
|
51
69
|
return acc.finalizeDecision(opts)
|
package/src/moderation/types.ts
CHANGED
|
@@ -100,6 +100,7 @@ export type ModerationCauseSource =
|
|
|
100
100
|
export type ModerationCause =
|
|
101
101
|
| { type: 'blocking'; source: ModerationCauseSource; priority: 3 }
|
|
102
102
|
| { type: 'blocked-by'; source: ModerationCauseSource; priority: 4 }
|
|
103
|
+
| { type: 'block-other'; source: ModerationCauseSource; priority: 4 }
|
|
103
104
|
| {
|
|
104
105
|
type: 'label'
|
|
105
106
|
source: ModerationCauseSource
|
package/src/moderation/util.ts
CHANGED
|
@@ -70,25 +70,13 @@ export function isModerationDecisionNoop(
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export function isQuotedPost(embed: unknown): embed is AppBskyEmbedRecord.View {
|
|
73
|
-
return Boolean(
|
|
74
|
-
embed &&
|
|
75
|
-
AppBskyEmbedRecord.isView(embed) &&
|
|
76
|
-
AppBskyEmbedRecord.isViewRecord(embed.record) &&
|
|
77
|
-
AppBskyFeedPost.isRecord(embed.record.value) &&
|
|
78
|
-
AppBskyFeedPost.validateRecord(embed.record.value).success,
|
|
79
|
-
)
|
|
73
|
+
return Boolean(embed && AppBskyEmbedRecord.isView(embed))
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
export function isQuotedPostWithMedia(
|
|
83
77
|
embed: unknown,
|
|
84
78
|
): embed is AppBskyEmbedRecordWithMedia.View {
|
|
85
|
-
return Boolean(
|
|
86
|
-
embed &&
|
|
87
|
-
AppBskyEmbedRecordWithMedia.isView(embed) &&
|
|
88
|
-
AppBskyEmbedRecord.isViewRecord(embed.record.record) &&
|
|
89
|
-
AppBskyFeedPost.isRecord(embed.record.record.value) &&
|
|
90
|
-
AppBskyFeedPost.validateRecord(embed.record.record.value).success,
|
|
91
|
-
)
|
|
79
|
+
return Boolean(embed && AppBskyEmbedRecordWithMedia.isView(embed))
|
|
92
80
|
}
|
|
93
81
|
|
|
94
82
|
export function toModerationUI(decision: ModerationDecision): ModerationUI {
|