@atproto/pds 0.4.164 → 0.4.166
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/CHANGELOG.md +19 -0
- package/dist/account-manager/account-manager.js +2 -2
- package/dist/account-manager/account-manager.js.map +1 -1
- package/dist/account-manager/helpers/account-device.d.ts +4 -4
- package/dist/account-manager/helpers/account.d.ts +1 -1
- package/dist/account-manager/helpers/auth.d.ts +1 -1
- package/dist/account-manager/helpers/auth.d.ts.map +1 -1
- package/dist/account-manager/helpers/auth.js +8 -8
- package/dist/account-manager/helpers/auth.js.map +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -1
- package/dist/account-manager/helpers/authorization-request.js +16 -8
- package/dist/account-manager/helpers/authorization-request.js.map +1 -1
- package/dist/account-manager/helpers/token.d.ts +65 -65
- package/dist/actor-store/preference/reader.d.ts +2 -2
- package/dist/actor-store/preference/reader.d.ts.map +1 -1
- package/dist/actor-store/preference/reader.js +2 -2
- package/dist/actor-store/preference/reader.js.map +1 -1
- package/dist/actor-store/preference/transactor.d.ts +2 -2
- package/dist/actor-store/preference/transactor.d.ts.map +1 -1
- package/dist/actor-store/preference/transactor.js +5 -5
- package/dist/actor-store/preference/transactor.js.map +1 -1
- package/dist/actor-store/preference/util.d.ts +4 -2
- package/dist/actor-store/preference/util.d.ts.map +1 -1
- package/dist/actor-store/preference/util.js +9 -8
- package/dist/actor-store/preference/util.js.map +1 -1
- package/dist/actor-store/record/reader.d.ts +2 -2
- package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js +29 -7
- package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.js +9 -1
- package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js +9 -1
- package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js +30 -8
- package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.js +9 -1
- package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js +9 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +8 -1
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +8 -1
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js +9 -1
- package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.js +16 -4
- package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js +5 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js.map +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +9 -2
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js +9 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js +5 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +6 -1
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/api/com/atproto/moderation/createReport.d.ts.map +1 -1
- package/dist/api/com/atproto/moderation/createReport.js +8 -3
- package/dist/api/com/atproto/moderation/createReport.js.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.js +25 -19
- package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.js +10 -1
- package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.js +12 -1
- package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.js +7 -2
- package/dist/api/com/atproto/repo/importRepo.js.map +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.js +6 -2
- package/dist/api/com/atproto/repo/listMissingBlobs.js.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.js +17 -11
- package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js +5 -1
- package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.js +7 -1
- package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js +5 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js.map +1 -1
- package/dist/api/com/atproto/server/confirmEmail.d.ts.map +1 -1
- package/dist/api/com/atproto/server/confirmEmail.js +6 -1
- package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.js +7 -1
- package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.js +9 -2
- package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.js +3 -1
- package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js +8 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js +24 -13
- package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
- package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getSession.js +12 -19
- package/dist/api/com/atproto/server/getSession.js.map +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.d.ts.map +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.js +6 -1
- package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.js +1 -1
- package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js +8 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js +6 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.d.ts.map +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js +6 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.d.ts.map +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js +6 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/updateEmail.d.ts.map +1 -1
- package/dist/api/com/atproto/server/updateEmail.js +8 -1
- package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js +7 -2
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.js +7 -2
- package/dist/api/com/atproto/sync/deprecated/getHead.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.js +7 -3
- package/dist/api/com/atproto/sync/getBlob.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.js +7 -2
- package/dist/api/com/atproto/sync/getBlocks.js.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.js +7 -2
- package/dist/api/com/atproto/sync/getLatestCommit.js.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.js +7 -2
- package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.js +7 -3
- package/dist/api/com/atproto/sync/getRepo.js.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.js +7 -3
- package/dist/api/com/atproto/sync/listBlobs.js.map +1 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.d.ts.map +1 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.js +7 -3
- package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
- package/dist/auth-output.d.ts +45 -0
- package/dist/auth-output.d.ts.map +1 -0
- package/dist/auth-output.js +3 -0
- package/dist/auth-output.js.map +1 -0
- package/dist/auth-scope.d.ts +16 -0
- package/dist/auth-scope.d.ts.map +1 -0
- package/dist/auth-scope.js +40 -0
- package/dist/auth-scope.js.map +1 -0
- package/dist/auth-verifier.d.ts +50 -115
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +275 -366
- package/dist/auth-verifier.js.map +1 -1
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +3 -1
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +5 -5
- package/dist/context.js.map +1 -1
- package/dist/lexicon/index.d.ts +234 -230
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +682 -674
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +17994 -17706
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +9126 -8980
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getLists.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/graph/getLists.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts +40 -0
- package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js +16 -0
- package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js +16 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js.map +1 -0
- package/dist/pipethrough.d.ts +5 -3
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +42 -15
- package/dist/pipethrough.js.map +1 -1
- package/dist/sequencer/events.d.ts +13 -13
- package/dist/util/http.d.ts +7 -0
- package/dist/util/http.d.ts.map +1 -0
- package/dist/util/http.js +31 -0
- package/dist/util/http.js.map +1 -0
- package/dist/util/types.d.ts +5 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +3 -0
- package/dist/util/types.js.map +1 -0
- package/package.json +7 -6
- package/src/account-manager/account-manager.ts +1 -1
- package/src/account-manager/helpers/auth.ts +1 -1
- package/src/account-manager/helpers/authorization-request.ts +8 -4
- package/src/actor-store/preference/reader.ts +3 -4
- package/src/actor-store/preference/transactor.ts +6 -7
- package/src/actor-store/preference/util.ts +15 -5
- package/src/api/app/bsky/actor/getPreferences.ts +33 -8
- package/src/api/app/bsky/actor/getProfile.ts +9 -1
- package/src/api/app/bsky/actor/getProfiles.ts +9 -1
- package/src/api/app/bsky/actor/putPreferences.ts +35 -12
- package/src/api/app/bsky/feed/getActorLikes.ts +9 -1
- package/src/api/app/bsky/feed/getAuthorFeed.ts +9 -1
- package/src/api/app/bsky/feed/getFeed.ts +9 -2
- package/src/api/app/bsky/feed/getPostThread.ts +8 -1
- package/src/api/app/bsky/feed/getTimeline.ts +9 -1
- package/src/api/app/bsky/notification/registerPush.ts +16 -5
- package/src/api/com/atproto/identity/getRecommendedDidCredentials.ts +5 -1
- package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +9 -2
- package/src/api/com/atproto/identity/signPlcOperation.ts +9 -1
- package/src/api/com/atproto/identity/submitPlcOperation.ts +5 -1
- package/src/api/com/atproto/identity/updateHandle.ts +6 -1
- package/src/api/com/atproto/moderation/createReport.ts +8 -3
- package/src/api/com/atproto/repo/applyWrites.ts +28 -20
- package/src/api/com/atproto/repo/createRecord.ts +12 -1
- package/src/api/com/atproto/repo/deleteRecord.ts +14 -1
- package/src/api/com/atproto/repo/importRepo.ts +9 -2
- package/src/api/com/atproto/repo/listMissingBlobs.ts +7 -2
- package/src/api/com/atproto/repo/putRecord.ts +18 -10
- package/src/api/com/atproto/repo/uploadBlob.ts +6 -2
- package/src/api/com/atproto/server/activateAccount.ts +10 -2
- package/src/api/com/atproto/server/checkAccountStatus.ts +5 -1
- package/src/api/com/atproto/server/confirmEmail.ts +6 -1
- package/src/api/com/atproto/server/createAppPassword.ts +9 -1
- package/src/api/com/atproto/server/deactivateAccount.ts +11 -2
- package/src/api/com/atproto/server/deleteSession.ts +3 -1
- package/src/api/com/atproto/server/getAccountInviteCodes.ts +11 -2
- package/src/api/com/atproto/server/getServiceAuth.ts +37 -18
- package/src/api/com/atproto/server/getSession.ts +20 -27
- package/src/api/com/atproto/server/listAppPasswords.ts +8 -1
- package/src/api/com/atproto/server/refreshSession.ts +1 -1
- package/src/api/com/atproto/server/requestAccountDelete.ts +11 -2
- package/src/api/com/atproto/server/requestEmailConfirmation.ts +6 -1
- package/src/api/com/atproto/server/requestEmailUpdate.ts +6 -1
- package/src/api/com/atproto/server/revokeAppPassword.ts +8 -1
- package/src/api/com/atproto/server/updateEmail.ts +11 -2
- package/src/api/com/atproto/sync/deprecated/getCheckout.ts +7 -6
- package/src/api/com/atproto/sync/deprecated/getHead.ts +7 -6
- package/src/api/com/atproto/sync/getBlob.ts +7 -7
- package/src/api/com/atproto/sync/getBlocks.ts +7 -6
- package/src/api/com/atproto/sync/getLatestCommit.ts +7 -6
- package/src/api/com/atproto/sync/getRecord.ts +7 -6
- package/src/api/com/atproto/sync/getRepo.ts +7 -7
- package/src/api/com/atproto/sync/listBlobs.ts +7 -7
- package/src/api/com/atproto/temp/checkSignupQueue.ts +8 -2
- package/src/auth-output.ts +51 -0
- package/src/auth-scope.ts +40 -0
- package/src/auth-verifier.ts +404 -520
- package/src/config/config.ts +7 -7
- package/src/config/env.ts +5 -1
- package/src/context.ts +6 -5
- package/src/lexicon/index.ts +1247 -1221
- package/src/lexicon/lexicons.ts +9494 -9341
- package/src/lexicon/types/app/bsky/graph/getLists.ts +2 -0
- package/src/lexicon/types/app/bsky/graph/getListsWithMembership.ts +63 -0
- package/src/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.ts +65 -0
- package/src/pipethrough.ts +61 -18
- package/src/util/http.ts +31 -0
- package/src/util/types.ts +7 -0
- package/tests/oauth.test.ts +11 -37
- package/tests/preferences.test.ts +7 -3
- package/tsconfig.build.tsbuildinfo +1 -1
@@ -20,6 +20,8 @@ export type QueryParams = {
|
|
20
20
|
actor: string
|
21
21
|
limit: number
|
22
22
|
cursor?: string
|
23
|
+
/** Optional filter by list purpose. If not specified, all supported types are returned. */
|
24
|
+
purposes?: 'modlist' | 'curatelist' | (string & {})[]
|
23
25
|
}
|
24
26
|
export type InputSchema = undefined
|
25
27
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
5
|
+
import { CID } from 'multiformats/cid'
|
6
|
+
import { validate as _validate } from '../../../../lexicons'
|
7
|
+
import {
|
8
|
+
type $Typed,
|
9
|
+
is$typed as _is$typed,
|
10
|
+
type OmitKey,
|
11
|
+
} from '../../../../util'
|
12
|
+
import type * as AppBskyGraphDefs from './defs.js'
|
13
|
+
|
14
|
+
const is$typed = _is$typed,
|
15
|
+
validate = _validate
|
16
|
+
const id = 'app.bsky.graph.getListsWithMembership'
|
17
|
+
|
18
|
+
export type QueryParams = {
|
19
|
+
/** The account (actor) to check for membership. */
|
20
|
+
actor: string
|
21
|
+
limit: number
|
22
|
+
cursor?: string
|
23
|
+
/** Optional filter by list purpose. If not specified, all supported types are returned. */
|
24
|
+
purposes?: 'modlist' | 'curatelist' | (string & {})[]
|
25
|
+
}
|
26
|
+
export type InputSchema = undefined
|
27
|
+
|
28
|
+
export interface OutputSchema {
|
29
|
+
cursor?: string
|
30
|
+
listsWithMembership: ListWithMembership[]
|
31
|
+
}
|
32
|
+
|
33
|
+
export type HandlerInput = void
|
34
|
+
|
35
|
+
export interface HandlerSuccess {
|
36
|
+
encoding: 'application/json'
|
37
|
+
body: OutputSchema
|
38
|
+
headers?: { [key: string]: string }
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface HandlerError {
|
42
|
+
status: number
|
43
|
+
message?: string
|
44
|
+
}
|
45
|
+
|
46
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
47
|
+
|
48
|
+
/** A list and an optional list item indicating membership of a target user to that list. */
|
49
|
+
export interface ListWithMembership {
|
50
|
+
$type?: 'app.bsky.graph.getListsWithMembership#listWithMembership'
|
51
|
+
list: AppBskyGraphDefs.ListView
|
52
|
+
listItem?: AppBskyGraphDefs.ListItemView
|
53
|
+
}
|
54
|
+
|
55
|
+
const hashListWithMembership = 'listWithMembership'
|
56
|
+
|
57
|
+
export function isListWithMembership<V>(v: V) {
|
58
|
+
return is$typed(v, id, hashListWithMembership)
|
59
|
+
}
|
60
|
+
|
61
|
+
export function validateListWithMembership<V>(v: V) {
|
62
|
+
return validate<ListWithMembership & V>(v, id, hashListWithMembership)
|
63
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
5
|
+
import { CID } from 'multiformats/cid'
|
6
|
+
import { validate as _validate } from '../../../../lexicons'
|
7
|
+
import {
|
8
|
+
type $Typed,
|
9
|
+
is$typed as _is$typed,
|
10
|
+
type OmitKey,
|
11
|
+
} from '../../../../util'
|
12
|
+
import type * as AppBskyGraphDefs from './defs.js'
|
13
|
+
|
14
|
+
const is$typed = _is$typed,
|
15
|
+
validate = _validate
|
16
|
+
const id = 'app.bsky.graph.getStarterPacksWithMembership'
|
17
|
+
|
18
|
+
export type QueryParams = {
|
19
|
+
/** The account (actor) to check for membership. */
|
20
|
+
actor: string
|
21
|
+
limit: number
|
22
|
+
cursor?: string
|
23
|
+
}
|
24
|
+
export type InputSchema = undefined
|
25
|
+
|
26
|
+
export interface OutputSchema {
|
27
|
+
cursor?: string
|
28
|
+
starterPacksWithMembership: StarterPackWithMembership[]
|
29
|
+
}
|
30
|
+
|
31
|
+
export type HandlerInput = void
|
32
|
+
|
33
|
+
export interface HandlerSuccess {
|
34
|
+
encoding: 'application/json'
|
35
|
+
body: OutputSchema
|
36
|
+
headers?: { [key: string]: string }
|
37
|
+
}
|
38
|
+
|
39
|
+
export interface HandlerError {
|
40
|
+
status: number
|
41
|
+
message?: string
|
42
|
+
}
|
43
|
+
|
44
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
45
|
+
|
46
|
+
/** A starter pack and an optional list item indicating membership of a target user to that starter pack. */
|
47
|
+
export interface StarterPackWithMembership {
|
48
|
+
$type?: 'app.bsky.graph.getStarterPacksWithMembership#starterPackWithMembership'
|
49
|
+
starterPack: AppBskyGraphDefs.StarterPackView
|
50
|
+
listItem?: AppBskyGraphDefs.ListItemView
|
51
|
+
}
|
52
|
+
|
53
|
+
const hashStarterPackWithMembership = 'starterPackWithMembership'
|
54
|
+
|
55
|
+
export function isStarterPackWithMembership<V>(v: V) {
|
56
|
+
return is$typed(v, id, hashStarterPackWithMembership)
|
57
|
+
}
|
58
|
+
|
59
|
+
export function validateStarterPackWithMembership<V>(v: V) {
|
60
|
+
return validate<StarterPackWithMembership & V>(
|
61
|
+
v,
|
62
|
+
id,
|
63
|
+
hashStarterPackWithMembership,
|
64
|
+
)
|
65
|
+
}
|
package/src/pipethrough.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { IncomingHttpHeaders, ServerResponse } from 'node:http'
|
2
2
|
import { PassThrough, Readable } from 'node:stream'
|
3
|
-
import
|
3
|
+
import { Request } from 'express'
|
4
4
|
import { Dispatcher } from 'undici'
|
5
5
|
import {
|
6
6
|
decodeStream,
|
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
omit,
|
9
9
|
streamToNodeBuffer,
|
10
10
|
} from '@atproto/common'
|
11
|
+
import { RpcScopeMatch } from '@atproto/oauth-scopes'
|
11
12
|
import { ResponseType, XRPCError as XRPCClientError } from '@atproto/xrpc'
|
12
13
|
import {
|
13
14
|
CatchallHandler,
|
@@ -16,15 +17,20 @@ import {
|
|
16
17
|
InternalServerError,
|
17
18
|
InvalidRequestError,
|
18
19
|
XRPCError as XRPCServerError,
|
20
|
+
excludeErrorResult,
|
19
21
|
parseReqNsid,
|
20
22
|
} from '@atproto/xrpc-server'
|
21
23
|
import { buildProxiedContentEncoding } from '@atproto-labs/xrpc-utils'
|
24
|
+
import { isAccessPrivileged } from './auth-scope'
|
22
25
|
import { AppContext } from './context'
|
23
26
|
import { ids } from './lexicon/lexicons'
|
24
27
|
import { httpLogger } from './logger'
|
25
28
|
|
26
29
|
export const proxyHandler = (ctx: AppContext): CatchallHandler => {
|
27
|
-
const
|
30
|
+
const performAuth = ctx.authVerifier.authorization<RpcScopeMatch>({
|
31
|
+
authorize: (permissions, { params }) => permissions.assertRpc(params),
|
32
|
+
})
|
33
|
+
|
28
34
|
return async (req, res, next) => {
|
29
35
|
// /!\ Hot path
|
30
36
|
try {
|
@@ -50,13 +56,20 @@ export const proxyHandler = (ctx: AppContext): CatchallHandler => {
|
|
50
56
|
throw new InvalidRequestError('Bad token method', 'InvalidToken')
|
51
57
|
}
|
52
58
|
|
53
|
-
const
|
54
|
-
|
59
|
+
const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)
|
60
|
+
|
61
|
+
const authResult = await performAuth({ req, res, params: { lxm, aud } })
|
62
|
+
|
63
|
+
const { credentials } = excludeErrorResult(authResult)
|
64
|
+
|
65
|
+
if (
|
66
|
+
credentials.type === 'access' &&
|
67
|
+
!isAccessPrivileged(credentials.scope) &&
|
68
|
+
PRIVILEGED_METHODS.has(lxm)
|
69
|
+
) {
|
55
70
|
throw new InvalidRequestError('Bad token method', 'InvalidToken')
|
56
71
|
}
|
57
72
|
|
58
|
-
const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)
|
59
|
-
|
60
73
|
const headers: IncomingHttpHeaders = {
|
61
74
|
'accept-encoding': req.headers['accept-encoding'] || 'identity',
|
62
75
|
'accept-language': req.headers['accept-language'],
|
@@ -67,9 +80,7 @@ export const proxyHandler = (ctx: AppContext): CatchallHandler => {
|
|
67
80
|
'content-encoding': body && req.headers['content-encoding'],
|
68
81
|
'content-length': body && req.headers['content-length'],
|
69
82
|
|
70
|
-
authorization:
|
71
|
-
? `Bearer ${await ctx.serviceAuthJwt(auth.credentials.did, aud, lxm)}`
|
72
|
-
: undefined,
|
83
|
+
authorization: `Bearer ${await ctx.serviceAuthJwt(credentials.did, aud, lxm)}`,
|
73
84
|
}
|
74
85
|
|
75
86
|
const dispatchOptions: Dispatcher.RequestOptions = {
|
@@ -122,7 +133,7 @@ export type PipethroughOptions = {
|
|
122
133
|
|
123
134
|
export async function pipethrough(
|
124
135
|
ctx: AppContext,
|
125
|
-
req:
|
136
|
+
req: Request,
|
126
137
|
options?: PipethroughOptions,
|
127
138
|
): Promise<
|
128
139
|
HandlerPipeThroughStream & {
|
@@ -189,9 +200,25 @@ export async function pipethrough(
|
|
189
200
|
// Request setup/formatting
|
190
201
|
// -------------------
|
191
202
|
|
203
|
+
export function computeProxyTo(
|
204
|
+
ctx: AppContext,
|
205
|
+
req: Request,
|
206
|
+
lxm: string,
|
207
|
+
): string {
|
208
|
+
const proxyToHeader = req.header('atproto-proxy')
|
209
|
+
if (proxyToHeader) return proxyToHeader
|
210
|
+
|
211
|
+
const service = defaultService(ctx, lxm)
|
212
|
+
if (service.serviceInfo) {
|
213
|
+
return `${service.serviceInfo.did}#${service.serviceId}`
|
214
|
+
}
|
215
|
+
|
216
|
+
throw new InvalidRequestError(`No service configured for ${lxm}`)
|
217
|
+
}
|
218
|
+
|
192
219
|
export async function parseProxyInfo(
|
193
220
|
ctx: AppContext,
|
194
|
-
req:
|
221
|
+
req: Request,
|
195
222
|
lxm: string,
|
196
223
|
): Promise<{ url: string; did: string }> {
|
197
224
|
// /!\ Hot path
|
@@ -199,8 +226,8 @@ export async function parseProxyInfo(
|
|
199
226
|
const proxyToHeader = req.header('atproto-proxy')
|
200
227
|
if (proxyToHeader) return parseProxyHeader(ctx, proxyToHeader)
|
201
228
|
|
202
|
-
const
|
203
|
-
if (
|
229
|
+
const { serviceInfo } = defaultService(ctx, lxm)
|
230
|
+
if (serviceInfo) return serviceInfo
|
204
231
|
|
205
232
|
throw new InvalidRequestError(`No service configured for ${lxm}`)
|
206
233
|
}
|
@@ -472,7 +499,7 @@ function* responseHeaders(
|
|
472
499
|
// Utils
|
473
500
|
// -------------------
|
474
501
|
|
475
|
-
export const
|
502
|
+
export const CHAT_BSKY_METHODS = new Set<string>([
|
476
503
|
ids.ChatBskyActorDeleteAccount,
|
477
504
|
ids.ChatBskyActorExportAccountData,
|
478
505
|
ids.ChatBskyConvoDeleteMessageForSelf,
|
@@ -487,6 +514,10 @@ export const PRIVILEGED_METHODS = new Set<string>([
|
|
487
514
|
ids.ChatBskyConvoSendMessageBatch,
|
488
515
|
ids.ChatBskyConvoUnmuteConvo,
|
489
516
|
ids.ChatBskyConvoUpdateRead,
|
517
|
+
])
|
518
|
+
|
519
|
+
export const PRIVILEGED_METHODS = new Set<string>([
|
520
|
+
...CHAT_BSKY_METHODS,
|
490
521
|
ids.ComAtprotoServerCreateAccount,
|
491
522
|
])
|
492
523
|
|
@@ -515,7 +546,10 @@ export const PROTECTED_METHODS = new Set<string>([
|
|
515
546
|
const defaultService = (
|
516
547
|
ctx: AppContext,
|
517
548
|
nsid: string,
|
518
|
-
): {
|
549
|
+
): {
|
550
|
+
serviceId: string
|
551
|
+
serviceInfo: { url: string; did: string } | null
|
552
|
+
} => {
|
519
553
|
switch (nsid) {
|
520
554
|
case ids.ToolsOzoneTeamAddMember:
|
521
555
|
case ids.ToolsOzoneTeamDeleteMember:
|
@@ -541,11 +575,20 @@ const defaultService = (
|
|
541
575
|
case ids.ToolsOzoneSafelinkRemoveRule:
|
542
576
|
case ids.ToolsOzoneSafelinkQueryEvents:
|
543
577
|
case ids.ToolsOzoneSafelinkQueryRules:
|
544
|
-
return
|
578
|
+
return {
|
579
|
+
serviceId: 'atproto_labeler',
|
580
|
+
serviceInfo: ctx.cfg.modService,
|
581
|
+
}
|
545
582
|
case ids.ComAtprotoModerationCreateReport:
|
546
|
-
return
|
583
|
+
return {
|
584
|
+
serviceId: 'atproto_labeler',
|
585
|
+
serviceInfo: ctx.cfg.reportService,
|
586
|
+
}
|
547
587
|
default:
|
548
|
-
return
|
588
|
+
return {
|
589
|
+
serviceId: 'bsky_appview',
|
590
|
+
serviceInfo: ctx.cfg.bskyAppView,
|
591
|
+
}
|
549
592
|
}
|
550
593
|
}
|
551
594
|
|
package/src/util/http.ts
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
import { ServerResponse } from 'node:http'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Set or appends a value to the `Vary` header in the response, only if the
|
5
|
+
* value is not already present.
|
6
|
+
*/
|
7
|
+
export function appendVary(res: ServerResponse, value: string) {
|
8
|
+
if (!varyContains(res, value.toLowerCase())) {
|
9
|
+
res.appendHeader('Vary', value)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
function varyContains(res: ServerResponse, searchValue: string) {
|
14
|
+
const headerValue = res.getHeader('Vary')
|
15
|
+
switch (typeof headerValue) {
|
16
|
+
case 'string':
|
17
|
+
return varyStringContains(headerValue, searchValue)
|
18
|
+
case 'object':
|
19
|
+
// headerValue is a string[] here
|
20
|
+
return headerValue.some((h) => varyStringContains(h, searchValue))
|
21
|
+
default:
|
22
|
+
return false
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
function varyStringContains(headerValue: string, searchValue: string): boolean {
|
27
|
+
return headerValue
|
28
|
+
.split(',')
|
29
|
+
.map((v) => v.trim().toLowerCase())
|
30
|
+
.some((v) => v === searchValue || v === `*`)
|
31
|
+
}
|
package/tests/oauth.test.ts
CHANGED
@@ -180,7 +180,11 @@ describe('oauth', () => {
|
|
180
180
|
})
|
181
181
|
|
182
182
|
it('allows resetting the password', async () => {
|
183
|
-
const sendTemplateMock =
|
183
|
+
const sendTemplateMock = jest
|
184
|
+
.spyOn(network.pds.ctx.mailer, 'sendResetPassword')
|
185
|
+
.mockImplementation(async () => {
|
186
|
+
// noop
|
187
|
+
})
|
184
188
|
|
185
189
|
const page = await PageHelper.from(browser)
|
186
190
|
|
@@ -194,7 +198,7 @@ describe('oauth', () => {
|
|
194
198
|
await input.press('Enter')
|
195
199
|
})
|
196
200
|
|
197
|
-
await page.checkTitle('
|
201
|
+
await page.checkTitle('Connexion')
|
198
202
|
|
199
203
|
await page.clickOnButton('Oublié ?')
|
200
204
|
|
@@ -210,17 +214,13 @@ describe('oauth', () => {
|
|
210
214
|
|
211
215
|
expect(sendTemplateMock).toHaveBeenCalledTimes(1)
|
212
216
|
|
213
|
-
const [
|
214
|
-
|
215
|
-
expect(templateName).toBe('resetPassword')
|
217
|
+
const [params] = sendTemplateMock.mock.lastCall
|
216
218
|
expect(params).toEqual({
|
217
219
|
handle: 'alice.test',
|
218
220
|
token: expect.any(String),
|
219
221
|
})
|
220
222
|
|
221
|
-
|
222
|
-
|
223
|
-
await page.typeInInput('code', token)
|
223
|
+
await page.typeInInput('code', params.token)
|
224
224
|
|
225
225
|
await page.typeInInput('password', 'alice-new-pass')
|
226
226
|
|
@@ -233,8 +233,7 @@ describe('oauth', () => {
|
|
233
233
|
// TODO: Find out why we can't use "using" here
|
234
234
|
await page[Symbol.asyncDispose]()
|
235
235
|
|
236
|
-
|
237
|
-
sendTemplateMock[Symbol.dispose]()
|
236
|
+
sendTemplateMock.mockRestore()
|
238
237
|
})
|
239
238
|
|
240
239
|
it('Allows to sign-in trough OAuth', async () => {
|
@@ -250,12 +249,12 @@ describe('oauth', () => {
|
|
250
249
|
await input.press('Enter')
|
251
250
|
})
|
252
251
|
|
253
|
-
await page.checkTitle('
|
252
|
+
await page.checkTitle('Connexion')
|
254
253
|
|
255
254
|
await page.typeIn('input[type="password"]', 'alice-new-pass')
|
256
255
|
|
257
256
|
// Make sure the warning is visible
|
258
|
-
await page.ensureTextVisibility('Avertissement')
|
257
|
+
await page.ensureTextVisibility('Avertissement', 'h3')
|
259
258
|
|
260
259
|
await page.clickOn(
|
261
260
|
'label::-p-text(Se souvenir de ce compte sur cet appareil)',
|
@@ -317,31 +316,6 @@ describe('oauth', () => {
|
|
317
316
|
})
|
318
317
|
})
|
319
318
|
|
320
|
-
async function withMokedMailer(network: TestNetworkNoAppView) {
|
321
|
-
// @ts-expect-error
|
322
|
-
const sendTemplateOrig = network.pds.ctx.mailer.sendTemplate
|
323
|
-
const sendTemplateMock = jest.fn(
|
324
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
325
|
-
async (templateName: unknown, params: unknown, mailOpts: unknown) => {
|
326
|
-
//
|
327
|
-
},
|
328
|
-
) as jest.Mock<
|
329
|
-
Promise<void>,
|
330
|
-
[templateName: unknown, params: unknown, mailOpts: unknown]
|
331
|
-
> &
|
332
|
-
Disposable
|
333
|
-
|
334
|
-
sendTemplateMock[Symbol.dispose] = () => {
|
335
|
-
// @ts-expect-error
|
336
|
-
network.pds.ctx.mailer.sendTemplate = sendTemplateOrig
|
337
|
-
}
|
338
|
-
|
339
|
-
// @ts-expect-error
|
340
|
-
network.pds.ctx.mailer.sendTemplate = sendTemplateMock
|
341
|
-
|
342
|
-
return sendTemplateMock
|
343
|
-
}
|
344
|
-
|
345
319
|
function clientHandler(
|
346
320
|
req: IncomingMessage,
|
347
321
|
res: ServerResponse,
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { AtpAgent } from '@atproto/api'
|
2
2
|
import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
|
3
|
-
import { AuthScope } from '../dist/auth-verifier'
|
4
3
|
import usersSeed from './seeds/users'
|
5
4
|
|
6
5
|
describe('user preferences', () => {
|
@@ -58,7 +57,9 @@ describe('user preferences', () => {
|
|
58
57
|
store.pref.putPreferences(
|
59
58
|
[{ $type: 'com.atproto.server.defs#unknown' }],
|
60
59
|
'com.atproto',
|
61
|
-
|
60
|
+
{
|
61
|
+
hasAccessFull: true,
|
62
|
+
},
|
62
63
|
),
|
63
64
|
)
|
64
65
|
const { data } = await agent.api.app.bsky.actor.getPreferences(
|
@@ -109,7 +110,10 @@ describe('user preferences', () => {
|
|
109
110
|
// Ensure other prefs were not clobbered
|
110
111
|
const otherPrefs = await network.pds.ctx.actorStore.read(
|
111
112
|
sc.dids.alice,
|
112
|
-
(store) =>
|
113
|
+
(store) =>
|
114
|
+
store.pref.getPreferences('com.atproto', {
|
115
|
+
hasAccessFull: true,
|
116
|
+
}),
|
113
117
|
)
|
114
118
|
expect(otherPrefs).toEqual([{ $type: 'com.atproto.server.defs#unknown' }])
|
115
119
|
})
|