@atproto/api 0.1.3 → 0.2.1
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/README.md +179 -25
- package/build.js +2 -1
- package/dist/agent.d.ts +11 -6
- package/dist/bsky-agent.d.ts +43 -0
- package/dist/client/index.d.ts +117 -215
- package/dist/client/lexicons.d.ts +1447 -1401
- package/dist/client/types/app/bsky/actor/defs.d.ts +47 -0
- package/dist/client/types/app/bsky/actor/getProfile.d.ts +2 -2
- package/dist/client/types/app/bsky/actor/getProfiles.d.ts +2 -2
- package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +2 -2
- package/dist/client/types/app/bsky/actor/profile.d.ts +4 -60
- package/dist/client/types/app/bsky/actor/searchActors.d.ts +22 -0
- package/dist/client/types/app/bsky/actor/searchActorsTypeahead.d.ts +20 -0
- package/dist/client/types/app/bsky/embed/complexRecord.d.ts +24 -0
- package/dist/client/types/app/bsky/embed/external.d.ts +9 -13
- package/dist/client/types/app/bsky/embed/images.d.ts +9 -13
- package/dist/client/types/app/bsky/embed/post.d.ts +33 -0
- package/dist/client/types/app/bsky/embed/record.d.ts +21 -13
- package/dist/client/types/app/bsky/embed/recordWithMedia.d.ts +24 -0
- package/dist/client/types/app/bsky/feed/defs.d.ts +77 -0
- package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts +4 -4
- package/dist/client/types/app/bsky/{graph/getMembers.d.ts → feed/getLikes.d.ts} +12 -14
- package/dist/client/types/app/bsky/feed/getPostThread.d.ts +2 -24
- package/dist/client/types/app/bsky/feed/getRepostedBy.d.ts +3 -3
- package/dist/client/types/app/bsky/feed/getTimeline.d.ts +3 -3
- package/dist/client/types/app/bsky/feed/post.d.ts +4 -29
- package/dist/client/types/app/bsky/graph/follow.d.ts +1 -2
- package/dist/client/types/app/bsky/graph/getFollowers.d.ts +5 -5
- package/dist/client/types/app/bsky/graph/getFollows.d.ts +5 -5
- package/dist/client/types/app/bsky/graph/getMutes.d.ts +3 -3
- package/dist/client/types/app/bsky/{notification/updateSeen.d.ts → graph/muteActor.d.ts} +1 -1
- package/dist/client/types/app/bsky/graph/unmuteActor.d.ts +17 -0
- package/dist/client/types/app/bsky/notification/getUnreadCount.d.ts +17 -0
- package/dist/client/types/app/bsky/{graph/getMemberships.d.ts → notification/listNotifications.d.ts} +13 -14
- package/dist/client/types/app/bsky/richtext/facet.d.ts +30 -0
- package/dist/client/types/app/bsky/unspecced/getPopular.d.ts +21 -0
- package/dist/client/types/com/atproto/admin/defs.d.ts +181 -0
- package/dist/client/types/com/atproto/admin/getModerationAction.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/getModerationActions.d.ts +3 -3
- package/dist/client/types/com/atproto/admin/getModerationReport.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/getModerationReports.d.ts +3 -3
- package/dist/client/types/com/atproto/admin/getRecord.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/getRepo.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/resolveModerationReports.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/reverseModerationAction.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/searchRepos.d.ts +3 -3
- package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +5 -6
- package/dist/client/types/com/atproto/{sync/getHead.d.ts → identity/resolveHandle.d.ts} +2 -2
- package/dist/client/types/com/atproto/identity/updateHandle.d.ts +17 -0
- package/dist/client/types/com/atproto/moderation/createReport.d.ts +38 -0
- package/dist/client/types/com/atproto/moderation/defs.d.ts +3 -0
- package/dist/client/types/com/atproto/repo/applyWrites.d.ts +47 -0
- package/dist/client/types/com/atproto/repo/createRecord.d.ts +7 -2
- package/dist/client/types/com/atproto/repo/deleteRecord.d.ts +7 -2
- package/dist/client/types/com/atproto/repo/describeRepo.d.ts +22 -0
- package/dist/client/types/com/atproto/repo/getRecord.d.ts +1 -1
- package/dist/client/types/com/atproto/repo/listRecords.d.ts +3 -3
- package/dist/client/types/com/atproto/repo/putRecord.d.ts +7 -2
- package/dist/client/types/com/atproto/repo/uploadBlob.d.ts +20 -0
- package/dist/client/types/{app/bsky/actor/createScene.d.ts → com/atproto/server/createAccount.d.ts} +14 -2
- package/dist/client/types/com/atproto/server/createInviteCode.d.ts +22 -0
- package/dist/client/types/com/atproto/server/createSession.d.ts +29 -0
- package/dist/client/types/com/atproto/server/deleteAccount.d.ts +25 -0
- package/dist/client/types/com/atproto/{sync/getRecord.d.ts → server/deleteSession.d.ts} +1 -5
- package/dist/client/types/com/atproto/server/describeServer.d.ts +27 -0
- package/dist/client/types/com/atproto/{sync/getRoot.d.ts → server/getSession.d.ts} +2 -2
- package/dist/client/types/com/atproto/server/refreshSession.d.ts +24 -0
- package/dist/client/types/com/atproto/{sync/updateRepo.d.ts → server/requestAccountDelete.d.ts} +1 -3
- package/dist/client/types/com/atproto/server/requestPasswordReset.d.ts +17 -0
- package/dist/client/types/com/atproto/server/resetPassword.d.ts +24 -0
- package/dist/client/types/com/atproto/sync/{getCheckout.d.ts → getBlob.d.ts} +1 -1
- package/dist/client/types/com/atproto/sync/{getCommitPath.d.ts → listBlobs.d.ts} +1 -1
- package/dist/client/types/com/atproto/sync/notifyOfUpdate.d.ts +1 -0
- package/dist/client/types/com/atproto/sync/requestCrawl.d.ts +1 -1
- package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -1
- package/dist/client/types/com/atproto/sync/subscribeRepos.d.ts +58 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8055 -3651
- package/dist/index.js.map +4 -4
- package/dist/rich-text/detection.d.ts +4 -0
- package/dist/rich-text/rich-text.d.ts +39 -0
- package/dist/rich-text/sanitization.d.ts +4 -0
- package/dist/rich-text/unicode.d.ts +11 -0
- package/dist/types.d.ts +2 -2
- package/docs/rn-fetch-handler.ts +88 -0
- package/package.json +4 -1
- package/src/agent.ts +51 -15
- package/src/bsky-agent.ts +228 -0
- package/src/client/index.ts +330 -581
- package/src/client/lexicons.ts +1833 -1779
- package/src/client/types/app/bsky/actor/defs.ts +97 -0
- package/src/client/types/app/bsky/actor/getProfile.ts +4 -3
- package/src/client/types/app/bsky/actor/getProfiles.ts +4 -3
- package/src/client/types/app/bsky/actor/getSuggestions.ts +4 -3
- package/src/client/types/app/bsky/actor/profile.ts +5 -95
- package/src/client/types/app/bsky/actor/{searchTypeahead.ts → searchActors.ts} +6 -3
- package/src/client/types/app/bsky/actor/{search.ts → searchActorsTypeahead.ts} +4 -5
- package/src/client/types/app/bsky/embed/external.ts +14 -13
- package/src/client/types/app/bsky/embed/images.ts +14 -15
- package/src/client/types/app/bsky/embed/record.ts +32 -25
- package/src/client/types/app/bsky/embed/recordWithMedia.ts +53 -0
- package/src/client/types/app/bsky/feed/defs.ts +156 -0
- package/src/client/types/app/bsky/feed/getAuthorFeed.ts +6 -5
- package/src/client/types/app/bsky/feed/{getVotes.ts → getLikes.ts} +11 -12
- package/src/client/types/app/bsky/feed/getPostThread.ts +5 -48
- package/src/client/types/app/bsky/feed/getRepostedBy.ts +5 -4
- package/src/client/types/app/bsky/feed/getTimeline.ts +5 -4
- package/src/client/types/app/bsky/feed/{vote.ts → like.ts} +4 -4
- package/src/client/types/app/bsky/feed/post.ts +10 -52
- package/src/client/types/app/bsky/feed/repost.ts +2 -1
- package/src/client/types/app/bsky/graph/follow.ts +3 -3
- package/src/client/types/app/bsky/graph/getFollowers.ts +7 -6
- package/src/client/types/app/bsky/graph/getFollows.ts +7 -6
- package/src/client/types/app/bsky/graph/getMutes.ts +5 -4
- package/src/client/types/app/bsky/graph/{mute.ts → muteActor.ts} +3 -2
- package/src/client/types/app/bsky/graph/{unmute.ts → unmuteActor.ts} +3 -2
- package/src/client/types/app/bsky/notification/{getCount.ts → getUnreadCount.ts} +2 -1
- package/src/client/types/app/bsky/notification/{list.ts → listNotifications.ts} +13 -9
- package/src/client/types/app/bsky/notification/updateSeen.ts +2 -1
- package/src/client/types/app/bsky/richtext/facet.ts +81 -0
- package/src/client/types/app/bsky/unspecced/getPopular.ts +38 -0
- package/src/client/types/com/atproto/admin/defs.ts +366 -0
- package/src/client/types/com/atproto/admin/getModerationAction.ts +4 -3
- package/src/client/types/com/atproto/admin/getModerationActions.ts +5 -4
- package/src/client/types/com/atproto/admin/getModerationReport.ts +4 -3
- package/src/client/types/com/atproto/admin/getModerationReports.ts +5 -4
- package/src/client/types/com/atproto/admin/getRecord.ts +4 -3
- package/src/client/types/com/atproto/admin/getRepo.ts +4 -3
- package/src/client/types/com/atproto/admin/resolveModerationReports.ts +4 -3
- package/src/client/types/com/atproto/admin/reverseModerationAction.ts +4 -3
- package/src/client/types/com/atproto/admin/searchRepos.ts +5 -4
- package/src/client/types/com/atproto/admin/takeModerationAction.ts +10 -10
- package/src/client/types/com/atproto/{handle/resolve.ts → identity/resolveHandle.ts} +2 -1
- package/src/client/types/com/atproto/{handle/update.ts → identity/updateHandle.ts} +2 -1
- package/src/client/types/com/atproto/{report/create.ts → moderation/createReport.ts} +10 -10
- package/src/client/types/com/atproto/moderation/defs.ts +17 -0
- package/src/client/types/com/atproto/repo/{batchWrite.ts → applyWrites.ts} +21 -12
- package/src/client/types/com/atproto/repo/createRecord.ts +15 -3
- package/src/client/types/com/atproto/repo/deleteRecord.ts +15 -3
- package/src/client/types/com/atproto/repo/{describe.ts → describeRepo.ts} +3 -2
- package/src/client/types/com/atproto/repo/getRecord.ts +4 -3
- package/src/client/types/com/atproto/repo/listRecords.ts +7 -6
- package/src/client/types/com/atproto/repo/putRecord.ts +18 -6
- package/src/client/types/com/atproto/repo/strongRef.ts +2 -1
- package/src/client/types/com/atproto/{blob/upload.ts → repo/uploadBlob.ts} +3 -2
- package/src/client/types/com/atproto/{account/create.ts → server/createAccount.ts} +9 -1
- package/src/client/types/com/atproto/{account → server}/createInviteCode.ts +2 -1
- package/src/client/types/com/atproto/{session/create.ts → server/createSession.ts} +2 -1
- package/src/client/types/com/atproto/{account/delete.ts → server/deleteAccount.ts} +2 -1
- package/src/client/types/com/atproto/{account/requestDelete.ts → server/deleteSession.ts} +2 -1
- package/src/client/types/com/atproto/server/{getAccountsConfig.ts → describeServer.ts} +4 -3
- package/src/client/types/com/atproto/{session/get.ts → server/getSession.ts} +2 -1
- package/src/client/types/com/atproto/{session/refresh.ts → server/refreshSession.ts} +2 -1
- package/src/client/types/com/atproto/{session/delete.ts → server/requestAccountDelete.ts} +2 -1
- package/src/client/types/com/atproto/{account → server}/requestPasswordReset.ts +2 -1
- package/src/client/types/com/atproto/{account → server}/resetPassword.ts +2 -1
- package/src/client/types/com/atproto/sync/getBlob.ts +33 -0
- package/src/client/types/com/atproto/sync/getBlocks.ts +2 -1
- package/src/client/types/com/atproto/sync/getCheckout.ts +2 -1
- package/src/client/types/com/atproto/sync/getCommitPath.ts +2 -1
- package/src/client/types/com/atproto/sync/getHead.ts +2 -1
- package/src/client/types/com/atproto/sync/getRecord.ts +2 -1
- package/src/client/types/com/atproto/sync/getRepo.ts +2 -1
- package/src/client/types/com/atproto/sync/listBlobs.ts +40 -0
- package/src/client/types/com/atproto/sync/notifyOfUpdate.ts +6 -2
- package/src/client/types/com/atproto/sync/requestCrawl.ts +3 -2
- package/src/client/types/com/atproto/sync/subscribeRepos.ts +131 -0
- package/src/index.ts +12 -0
- package/src/rich-text/detection.ts +83 -0
- package/src/rich-text/rich-text.ts +401 -0
- package/src/rich-text/sanitization.ts +40 -0
- package/src/rich-text/unicode.ts +47 -0
- package/src/types.ts +2 -2
- package/tests/agent.test.ts +10 -6
- package/tests/bsky-agent.test.ts +140 -0
- package/tests/errors.test.ts +4 -4
- package/tests/rich-text-detection.test.ts +229 -0
- package/tests/rich-text-sanitization.test.ts +211 -0
- package/tests/rich-text.test.ts +661 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/client/types/app/bsky/feed/trend.d.ts +0 -9
- package/dist/client/types/app/bsky/graph/getAssertions.d.ts +0 -48
- package/dist/client/types/app/bsky/system/actorScene.d.ts +0 -1
- package/dist/client/types/com/atproto/repo/strongRef.d.ts +0 -8
- package/dist/client/util.d.ts +0 -2
- package/src/client/types/app/bsky/actor/ref.ts +0 -64
- package/src/client/types/app/bsky/actor/updateProfile.ts +0 -71
- package/src/client/types/app/bsky/feed/feedViewPost.ts +0 -64
- package/src/client/types/app/bsky/feed/setVote.ts +0 -40
- package/src/client/types/app/bsky/graph/assertCreator.ts +0 -9
- package/src/client/types/app/bsky/graph/assertMember.ts +0 -9
- package/src/client/types/app/bsky/graph/assertion.ts +0 -27
- package/src/client/types/app/bsky/graph/confirmation.ts +0 -28
- package/src/client/types/app/bsky/system/actorUser.ts +0 -9
- package/src/client/types/app/bsky/system/declRef.ts +0 -26
- package/src/client/types/app/bsky/system/declaration.ts +0 -24
- package/src/client/types/com/atproto/account/get.ts +0 -26
- package/src/client/types/com/atproto/admin/blob.ts +0 -84
- package/src/client/types/com/atproto/admin/moderationAction.ts +0 -118
- package/src/client/types/com/atproto/admin/moderationReport.ts +0 -64
- package/src/client/types/com/atproto/admin/record.ts +0 -92
- package/src/client/types/com/atproto/admin/repo.ts +0 -103
- package/src/client/types/com/atproto/repo/recordRef.ts +0 -25
- package/src/client/types/com/atproto/repo/repoRef.ts +0 -24
- package/src/client/types/com/atproto/report/reasonType.ts +0 -16
- package/src/client/types/com/atproto/report/subject.ts +0 -66
- package/src/client/types/com/atproto/sync/subscribeAllRepos.ts +0 -7
- /package/dist/client/types/app/bsky/feed/{repost.d.ts → like.d.ts} +0 -0
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -43,10 +44,10 @@ export function isLinks(v: unknown): v is Links {
|
|
|
43
44
|
return (
|
|
44
45
|
isObj(v) &&
|
|
45
46
|
hasProp(v, '$type') &&
|
|
46
|
-
v.$type === 'com.atproto.server.
|
|
47
|
+
v.$type === 'com.atproto.server.describeServer#links'
|
|
47
48
|
)
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
export function validateLinks(v: unknown): ValidationResult {
|
|
51
|
-
return lexicons.validate('com.atproto.server.
|
|
52
|
+
return lexicons.validate('com.atproto.server.describeServer#links', v)
|
|
52
53
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {}
|
|
10
11
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {
|
|
11
|
+
/** The DID of the repo. */
|
|
12
|
+
did: string
|
|
13
|
+
/** The CID of the blob to fetch */
|
|
14
|
+
cid: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type InputSchema = undefined
|
|
18
|
+
|
|
19
|
+
export interface CallOptions {
|
|
20
|
+
headers?: Headers
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Response {
|
|
24
|
+
success: boolean
|
|
25
|
+
headers: Headers
|
|
26
|
+
data: Uint8Array
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function toKnownErr(e: any) {
|
|
30
|
+
if (e instanceof XRPCError) {
|
|
31
|
+
}
|
|
32
|
+
return e
|
|
33
|
+
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** The DID of the repo. */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {
|
|
11
|
+
/** The DID of the repo. */
|
|
12
|
+
did: string
|
|
13
|
+
/** The most recent commit */
|
|
14
|
+
latest?: string
|
|
15
|
+
/** The earliest commit to start from */
|
|
16
|
+
earliest?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type InputSchema = undefined
|
|
20
|
+
|
|
21
|
+
export interface OutputSchema {
|
|
22
|
+
cids: string[]
|
|
23
|
+
[k: string]: unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CallOptions {
|
|
27
|
+
headers?: Headers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Response {
|
|
31
|
+
success: boolean
|
|
32
|
+
headers: Headers
|
|
33
|
+
data: OutputSchema
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function toKnownErr(e: any) {
|
|
37
|
+
if (e instanceof XRPCError) {
|
|
38
|
+
}
|
|
39
|
+
return e
|
|
40
|
+
}
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
|
-
export interface QueryParams {
|
|
10
|
+
export interface QueryParams {
|
|
11
|
+
/** Hostname of the service that is notifying of update. */
|
|
12
|
+
hostname: string
|
|
13
|
+
}
|
|
10
14
|
|
|
11
15
|
export type InputSchema = undefined
|
|
12
16
|
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { ValidationResult } from '@atproto/lexicon'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface QueryParams {
|
|
10
11
|
/** Hostname of the service that is requesting to be crawled. */
|
|
11
|
-
|
|
12
|
+
hostname: string
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export type InputSchema = undefined
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface Commit {
|
|
11
|
+
seq: number
|
|
12
|
+
rebase: boolean
|
|
13
|
+
tooBig: boolean
|
|
14
|
+
repo: string
|
|
15
|
+
commit: CID
|
|
16
|
+
prev: CID | null
|
|
17
|
+
/** CAR file containing relevant blocks */
|
|
18
|
+
blocks: Uint8Array
|
|
19
|
+
ops: RepoOp[]
|
|
20
|
+
blobs: CID[]
|
|
21
|
+
time: string
|
|
22
|
+
[k: string]: unknown
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isCommit(v: unknown): v is Commit {
|
|
26
|
+
return (
|
|
27
|
+
isObj(v) &&
|
|
28
|
+
hasProp(v, '$type') &&
|
|
29
|
+
v.$type === 'com.atproto.sync.subscribeRepos#commit'
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function validateCommit(v: unknown): ValidationResult {
|
|
34
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#commit', v)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface Handle {
|
|
38
|
+
seq: number
|
|
39
|
+
did: string
|
|
40
|
+
handle: string
|
|
41
|
+
time: string
|
|
42
|
+
[k: string]: unknown
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function isHandle(v: unknown): v is Handle {
|
|
46
|
+
return (
|
|
47
|
+
isObj(v) &&
|
|
48
|
+
hasProp(v, '$type') &&
|
|
49
|
+
v.$type === 'com.atproto.sync.subscribeRepos#handle'
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function validateHandle(v: unknown): ValidationResult {
|
|
54
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Migrate {
|
|
58
|
+
seq: number
|
|
59
|
+
did: string
|
|
60
|
+
migrateTo: string | null
|
|
61
|
+
time: string
|
|
62
|
+
[k: string]: unknown
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function isMigrate(v: unknown): v is Migrate {
|
|
66
|
+
return (
|
|
67
|
+
isObj(v) &&
|
|
68
|
+
hasProp(v, '$type') &&
|
|
69
|
+
v.$type === 'com.atproto.sync.subscribeRepos#migrate'
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function validateMigrate(v: unknown): ValidationResult {
|
|
74
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface Tombstone {
|
|
78
|
+
seq: number
|
|
79
|
+
did: string
|
|
80
|
+
time: string
|
|
81
|
+
[k: string]: unknown
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function isTombstone(v: unknown): v is Tombstone {
|
|
85
|
+
return (
|
|
86
|
+
isObj(v) &&
|
|
87
|
+
hasProp(v, '$type') &&
|
|
88
|
+
v.$type === 'com.atproto.sync.subscribeRepos#tombstone'
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function validateTombstone(v: unknown): ValidationResult {
|
|
93
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#tombstone', v)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface Info {
|
|
97
|
+
name: 'OutdatedCursor' | (string & {})
|
|
98
|
+
message?: string
|
|
99
|
+
[k: string]: unknown
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function isInfo(v: unknown): v is Info {
|
|
103
|
+
return (
|
|
104
|
+
isObj(v) &&
|
|
105
|
+
hasProp(v, '$type') &&
|
|
106
|
+
v.$type === 'com.atproto.sync.subscribeRepos#info'
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function validateInfo(v: unknown): ValidationResult {
|
|
111
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#info', v)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface RepoOp {
|
|
115
|
+
action: 'create' | 'update' | 'delete' | (string & {})
|
|
116
|
+
path: string
|
|
117
|
+
cid: CID | null
|
|
118
|
+
[k: string]: unknown
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function isRepoOp(v: unknown): v is RepoOp {
|
|
122
|
+
return (
|
|
123
|
+
isObj(v) &&
|
|
124
|
+
hasProp(v, '$type') &&
|
|
125
|
+
v.$type === 'com.atproto.sync.subscribeRepos#repoOp'
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function validateRepoOp(v: unknown): ValidationResult {
|
|
130
|
+
return lexicons.validate('com.atproto.sync.subscribeRepos#repoOp', v)
|
|
131
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export { AtUri } from '@atproto/uri'
|
|
2
|
+
export {
|
|
3
|
+
BlobRef,
|
|
4
|
+
lexToJson,
|
|
5
|
+
stringifyLex,
|
|
6
|
+
jsonToLex,
|
|
7
|
+
jsonStringToLex,
|
|
8
|
+
} from '@atproto/lexicon'
|
|
1
9
|
export * from './types'
|
|
2
10
|
export * from './client'
|
|
3
11
|
export * from './agent'
|
|
12
|
+
export * from './rich-text/rich-text'
|
|
13
|
+
export * from './rich-text/sanitization'
|
|
14
|
+
export * from './rich-text/unicode'
|
|
15
|
+
export { BskyAgent } from './bsky-agent'
|
|
4
16
|
export { AtpAgent as default } from './agent'
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import TLDs from 'tlds'
|
|
2
|
+
import { AppBskyRichtextFacet } from '../client'
|
|
3
|
+
import { UnicodeString } from './unicode'
|
|
4
|
+
|
|
5
|
+
export type Facet = AppBskyRichtextFacet.Main
|
|
6
|
+
|
|
7
|
+
export function detectFacets(text: UnicodeString): Facet[] | undefined {
|
|
8
|
+
let match
|
|
9
|
+
const facets: Facet[] = []
|
|
10
|
+
{
|
|
11
|
+
// mentions
|
|
12
|
+
const re = /(^|\s|\()(@)([a-zA-Z0-9.-]+)(\b)/g
|
|
13
|
+
while ((match = re.exec(text.utf16))) {
|
|
14
|
+
if (!isValidDomain(match[3]) && !match[3].endsWith('.test')) {
|
|
15
|
+
continue // probably not a handle
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const start = text.utf16.indexOf(match[3], match.index) - 1
|
|
19
|
+
facets.push({
|
|
20
|
+
$type: 'app.bsky.richtext.facet',
|
|
21
|
+
index: {
|
|
22
|
+
byteStart: text.utf16IndexToUtf8Index(start),
|
|
23
|
+
byteEnd: text.utf16IndexToUtf8Index(start + match[3].length + 1),
|
|
24
|
+
},
|
|
25
|
+
features: [
|
|
26
|
+
{
|
|
27
|
+
$type: 'app.bsky.richtext.facet#mention',
|
|
28
|
+
did: match[3], // must be resolved afterwards
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
{
|
|
35
|
+
// links
|
|
36
|
+
const re =
|
|
37
|
+
/(^|\s|\()((https?:\/\/[\S]+)|((?<domain>[a-z][a-z0-9]*(\.[a-z0-9]+)+)[\S]*))/gim
|
|
38
|
+
while ((match = re.exec(text.utf16))) {
|
|
39
|
+
let uri = match[2]
|
|
40
|
+
if (!uri.startsWith('http')) {
|
|
41
|
+
const domain = match.groups?.domain
|
|
42
|
+
if (!domain || !isValidDomain(domain)) {
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
uri = `https://${uri}`
|
|
46
|
+
}
|
|
47
|
+
const start = text.utf16.indexOf(match[2], match.index)
|
|
48
|
+
const index = { start, end: start + match[2].length }
|
|
49
|
+
// strip ending puncuation
|
|
50
|
+
if (/[.,;!?]$/.test(uri)) {
|
|
51
|
+
uri = uri.slice(0, -1)
|
|
52
|
+
index.end--
|
|
53
|
+
}
|
|
54
|
+
if (/[)]$/.test(uri) && !uri.includes('(')) {
|
|
55
|
+
uri = uri.slice(0, -1)
|
|
56
|
+
index.end--
|
|
57
|
+
}
|
|
58
|
+
facets.push({
|
|
59
|
+
index: {
|
|
60
|
+
byteStart: text.utf16IndexToUtf8Index(index.start),
|
|
61
|
+
byteEnd: text.utf16IndexToUtf8Index(index.end),
|
|
62
|
+
},
|
|
63
|
+
features: [
|
|
64
|
+
{
|
|
65
|
+
$type: 'app.bsky.richtext.facet#link',
|
|
66
|
+
uri,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return facets.length > 0 ? facets : undefined
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isValidDomain(str: string): boolean {
|
|
76
|
+
return !!TLDs.find((tld) => {
|
|
77
|
+
const i = str.lastIndexOf(tld)
|
|
78
|
+
if (i === -1) {
|
|
79
|
+
return false
|
|
80
|
+
}
|
|
81
|
+
return str.charAt(i - 1) === '.' && i === str.length - tld.length
|
|
82
|
+
})
|
|
83
|
+
}
|