@atproto/pds 0.4.104 → 0.4.106

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.
Files changed (209) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/account-manager/{index.d.ts → account-manager.d.ts} +26 -35
  3. package/dist/account-manager/account-manager.d.ts.map +1 -0
  4. package/dist/account-manager/{index.js → account-manager.js} +52 -207
  5. package/dist/account-manager/account-manager.js.map +1 -0
  6. package/dist/account-manager/helpers/account.d.ts +3 -3
  7. package/dist/account-manager/helpers/device-account.d.ts +15 -15
  8. package/dist/account-manager/helpers/device-account.d.ts.map +1 -1
  9. package/dist/account-manager/helpers/device-account.js +2 -1
  10. package/dist/account-manager/helpers/device-account.js.map +1 -1
  11. package/dist/account-manager/helpers/token.d.ts +98 -98
  12. package/dist/account-manager/oauth-store.d.ts +58 -0
  13. package/dist/account-manager/oauth-store.d.ts.map +1 -0
  14. package/dist/account-manager/oauth-store.js +417 -0
  15. package/dist/account-manager/oauth-store.js.map +1 -0
  16. package/dist/actor-store/record/reader.d.ts +3 -3
  17. package/dist/actor-store/repo/reader.d.ts +2 -0
  18. package/dist/actor-store/repo/reader.d.ts.map +1 -1
  19. package/dist/actor-store/repo/reader.js +9 -0
  20. package/dist/actor-store/repo/reader.js.map +1 -1
  21. package/dist/actor-store/repo/sql-repo-reader.d.ts +1 -1
  22. package/dist/actor-store/repo/transactor.d.ts.map +1 -1
  23. package/dist/actor-store/repo/transactor.js +13 -4
  24. package/dist/actor-store/repo/transactor.js.map +1 -1
  25. package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
  26. package/dist/api/com/atproto/admin/deleteAccount.js +2 -3
  27. package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
  28. package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
  29. package/dist/api/com/atproto/admin/updateAccountHandle.js +2 -6
  30. package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
  31. package/dist/api/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  32. package/dist/api/com/atproto/identity/resolveHandle.js +2 -36
  33. package/dist/api/com/atproto/identity/resolveHandle.js.map +1 -1
  34. package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
  35. package/dist/api/com/atproto/identity/updateHandle.js +1 -7
  36. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  37. package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
  38. package/dist/api/com/atproto/server/activateAccount.js +2 -18
  39. package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
  40. package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
  41. package/dist/api/com/atproto/server/createAccount.js +7 -7
  42. package/dist/api/com/atproto/server/createAccount.js.map +1 -1
  43. package/dist/api/com/atproto/server/createSession.js +1 -1
  44. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  45. package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
  46. package/dist/api/com/atproto/server/deleteAccount.js +2 -3
  47. package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
  48. package/dist/api/com/atproto/server/getSession.js +1 -1
  49. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  50. package/dist/api/com/atproto/server/refreshSession.js +1 -1
  51. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  52. package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
  53. package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
  54. package/dist/api/com/atproto/sync/getRepoStatus.js +1 -1
  55. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
  56. package/dist/api/com/atproto/sync/listRepos.js +1 -1
  57. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  58. package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  59. package/dist/api/com/atproto/sync/subscribeRepos.js +2 -10
  60. package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
  61. package/dist/app-view.d.ts +14 -0
  62. package/dist/app-view.d.ts.map +1 -0
  63. package/dist/app-view.js +36 -0
  64. package/dist/app-view.js.map +1 -0
  65. package/dist/auth-routes.d.ts +1 -1
  66. package/dist/auth-routes.d.ts.map +1 -1
  67. package/dist/auth-routes.js +9 -3
  68. package/dist/auth-routes.js.map +1 -1
  69. package/dist/auth-verifier.d.ts +1 -1
  70. package/dist/auth-verifier.d.ts.map +1 -1
  71. package/dist/config/config.d.ts +3 -2
  72. package/dist/config/config.d.ts.map +1 -1
  73. package/dist/config/config.js +17 -7
  74. package/dist/config/config.js.map +1 -1
  75. package/dist/config/env.d.ts +4 -0
  76. package/dist/config/env.d.ts.map +1 -1
  77. package/dist/config/env.js +5 -0
  78. package/dist/config/env.js.map +1 -1
  79. package/dist/context.d.ts +4 -4
  80. package/dist/context.d.ts.map +1 -1
  81. package/dist/context.js +24 -18
  82. package/dist/context.js.map +1 -1
  83. package/dist/handle/index.d.ts +0 -7
  84. package/dist/handle/index.d.ts.map +1 -1
  85. package/dist/handle/index.js +4 -58
  86. package/dist/handle/index.js.map +1 -1
  87. package/dist/image/image-url.d.ts +8 -0
  88. package/dist/image/image-url.d.ts.map +1 -0
  89. package/dist/image/image-url.js +26 -0
  90. package/dist/image/image-url.js.map +1 -0
  91. package/dist/lexicon/index.d.ts +6 -0
  92. package/dist/lexicon/index.d.ts.map +1 -1
  93. package/dist/lexicon/index.js +12 -0
  94. package/dist/lexicon/index.js.map +1 -1
  95. package/dist/lexicon/lexicons.d.ts +310 -130
  96. package/dist/lexicon/lexicons.d.ts.map +1 -1
  97. package/dist/lexicon/lexicons.js +171 -67
  98. package/dist/lexicon/lexicons.js.map +1 -1
  99. package/dist/lexicon/types/app/bsky/embed/video.d.ts +1 -0
  100. package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -1
  101. package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
  102. package/dist/lexicon/types/com/atproto/identity/defs.d.ts +17 -0
  103. package/dist/lexicon/types/com/atproto/identity/defs.d.ts.map +1 -0
  104. package/dist/lexicon/types/com/atproto/identity/defs.js +16 -0
  105. package/dist/lexicon/types/com/atproto/identity/defs.js.map +1 -0
  106. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
  107. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts.map +1 -0
  108. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js +7 -0
  109. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js.map +1 -0
  110. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts +40 -0
  111. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts.map +1 -0
  112. package/dist/lexicon/types/com/atproto/identity/resolveDid.js +7 -0
  113. package/dist/lexicon/types/com/atproto/identity/resolveDid.js.map +1 -0
  114. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts +1 -0
  115. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  116. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts +36 -0
  117. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts.map +1 -0
  118. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js +7 -0
  119. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js.map +1 -0
  120. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +1 -30
  121. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  122. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +0 -27
  123. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
  124. package/dist/lexicon/types/tools/ozone/team/listMembers.d.ts +1 -0
  125. package/dist/lexicon/types/tools/ozone/team/listMembers.d.ts.map +1 -1
  126. package/dist/mailer/index.d.ts +5 -5
  127. package/dist/mailer/index.d.ts.map +1 -1
  128. package/dist/mailer/index.js +6 -5
  129. package/dist/mailer/index.js.map +1 -1
  130. package/dist/read-after-write/viewer.d.ts +1 -1
  131. package/dist/read-after-write/viewer.d.ts.map +1 -1
  132. package/dist/repo/types.d.ts +6 -2
  133. package/dist/repo/types.d.ts.map +1 -1
  134. package/dist/repo/types.js.map +1 -1
  135. package/dist/scripts/rebuild-repo.d.ts.map +1 -1
  136. package/dist/scripts/rebuild-repo.js +2 -1
  137. package/dist/scripts/rebuild-repo.js.map +1 -1
  138. package/dist/sequencer/db/schema.d.ts +1 -1
  139. package/dist/sequencer/db/schema.d.ts.map +1 -1
  140. package/dist/sequencer/events.d.ts +27 -38
  141. package/dist/sequencer/events.d.ts.map +1 -1
  142. package/dist/sequencer/events.js +40 -58
  143. package/dist/sequencer/events.js.map +1 -1
  144. package/dist/sequencer/sequencer.d.ts +2 -3
  145. package/dist/sequencer/sequencer.d.ts.map +1 -1
  146. package/dist/sequencer/sequencer.js +5 -17
  147. package/dist/sequencer/sequencer.js.map +1 -1
  148. package/package.json +15 -15
  149. package/src/account-manager/{index.ts → account-manager.ts} +107 -307
  150. package/src/account-manager/helpers/device-account.ts +1 -0
  151. package/src/account-manager/oauth-store.ts +494 -0
  152. package/src/actor-store/repo/reader.ts +11 -0
  153. package/src/actor-store/repo/transactor.ts +15 -4
  154. package/src/api/com/atproto/admin/deleteAccount.ts +2 -3
  155. package/src/api/com/atproto/admin/updateAccountHandle.ts +7 -8
  156. package/src/api/com/atproto/identity/resolveHandle.ts +2 -11
  157. package/src/api/com/atproto/identity/updateHandle.ts +4 -7
  158. package/src/api/com/atproto/server/activateAccount.ts +4 -18
  159. package/src/api/com/atproto/server/createAccount.ts +15 -11
  160. package/src/api/com/atproto/server/createSession.ts +1 -1
  161. package/src/api/com/atproto/server/deleteAccount.ts +2 -3
  162. package/src/api/com/atproto/server/getSession.ts +1 -1
  163. package/src/api/com/atproto/server/refreshSession.ts +1 -1
  164. package/src/api/com/atproto/sync/getRecord.ts +0 -1
  165. package/src/api/com/atproto/sync/getRepoStatus.ts +1 -1
  166. package/src/api/com/atproto/sync/listRepos.ts +1 -1
  167. package/src/api/com/atproto/sync/subscribeRepos.ts +2 -9
  168. package/src/app-view.ts +24 -0
  169. package/src/auth-routes.ts +9 -3
  170. package/src/auth-verifier.ts +1 -1
  171. package/src/config/config.ts +25 -13
  172. package/src/config/env.ts +12 -0
  173. package/src/context.ts +44 -24
  174. package/src/handle/index.ts +6 -52
  175. package/src/image/image-url.ts +16 -0
  176. package/src/lexicon/index.ts +36 -0
  177. package/src/lexicon/lexicons.ts +186 -67
  178. package/src/lexicon/types/app/bsky/embed/video.ts +1 -0
  179. package/src/lexicon/types/com/atproto/identity/defs.ts +30 -0
  180. package/src/lexicon/types/com/atproto/identity/refreshIdentity.ts +52 -0
  181. package/src/lexicon/types/com/atproto/identity/resolveDid.ts +52 -0
  182. package/src/lexicon/types/com/atproto/identity/resolveHandle.ts +1 -0
  183. package/src/lexicon/types/com/atproto/identity/resolveIdentity.ts +48 -0
  184. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +0 -59
  185. package/src/lexicon/types/tools/ozone/team/listMembers.ts +1 -0
  186. package/src/mailer/index.ts +7 -5
  187. package/src/read-after-write/viewer.ts +1 -1
  188. package/src/repo/types.ts +7 -2
  189. package/src/scripts/rebuild-repo.ts +4 -1
  190. package/src/sequencer/db/schema.ts +1 -8
  191. package/src/sequencer/events.ts +47 -75
  192. package/src/sequencer/sequencer.ts +9 -23
  193. package/tests/account-deletion.test.ts +3 -5
  194. package/tests/oauth.test.ts +286 -71
  195. package/tests/sequencer.test.ts +20 -29
  196. package/tests/sync/subscribe-repos.test.ts +89 -45
  197. package/tsconfig.build.tsbuildinfo +1 -1
  198. package/dist/account-manager/index.d.ts.map +0 -1
  199. package/dist/account-manager/index.js.map +0 -1
  200. package/dist/actor-store/repo/util.d.ts +0 -5
  201. package/dist/actor-store/repo/util.d.ts.map +0 -1
  202. package/dist/actor-store/repo/util.js +0 -25
  203. package/dist/actor-store/repo/util.js.map +0 -1
  204. package/dist/oauth/provider.d.ts +0 -10
  205. package/dist/oauth/provider.d.ts.map +0 -1
  206. package/dist/oauth/provider.js +0 -38
  207. package/dist/oauth/provider.js.map +0 -1
  208. package/src/actor-store/repo/util.ts +0 -22
  209. package/src/oauth/provider.ts +0 -59
@@ -77,7 +77,10 @@ export const rebuildRepo = async (ctx: AppContext, args: string[]) => {
77
77
  }
78
78
  })
79
79
  await ctx.accountManager.updateRepoRoot(did, commit.cid, rev)
80
- await ctx.sequencer.sequenceCommit(did, commit)
80
+ const syncData = await ctx.actorStore.read(did, (store) =>
81
+ store.repo.getSyncEventData(),
82
+ )
83
+ await ctx.sequencer.sequenceSyncEvt(did, syncData)
81
84
  }
82
85
 
83
86
  const promptContinue = async (): Promise<boolean> => {
@@ -1,13 +1,6 @@
1
1
  import { Generated, GeneratedAlways, Insertable, Selectable } from 'kysely'
2
2
 
3
- export type RepoSeqEventType =
4
- | 'append'
5
- | 'rebase'
6
- | 'handle'
7
- | 'migrate'
8
- | 'identity'
9
- | 'account'
10
- | 'tombstone'
3
+ export type RepoSeqEventType = 'append' | 'sync' | 'identity' | 'account'
11
4
 
12
5
  export interface RepoSeq {
13
6
  seq: GeneratedAlways<number>
@@ -1,8 +1,9 @@
1
+ import assert from 'node:assert'
1
2
  import { z } from 'zod'
2
3
  import { cborEncode, noUndefinedVals, schema } from '@atproto/common'
3
4
  import { BlockMap, blocksToCarFile } from '@atproto/repo'
4
- import { AccountStatus } from '../account-manager'
5
- import { CommitDataWithOps } from '../repo'
5
+ import { AccountStatus } from '../account-manager/account-manager'
6
+ import { CommitDataWithOps, SyncEvtData } from '../repo'
6
7
  import { RepoSeqInsert } from './db'
7
8
 
8
9
  export const formatSeqCommit = async (
@@ -13,41 +14,18 @@ export const formatSeqCommit = async (
13
14
  blocksToSend.addMap(commitData.newBlocks)
14
15
  blocksToSend.addMap(commitData.relevantBlocks)
15
16
 
16
- let evt: CommitEvt
17
-
18
- // If event is too big (max 200 ops or 1MB of data)
19
- if (commitData.ops.length > 200 || blocksToSend.byteSize > 1000000) {
20
- const justRoot = new BlockMap()
21
- const rootBlock = blocksToSend.get(commitData.cid)
22
- if (rootBlock) {
23
- justRoot.set(commitData.cid, rootBlock)
24
- }
25
-
26
- evt = {
27
- rebase: false,
28
- tooBig: true,
29
- repo: did,
30
- commit: commitData.cid,
31
- rev: commitData.rev,
32
- since: commitData.since,
33
- blocks: await blocksToCarFile(commitData.cid, justRoot),
34
- ops: [],
35
- blobs: [],
36
- prevData: commitData.prevData ?? undefined,
37
- }
38
- } else {
39
- evt = {
40
- rebase: false,
41
- tooBig: false,
42
- repo: did,
43
- commit: commitData.cid,
44
- rev: commitData.rev,
45
- since: commitData.since,
46
- blocks: await blocksToCarFile(commitData.cid, blocksToSend),
47
- ops: commitData.ops,
48
- blobs: commitData.blobs.toList(),
49
- prevData: commitData.prevData ?? undefined,
50
- }
17
+ const evt = {
18
+ repo: did,
19
+ commit: commitData.cid,
20
+ rev: commitData.rev,
21
+ since: commitData.since,
22
+ blocks: await blocksToCarFile(commitData.cid, blocksToSend),
23
+ ops: commitData.ops,
24
+ prevData: commitData.prevData ?? undefined,
25
+ // deprecated (but still required) fields
26
+ rebase: false,
27
+ tooBig: false,
28
+ blobs: [],
51
29
  }
52
30
 
53
31
  return {
@@ -58,22 +36,41 @@ export const formatSeqCommit = async (
58
36
  }
59
37
  }
60
38
 
61
- export const formatSeqHandleUpdate = async (
39
+ export const formatSeqSyncEvt = async (
62
40
  did: string,
63
- handle: string,
41
+ data: SyncEvtData,
64
42
  ): Promise<RepoSeqInsert> => {
65
- const evt: HandleEvt = {
43
+ const blocks = await blocksToCarFile(data.cid, data.blocks)
44
+ const evt: SyncEvt = {
66
45
  did,
67
- handle,
46
+ rev: data.rev,
47
+ blocks,
68
48
  }
69
49
  return {
70
50
  did,
71
- eventType: 'handle',
51
+ eventType: 'sync',
72
52
  event: cborEncode(evt),
73
53
  sequencedAt: new Date().toISOString(),
74
54
  }
75
55
  }
76
56
 
57
+ export const syncEvtDataFromCommit = (
58
+ commitData: CommitDataWithOps,
59
+ ): SyncEvtData => {
60
+ const { blocks, missing } = commitData.relevantBlocks.getMany([
61
+ commitData.cid,
62
+ ])
63
+ assert(
64
+ !missing.length,
65
+ 'commit block was not found, could not build sync event',
66
+ )
67
+ return {
68
+ rev: commitData.rev,
69
+ cid: commitData.cid,
70
+ blocks,
71
+ }
72
+ }
73
+
77
74
  export const formatSeqIdentityEvt = async (
78
75
  did: string,
79
76
  handle?: string,
@@ -112,20 +109,6 @@ export const formatSeqAccountEvt = async (
112
109
  }
113
110
  }
114
111
 
115
- export const formatSeqTombstone = async (
116
- did: string,
117
- ): Promise<RepoSeqInsert> => {
118
- const evt: TombstoneEvt = {
119
- did,
120
- }
121
- return {
122
- did,
123
- eventType: 'tombstone',
124
- event: cborEncode(evt),
125
- sequencedAt: new Date().toISOString(),
126
- }
127
- }
128
-
129
112
  export const commitEvtOp = z.object({
130
113
  action: z.union([
131
114
  z.literal('create'),
@@ -152,11 +135,12 @@ export const commitEvt = z.object({
152
135
  })
153
136
  export type CommitEvt = z.infer<typeof commitEvt>
154
137
 
155
- export const handleEvt = z.object({
138
+ export const syncEvt = z.object({
156
139
  did: z.string(),
157
- handle: z.string(),
140
+ blocks: schema.bytes,
141
+ rev: z.string(),
158
142
  })
159
- export type HandleEvt = z.infer<typeof handleEvt>
143
+ export type SyncEvt = z.infer<typeof syncEvt>
160
144
 
161
145
  export const identityEvt = z.object({
162
146
  did: z.string(),
@@ -178,22 +162,17 @@ export const accountEvt = z.object({
178
162
  })
179
163
  export type AccountEvt = z.infer<typeof accountEvt>
180
164
 
181
- export const tombstoneEvt = z.object({
182
- did: z.string(),
183
- })
184
- export type TombstoneEvt = z.infer<typeof tombstoneEvt>
185
-
186
165
  type TypedCommitEvt = {
187
166
  type: 'commit'
188
167
  seq: number
189
168
  time: string
190
169
  evt: CommitEvt
191
170
  }
192
- type TypedHandleEvt = {
193
- type: 'handle'
171
+ type TypedSyncEvt = {
172
+ type: 'sync'
194
173
  seq: number
195
174
  time: string
196
- evt: HandleEvt
175
+ evt: SyncEvt
197
176
  }
198
177
  type TypedIdentityEvt = {
199
178
  type: 'identity'
@@ -207,15 +186,8 @@ type TypedAccountEvt = {
207
186
  time: string
208
187
  evt: AccountEvt
209
188
  }
210
- type TypedTombstoneEvt = {
211
- type: 'tombstone'
212
- seq: number
213
- time: string
214
- evt: TombstoneEvt
215
- }
216
189
  export type SeqEvt =
217
190
  | TypedCommitEvt
218
- | TypedHandleEvt
191
+ | TypedSyncEvt
219
192
  | TypedIdentityEvt
220
193
  | TypedAccountEvt
221
- | TypedTombstoneEvt
@@ -4,7 +4,7 @@ import { SECOND, cborDecode, wait } from '@atproto/common'
4
4
  import { AccountStatus } from '../account-manager/helpers/account'
5
5
  import { Crawlers } from '../crawlers'
6
6
  import { seqLogger as log } from '../logger'
7
- import { CommitDataWithOps } from '../repo'
7
+ import { CommitDataWithOps, SyncEvtData } from '../repo'
8
8
  import {
9
9
  RepoSeqEntry,
10
10
  RepoSeqInsert,
@@ -15,15 +15,13 @@ import {
15
15
  import {
16
16
  AccountEvt,
17
17
  CommitEvt,
18
- HandleEvt,
19
18
  IdentityEvt,
20
19
  SeqEvt,
21
- TombstoneEvt,
20
+ SyncEvt,
22
21
  formatSeqAccountEvt,
23
22
  formatSeqCommit,
24
- formatSeqHandleUpdate,
25
23
  formatSeqIdentityEvt,
26
- formatSeqTombstone,
24
+ formatSeqSyncEvt,
27
25
  } from './events'
28
26
 
29
27
  export * from './events'
@@ -135,19 +133,19 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
135
133
  continue
136
134
  }
137
135
  const evt = cborDecode(row.event)
138
- if (row.eventType === 'append' || row.eventType === 'rebase') {
136
+ if (row.eventType === 'append') {
139
137
  seqEvts.push({
140
138
  type: 'commit',
141
139
  seq: row.seq,
142
140
  time: row.sequencedAt,
143
141
  evt: evt as CommitEvt,
144
142
  })
145
- } else if (row.eventType === 'handle') {
143
+ } else if (row.eventType === 'sync') {
146
144
  seqEvts.push({
147
- type: 'handle',
145
+ type: 'sync',
148
146
  seq: row.seq,
149
147
  time: row.sequencedAt,
150
- evt: evt as HandleEvt,
148
+ evt: evt as SyncEvt,
151
149
  })
152
150
  } else if (row.eventType === 'identity') {
153
151
  seqEvts.push({
@@ -163,13 +161,6 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
163
161
  time: row.sequencedAt,
164
162
  evt: evt as AccountEvt,
165
163
  })
166
- } else if (row.eventType === 'tombstone') {
167
- seqEvts.push({
168
- type: 'tombstone',
169
- seq: row.seq,
170
- time: row.sequencedAt,
171
- evt: evt as TombstoneEvt,
172
- })
173
164
  }
174
165
  }
175
166
 
@@ -222,8 +213,8 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
222
213
  return await this.sequenceEvt(evt)
223
214
  }
224
215
 
225
- async sequenceHandleUpdate(did: string, handle: string): Promise<number> {
226
- const evt = await formatSeqHandleUpdate(did, handle)
216
+ async sequenceSyncEvt(did: string, data: SyncEvtData) {
217
+ const evt = await formatSeqSyncEvt(did, data)
227
218
  return await this.sequenceEvt(evt)
228
219
  }
229
220
 
@@ -240,11 +231,6 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
240
231
  return await this.sequenceEvt(evt)
241
232
  }
242
233
 
243
- async sequenceTombstone(did: string): Promise<number> {
244
- const evt = await formatSeqTombstone(did)
245
- return await this.sequenceEvt(evt)
246
- }
247
-
248
234
  async deleteAllForUser(did: string, excludingSeqs: number[] = []) {
249
235
  await this.db.executeWithRetry(
250
236
  this.db.db
@@ -151,14 +151,12 @@ describe('account deletion', () => {
151
151
  expect(
152
152
  updatedDbContents.repoSeqs
153
153
  .filter((row) => row.did === carol.did)
154
- .every(
155
- (row) => row.eventType === 'tombstone' || row.eventType === 'account',
156
- ),
154
+ .every((row) => row.eventType === 'account'),
157
155
  ).toBe(true)
158
- // check we do have a tombstone for this did
156
+ // check we do have a account (deletion) event for this did
159
157
  expect(
160
158
  updatedDbContents.repoSeqs.filter(
161
- (row) => row.did === carol.did && row.eventType === 'tombstone',
159
+ (row) => row.did === carol.did && row.eventType === 'account',
162
160
  ).length,
163
161
  ).toEqual(1)
164
162
  expect(updatedDbContents.appPasswords).toEqual(