@atproto/api 0.6.10 → 0.6.11
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/LICENSE +21 -0
- package/README.md +45 -36
- package/bench/agent.bench.ts +2 -2
- package/build.js +0 -8
- package/definitions/labels.json +7 -1
- package/definitions/locale/en/label-groups.json +1 -1
- package/definitions/locale/en/labels.json +15 -1
- package/definitions/locale/en/proposed-label-groups.json +1 -1
- package/definitions/locale/en/proposed-labels.json +1 -1
- package/definitions/post-moderation-behaviors.json +315 -231
- package/definitions/profile-moderation-behaviors.json +188 -117
- package/definitions/proposed-labels.json +1 -1
- package/dist/client/lexicons.d.ts +33 -0
- package/dist/client/types/app/bsky/actor/createScene.d.ts +32 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +7 -1
- package/dist/client/types/app/bsky/actor/ref.d.ts +28 -0
- package/dist/client/types/app/bsky/actor/search.d.ts +22 -0
- package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +20 -0
- package/dist/client/types/app/bsky/actor/updateProfile.d.ts +40 -0
- package/dist/client/types/app/bsky/embed/images.d.ts +9 -0
- package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +28 -0
- package/dist/client/types/app/bsky/feed/getVotes.d.ts +36 -0
- package/dist/client/types/app/bsky/feed/saveFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/setVote.d.ts +25 -0
- package/dist/client/types/app/bsky/feed/trend.d.ts +9 -0
- package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/vote.d.ts +10 -0
- package/dist/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/assertMember.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/assertion.d.ts +10 -0
- package/dist/client/types/app/bsky/graph/confirmation.d.ts +11 -0
- package/dist/client/types/app/bsky/graph/getAssertions.d.ts +48 -0
- package/dist/client/types/app/bsky/{actor/getFeedSuggestions.d.ts → graph/getListBlocks.d.ts} +2 -2
- package/dist/client/types/app/bsky/graph/getMembers.d.ts +36 -0
- package/dist/client/types/app/bsky/graph/getMemberships.d.ts +36 -0
- package/dist/client/types/app/bsky/graph/listblock.d.ts +8 -0
- package/dist/client/types/app/bsky/graph/mute.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/subscribeMuteList.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/unmute.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/unsubscribeMuteList.d.ts +17 -0
- package/dist/client/types/app/bsky/notification/getCount.d.ts +17 -0
- package/dist/client/types/app/bsky/notification/list.d.ts +35 -0
- package/dist/client/types/app/bsky/system/actorScene.d.ts +1 -0
- package/dist/client/types/app/bsky/system/actorUser.d.ts +1 -0
- package/dist/client/types/app/bsky/system/declRef.d.ts +8 -0
- package/dist/client/types/app/bsky/system/declaration.d.ts +7 -0
- package/dist/client/types/app/bsky/unspecced/registerPushNotification.d.ts +16 -0
- package/dist/client/types/com/atproto/account/create.d.ts +41 -0
- package/dist/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
- package/dist/client/types/com/atproto/account/delete.d.ts +25 -0
- package/dist/client/types/com/atproto/account/get.d.ts +12 -0
- package/dist/client/types/com/atproto/account/requestDelete.d.ts +13 -0
- package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
- package/dist/client/types/com/atproto/account/resetPassword.d.ts +24 -0
- package/dist/client/types/com/atproto/admin/blob.d.ts +37 -0
- package/dist/client/types/com/atproto/admin/moderationAction.d.ts +60 -0
- package/dist/client/types/com/atproto/admin/moderationReport.d.ts +37 -0
- package/dist/client/types/com/atproto/admin/rebaseRepo.d.ts +24 -0
- package/dist/client/types/com/atproto/admin/record.d.ts +43 -0
- package/dist/client/types/com/atproto/admin/repo.d.ts +45 -0
- package/dist/client/types/com/atproto/blob/upload.d.ts +19 -0
- package/dist/client/types/com/atproto/handle/resolve.d.ts +18 -0
- package/dist/client/types/com/atproto/handle/update.d.ts +17 -0
- package/dist/client/types/com/atproto/repo/batchWrite.d.ts +46 -0
- package/dist/client/types/com/atproto/repo/describe.d.ts +22 -0
- package/dist/client/types/com/atproto/repo/rebaseRepo.d.ts +24 -0
- package/dist/client/types/com/atproto/repo/recordRef.d.ts +8 -0
- package/dist/client/types/com/atproto/repo/repoRef.d.ts +7 -0
- package/dist/client/types/com/atproto/report/create.d.ts +39 -0
- package/dist/client/types/com/atproto/report/reasonType.d.ts +3 -0
- package/dist/client/types/com/atproto/report/subject.d.ts +23 -0
- package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +27 -0
- package/dist/client/types/com/atproto/session/create.d.ts +29 -0
- package/dist/client/types/com/atproto/session/delete.d.ts +13 -0
- package/dist/client/types/com/atproto/session/get.d.ts +18 -0
- package/dist/client/types/com/atproto/session/refresh.d.ts +24 -0
- package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +20 -0
- package/dist/client/types/com/atproto/sync/getRoot.d.ts +18 -0
- package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -0
- package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
- package/dist/helpers/bsky.d.ts +20 -0
- package/dist/index.js +941 -1137
- package/dist/index.js.map +4 -4
- package/dist/mixins/bsky.d.ts +23 -0
- package/dist/rich-text/sanitize.d.ts +4 -0
- package/dist/session.d.ts +42 -0
- package/docs/labels.md +43 -27
- package/docs/moderation-behaviors/posts.md +13 -516
- package/docs/moderation-behaviors/profiles.md +14 -174
- package/docs/moderation.md +3 -3
- package/package.json +23 -23
- package/src/client/lexicons.ts +35 -0
- package/src/client/types/app/bsky/actor/defs.ts +19 -0
- package/src/client/types/app/bsky/embed/images.ts +21 -0
- package/src/moderation/const/label-groups.ts +1 -0
- package/src/moderation/const/labels.ts +30 -0
- package/tsconfig.build.json +1 -1
- package/update-pkg.js +0 -14
- /package/dist/client/types/app/bsky/feed/{getFeedSuggestions.d.ts → getSavedFeeds.d.ts} +0 -0
package/docs/moderation.md
CHANGED
|
@@ -80,7 +80,7 @@ interface LabelerSettings {
|
|
|
80
80
|
Applications need to produce the [Post Moderation Behaviors](./moderation-behaviors/posts.md) using the `moderatePost()` API.
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
import {moderatePost} from '@atproto/api'
|
|
83
|
+
import { moderatePost } from '@atproto/api'
|
|
84
84
|
|
|
85
85
|
const postMod = moderatePost(postView, getOpts())
|
|
86
86
|
|
|
@@ -119,7 +119,7 @@ if (postMod.avatar.alert) {
|
|
|
119
119
|
Applications need to produce the [Profile Moderation Behaviors](./moderation-behaviors/profiles.md) using the `moderateProfile()` API.
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
|
-
import {moderateProfile} from '@atproto/api'
|
|
122
|
+
import { moderateProfile } from '@atproto/api'
|
|
123
123
|
|
|
124
124
|
const profileMod = moderateProfile(profileView, getOpts())
|
|
125
125
|
|
|
@@ -150,4 +150,4 @@ if (profileMod.avatar.blur) {
|
|
|
150
150
|
if (profileMod.avatar.alert) {
|
|
151
151
|
// render an alert on the avatar
|
|
152
152
|
}
|
|
153
|
-
```
|
|
153
|
+
```
|
package/package.json
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/api",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"codegen": "yarn docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
|
|
7
|
-
"docgen": "node ./scripts/generate-docs.mjs",
|
|
8
|
-
"build": "node ./build.js",
|
|
9
|
-
"postbuild": "tsc --build tsconfig.build.json",
|
|
10
|
-
"update-main-to-dist": "node ./update-pkg.js --update-main-to-dist",
|
|
11
|
-
"update-main-to-src": "node ./update-pkg.js --update-main-to-src",
|
|
12
|
-
"prepublish": "npm run update-main-to-dist",
|
|
13
|
-
"postpublish": "npm run update-main-to-src",
|
|
14
|
-
"test": "jest",
|
|
15
|
-
"bench": "jest --config jest.bench.config.js",
|
|
16
|
-
"bench:profile": "node --inspect-brk ../../node_modules/.bin/jest --config jest.bench.config.js"
|
|
17
|
-
},
|
|
18
5
|
"license": "MIT",
|
|
19
6
|
"repository": {
|
|
20
7
|
"type": "git",
|
|
@@ -22,15 +9,28 @@
|
|
|
22
9
|
"directory": "packages/api"
|
|
23
10
|
},
|
|
24
11
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"@atproto/syntax": "*",
|
|
27
|
-
"@atproto/xrpc": "*",
|
|
12
|
+
"multiformats": "^9.9.0",
|
|
28
13
|
"tlds": "^1.234.0",
|
|
29
|
-
"typed-emitter": "^2.1.0"
|
|
14
|
+
"typed-emitter": "^2.1.0",
|
|
15
|
+
"@atproto/common-web": "^0.2.0",
|
|
16
|
+
"@atproto/lexicon": "^0.2.0",
|
|
17
|
+
"@atproto/syntax": "^0.1.0",
|
|
18
|
+
"@atproto/xrpc": "^0.3.0"
|
|
30
19
|
},
|
|
31
20
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"@atproto/
|
|
34
|
-
"
|
|
35
|
-
}
|
|
36
|
-
|
|
21
|
+
"common-tags": "^1.8.2",
|
|
22
|
+
"@atproto/lex-cli": "^0.2.0",
|
|
23
|
+
"@atproto/pds": "^0.1.12"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"codegen": "pnpm docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
|
|
27
|
+
"docgen": "node ./scripts/generate-docs.mjs",
|
|
28
|
+
"build": "node ./build.js",
|
|
29
|
+
"postbuild": "tsc --build tsconfig.build.json",
|
|
30
|
+
"update-main-to-dist": "node ../../update-main-to-dist.js packages/api",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"bench": "jest --config jest.bench.config.js",
|
|
33
|
+
"bench:profile": "node --inspect-brk ../../node_modules/.bin/jest --config jest.bench.config.js"
|
|
34
|
+
},
|
|
35
|
+
"types": "dist/index.d.ts"
|
|
36
|
+
}
|
package/src/client/lexicons.ts
CHANGED
|
@@ -3714,6 +3714,7 @@ export const schemaDict = {
|
|
|
3714
3714
|
'lex:app.bsky.actor.defs#adultContentPref',
|
|
3715
3715
|
'lex:app.bsky.actor.defs#contentLabelPref',
|
|
3716
3716
|
'lex:app.bsky.actor.defs#savedFeedsPref',
|
|
3717
|
+
'lex:app.bsky.actor.defs#personalDetailsPref',
|
|
3717
3718
|
],
|
|
3718
3719
|
},
|
|
3719
3720
|
},
|
|
@@ -3760,6 +3761,16 @@ export const schemaDict = {
|
|
|
3760
3761
|
},
|
|
3761
3762
|
},
|
|
3762
3763
|
},
|
|
3764
|
+
personalDetailsPref: {
|
|
3765
|
+
type: 'object',
|
|
3766
|
+
properties: {
|
|
3767
|
+
birthDate: {
|
|
3768
|
+
type: 'string',
|
|
3769
|
+
format: 'datetime',
|
|
3770
|
+
description: 'The birth date of the owner of the account.',
|
|
3771
|
+
},
|
|
3772
|
+
},
|
|
3773
|
+
},
|
|
3763
3774
|
},
|
|
3764
3775
|
},
|
|
3765
3776
|
AppBskyActorGetPreferences: {
|
|
@@ -4145,6 +4156,26 @@ export const schemaDict = {
|
|
|
4145
4156
|
alt: {
|
|
4146
4157
|
type: 'string',
|
|
4147
4158
|
},
|
|
4159
|
+
aspectRatio: {
|
|
4160
|
+
type: 'ref',
|
|
4161
|
+
ref: 'lex:app.bsky.embed.images#aspectRatio',
|
|
4162
|
+
},
|
|
4163
|
+
},
|
|
4164
|
+
},
|
|
4165
|
+
aspectRatio: {
|
|
4166
|
+
type: 'object',
|
|
4167
|
+
description:
|
|
4168
|
+
'width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.',
|
|
4169
|
+
required: ['width', 'height'],
|
|
4170
|
+
properties: {
|
|
4171
|
+
width: {
|
|
4172
|
+
type: 'integer',
|
|
4173
|
+
minimum: 1,
|
|
4174
|
+
},
|
|
4175
|
+
height: {
|
|
4176
|
+
type: 'integer',
|
|
4177
|
+
minimum: 1,
|
|
4178
|
+
},
|
|
4148
4179
|
},
|
|
4149
4180
|
},
|
|
4150
4181
|
view: {
|
|
@@ -4174,6 +4205,10 @@ export const schemaDict = {
|
|
|
4174
4205
|
alt: {
|
|
4175
4206
|
type: 'string',
|
|
4176
4207
|
},
|
|
4208
|
+
aspectRatio: {
|
|
4209
|
+
type: 'ref',
|
|
4210
|
+
ref: 'lex:app.bsky.embed.images#aspectRatio',
|
|
4211
|
+
},
|
|
4177
4212
|
},
|
|
4178
4213
|
},
|
|
4179
4214
|
},
|
|
@@ -108,6 +108,7 @@ export type Preferences = (
|
|
|
108
108
|
| AdultContentPref
|
|
109
109
|
| ContentLabelPref
|
|
110
110
|
| SavedFeedsPref
|
|
111
|
+
| PersonalDetailsPref
|
|
111
112
|
| { $type: string; [k: string]: unknown }
|
|
112
113
|
)[]
|
|
113
114
|
|
|
@@ -163,3 +164,21 @@ export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref {
|
|
|
163
164
|
export function validateSavedFeedsPref(v: unknown): ValidationResult {
|
|
164
165
|
return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v)
|
|
165
166
|
}
|
|
167
|
+
|
|
168
|
+
export interface PersonalDetailsPref {
|
|
169
|
+
/** The birth date of the owner of the account. */
|
|
170
|
+
birthDate?: string
|
|
171
|
+
[k: string]: unknown
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref {
|
|
175
|
+
return (
|
|
176
|
+
isObj(v) &&
|
|
177
|
+
hasProp(v, '$type') &&
|
|
178
|
+
v.$type === 'app.bsky.actor.defs#personalDetailsPref'
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function validatePersonalDetailsPref(v: unknown): ValidationResult {
|
|
183
|
+
return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v)
|
|
184
|
+
}
|
|
@@ -27,6 +27,7 @@ export function validateMain(v: unknown): ValidationResult {
|
|
|
27
27
|
export interface Image {
|
|
28
28
|
image: BlobRef
|
|
29
29
|
alt: string
|
|
30
|
+
aspectRatio?: AspectRatio
|
|
30
31
|
[k: string]: unknown
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -40,6 +41,25 @@ export function validateImage(v: unknown): ValidationResult {
|
|
|
40
41
|
return lexicons.validate('app.bsky.embed.images#image', v)
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
/** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */
|
|
45
|
+
export interface AspectRatio {
|
|
46
|
+
width: number
|
|
47
|
+
height: number
|
|
48
|
+
[k: string]: unknown
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function isAspectRatio(v: unknown): v is AspectRatio {
|
|
52
|
+
return (
|
|
53
|
+
isObj(v) &&
|
|
54
|
+
hasProp(v, '$type') &&
|
|
55
|
+
v.$type === 'app.bsky.embed.images#aspectRatio'
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function validateAspectRatio(v: unknown): ValidationResult {
|
|
60
|
+
return lexicons.validate('app.bsky.embed.images#aspectRatio', v)
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
export interface View {
|
|
44
64
|
images: ViewImage[]
|
|
45
65
|
[k: string]: unknown
|
|
@@ -59,6 +79,7 @@ export interface ViewImage {
|
|
|
59
79
|
thumb: string
|
|
60
80
|
fullsize: string
|
|
61
81
|
alt: string
|
|
82
|
+
aspectRatio?: AspectRatio
|
|
62
83
|
[k: string]: unknown
|
|
63
84
|
}
|
|
64
85
|
|
|
@@ -795,4 +795,34 @@ export const LABELS: LabelDefinitionMap = {
|
|
|
795
795
|
},
|
|
796
796
|
},
|
|
797
797
|
},
|
|
798
|
+
misleading: {
|
|
799
|
+
id: 'misleading',
|
|
800
|
+
preferences: ['ignore', 'warn', 'hide'],
|
|
801
|
+
flags: [],
|
|
802
|
+
onwarn: 'alert',
|
|
803
|
+
groupId: 'misinfo',
|
|
804
|
+
configurable: true,
|
|
805
|
+
strings: {
|
|
806
|
+
settings: {
|
|
807
|
+
en: {
|
|
808
|
+
name: 'Misleading',
|
|
809
|
+
description: 'Accounts which share misleading information.',
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
account: {
|
|
813
|
+
en: {
|
|
814
|
+
name: 'Misleading',
|
|
815
|
+
description:
|
|
816
|
+
'The moderators believe this account is spreading misleading information.',
|
|
817
|
+
},
|
|
818
|
+
},
|
|
819
|
+
content: {
|
|
820
|
+
en: {
|
|
821
|
+
name: 'Misleading',
|
|
822
|
+
description:
|
|
823
|
+
'The moderators believe this account is spreading misleading information.',
|
|
824
|
+
},
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
},
|
|
798
828
|
}
|
package/tsconfig.build.json
CHANGED
package/update-pkg.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const pkgJson = require('@npmcli/package-json')
|
|
2
|
-
|
|
3
|
-
if (process.argv.includes('--update-main-to-dist')) {
|
|
4
|
-
return pkgJson
|
|
5
|
-
.load(__dirname)
|
|
6
|
-
.then((pkg) => pkg.update({ main: 'dist/index.js' }))
|
|
7
|
-
.then((pkg) => pkg.save())
|
|
8
|
-
}
|
|
9
|
-
if (process.argv.includes('--update-main-to-src')) {
|
|
10
|
-
return pkgJson
|
|
11
|
-
.load(__dirname)
|
|
12
|
-
.then((pkg) => pkg.update({ main: 'src/index.ts' }))
|
|
13
|
-
.then((pkg) => pkg.save())
|
|
14
|
-
}
|
|
File without changes
|