@atproto/pds 0.4.11 → 0.4.12
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/dist/account-manager/helpers/invite.d.ts.map +1 -1
- package/dist/account-manager/helpers/invite.js.map +1 -1
- package/dist/actor-store/blob/reader.d.ts.map +1 -1
- package/dist/actor-store/blob/reader.js.map +1 -1
- package/dist/actor-store/index.d.ts +1 -0
- package/dist/actor-store/index.d.ts.map +1 -1
- package/dist/actor-store/index.js +1 -0
- package/dist/actor-store/index.js.map +1 -1
- package/dist/actor-store/record/transactor.d.ts.map +1 -1
- package/dist/actor-store/record/transactor.js.map +1 -1
- package/dist/actor-store/repo/reader.d.ts.map +1 -1
- package/dist/actor-store/repo/reader.js.map +1 -1
- package/dist/actor-store/repo/sql-repo-transactor.d.ts.map +1 -1
- package/dist/actor-store/repo/sql-repo-transactor.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +1 -2
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/db/migrator.d.ts.map +1 -1
- package/dist/db/migrator.js.map +1 -1
- package/dist/db/pagination.d.ts.map +1 -1
- package/dist/db/pagination.js.map +1 -1
- package/dist/disk-blobstore.d.ts.map +1 -1
- package/dist/disk-blobstore.js +3 -1
- package/dist/disk-blobstore.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +14 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +15 -1
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/mailer/index.js.map +1 -1
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js.map +1 -1
- package/dist/read-after-write/util.d.ts.map +1 -1
- package/dist/read-after-write/util.js +1 -2
- package/dist/read-after-write/util.js.map +1 -1
- package/dist/read-after-write/viewer.d.ts +2 -4
- package/dist/read-after-write/viewer.d.ts.map +1 -1
- package/dist/read-after-write/viewer.js +4 -10
- package/dist/read-after-write/viewer.js.map +1 -1
- package/dist/sequencer/outbox.d.ts.map +1 -1
- package/dist/sequencer/outbox.js.map +1 -1
- package/package.json +3 -3
- package/src/account-manager/helpers/invite.ts +10 -7
- package/src/actor-store/blob/reader.ts +4 -1
- package/src/actor-store/index.ts +2 -0
- package/src/actor-store/record/transactor.ts +4 -1
- package/src/actor-store/repo/reader.ts +4 -1
- package/src/actor-store/repo/sql-repo-transactor.ts +5 -1
- package/src/api/app/bsky/feed/getPostThread.ts +1 -2
- package/src/api/com/atproto/repo/uploadBlob.ts +2 -3
- package/src/context.ts +4 -10
- package/src/db/migrator.ts +4 -1
- package/src/db/pagination.ts +4 -1
- package/src/disk-blobstore.ts +3 -1
- package/src/lexicon/lexicons.ts +16 -1
- package/src/lexicon/types/com/atproto/sync/getRecord.ts +1 -1
- package/src/mailer/index.ts +1 -1
- package/src/pipethrough.ts +7 -4
- package/src/read-after-write/util.ts +1 -2
- package/src/read-after-write/viewer.ts +8 -8
- package/src/sequencer/outbox.ts +4 -1
- package/tests/account-deletion.test.ts +7 -0
- package/tests/entryway.test.ts +2 -3
@@ -52,8 +52,7 @@ export const readAfterWriteInternal = async <T>(
|
|
52
52
|
if (local.count === 0) {
|
53
53
|
return res
|
54
54
|
}
|
55
|
-
const
|
56
|
-
const localViewer = ctx.localViewer(store, keypair)
|
55
|
+
const localViewer = ctx.localViewer(store)
|
57
56
|
const parsedRes = parseRes<T>(nsid, res)
|
58
57
|
const data = await munge(localViewer, parsedRes, local, requester)
|
59
58
|
return formatMungedResponse(data, getLocalLag(local))
|
@@ -3,7 +3,6 @@ import { CID } from 'multiformats/cid'
|
|
3
3
|
import { AtUri, INVALID_HANDLE } from '@atproto/syntax'
|
4
4
|
import { cborToLexRecord } from '@atproto/repo'
|
5
5
|
import { AtpAgent } from '@atproto/api'
|
6
|
-
import { Keypair } from '@atproto/crypto'
|
7
6
|
import { createServiceAuthHeaders } from '@atproto/xrpc-server'
|
8
7
|
import { Record as PostRecord } from '../lexicon/types/app/bsky/feed/post'
|
9
8
|
import { Record as ProfileRecord } from '../lexicon/types/app/bsky/actor/profile'
|
@@ -43,10 +42,11 @@ import { AccountManager } from '../account-manager'
|
|
43
42
|
|
44
43
|
type CommonSignedUris = 'avatar' | 'banner' | 'feed_thumbnail' | 'feed_fullsize'
|
45
44
|
|
45
|
+
export type LocalViewerCreator = (actorStore: ActorStoreReader) => LocalViewer
|
46
|
+
|
46
47
|
export class LocalViewer {
|
47
48
|
did: string
|
48
49
|
actorStore: ActorStoreReader
|
49
|
-
actorKey: Keypair
|
50
50
|
accountManager: AccountManager
|
51
51
|
pdsHostname: string
|
52
52
|
appViewAgent?: AtpAgent
|
@@ -55,7 +55,6 @@ export class LocalViewer {
|
|
55
55
|
|
56
56
|
constructor(params: {
|
57
57
|
actorStore: ActorStoreReader
|
58
|
-
actorKey: Keypair
|
59
58
|
accountManager: AccountManager
|
60
59
|
pdsHostname: string
|
61
60
|
appViewAgent?: AtpAgent
|
@@ -64,7 +63,6 @@ export class LocalViewer {
|
|
64
63
|
}) {
|
65
64
|
this.did = params.actorStore.did
|
66
65
|
this.actorStore = params.actorStore
|
67
|
-
this.actorKey = params.actorKey
|
68
66
|
this.accountManager = params.accountManager
|
69
67
|
this.pdsHostname = params.pdsHostname
|
70
68
|
this.appViewAgent = params.appViewAgent
|
@@ -78,9 +76,9 @@ export class LocalViewer {
|
|
78
76
|
appViewAgent?: AtpAgent
|
79
77
|
appviewDid?: string
|
80
78
|
appviewCdnUrlPattern?: string
|
81
|
-
}) {
|
82
|
-
return (actorStore
|
83
|
-
return new LocalViewer({ ...params, actorStore
|
79
|
+
}): LocalViewerCreator {
|
80
|
+
return (actorStore) => {
|
81
|
+
return new LocalViewer({ ...params, actorStore })
|
84
82
|
}
|
85
83
|
}
|
86
84
|
|
@@ -95,10 +93,12 @@ export class LocalViewer {
|
|
95
93
|
if (!this.appviewDid) {
|
96
94
|
throw new Error('Could not find bsky appview did')
|
97
95
|
}
|
96
|
+
const keypair = await this.actorStore.keypair()
|
97
|
+
|
98
98
|
return createServiceAuthHeaders({
|
99
99
|
iss: did,
|
100
100
|
aud: this.appviewDid,
|
101
|
-
keypair
|
101
|
+
keypair,
|
102
102
|
})
|
103
103
|
}
|
104
104
|
|
package/src/sequencer/outbox.ts
CHANGED
@@ -13,7 +13,10 @@ export class Outbox {
|
|
13
13
|
cutoverBuffer: SeqEvt[]
|
14
14
|
outBuffer: AsyncBuffer<SeqEvt>
|
15
15
|
|
16
|
-
constructor(
|
16
|
+
constructor(
|
17
|
+
public sequencer: Sequencer,
|
18
|
+
opts: Partial<OutboxOpts> = {},
|
19
|
+
) {
|
17
20
|
const { maxBufferSize = 500 } = opts
|
18
21
|
this.cutoverBuffer = []
|
19
22
|
this.outBuffer = new AsyncBuffer<SeqEvt>(maxBufferSize)
|
@@ -185,6 +185,13 @@ describe('account deletion', () => {
|
|
185
185
|
await expect(attempt2).rejects.toThrow(BlobNotFoundError)
|
186
186
|
})
|
187
187
|
|
188
|
+
it('maintains blobs from other actors', async () => {
|
189
|
+
const bobBlobstore = network.pds.ctx.blobstore(sc.dids.bob)
|
190
|
+
const [img] = sc.replies[sc.dids.bob][0].images
|
191
|
+
const attempt = bobBlobstore.getBytes(img.image.ref)
|
192
|
+
await expect(attempt).resolves.toBeDefined()
|
193
|
+
})
|
194
|
+
|
188
195
|
it('can delete an empty user', async () => {
|
189
196
|
const eve = await sc.createAccount('eve', {
|
190
197
|
handle: 'eve.test',
|
package/tests/entryway.test.ts
CHANGED
@@ -120,9 +120,8 @@ describe('entryway', () => {
|
|
120
120
|
},
|
121
121
|
)
|
122
122
|
const doc = await entryway.ctx.idResolver.did.resolve(alice)
|
123
|
-
const handleToDid =
|
124
|
-
'alice3.test'
|
125
|
-
)
|
123
|
+
const handleToDid =
|
124
|
+
await entryway.ctx.idResolver.handle.resolve('alice3.test')
|
126
125
|
const accountFromPds = await pds.ctx.accountManager.getAccount(alice)
|
127
126
|
const accountFromEntryway = await entryway.ctx.services
|
128
127
|
.account(entryway.ctx.db)
|