Skip to content

Commit

Permalink
Wrap sync semantics (#3585)
Browse files Browse the repository at this point in the history
* deprecate blobs & tooBig

* add sync event, deprecate handle & tombstone

* fix up tests

* small tidy

* add test for sync account on account activation

* use new sync event in another place

* remove deprecated events from lexicons

* formatting

* pr cleanup

* changeset
  • Loading branch information
dholms authored Feb 28, 2025
1 parent be80036 commit 3832019
Show file tree
Hide file tree
Showing 29 changed files with 177 additions and 801 deletions.
6 changes: 6 additions & 0 deletions .changeset/late-eyes-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@atproto/api": patch
"@atproto/pds": patch
---

Wrap sync v1.1 semantics. Add #sync event to subscribeRepos and deprecate #handle and #tombstone events
44 changes: 1 addition & 43 deletions lexicons/com/atproto/sync/subscribeRepos.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
"message": {
"schema": {
"type": "union",
"refs": [
"#commit",
"#sync",
"#identity",
"#account",
"#handle",
"#migrate",
"#tombstone",
"#info"
]
"refs": ["#commit", "#sync", "#identity", "#account", "#info"]
}
},
"errors": [
Expand Down Expand Up @@ -186,39 +177,6 @@
}
}
},
"handle": {
"type": "object",
"description": "DEPRECATED -- Use #identity event instead",
"required": ["seq", "did", "handle", "time"],
"properties": {
"seq": { "type": "integer" },
"did": { "type": "string", "format": "did" },
"handle": { "type": "string", "format": "handle" },
"time": { "type": "string", "format": "datetime" }
}
},
"migrate": {
"type": "object",
"description": "DEPRECATED -- Use #account event instead",
"required": ["seq", "did", "migrateTo", "time"],
"nullable": ["migrateTo"],
"properties": {
"seq": { "type": "integer" },
"did": { "type": "string", "format": "did" },
"migrateTo": { "type": "string" },
"time": { "type": "string", "format": "datetime" }
}
},
"tombstone": {
"type": "object",
"description": "DEPRECATED -- Use #account event instead",
"required": ["seq", "did", "time"],
"properties": {
"seq": { "type": "integer" },
"did": { "type": "string", "format": "did" },
"time": { "type": "string", "format": "datetime" }
}
},
"info": {
"type": "object",
"required": ["name"],
Expand Down
65 changes: 0 additions & 65 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3991,9 +3991,6 @@ export const schemaDict = {
'lex:com.atproto.sync.subscribeRepos#sync',
'lex:com.atproto.sync.subscribeRepos#identity',
'lex:com.atproto.sync.subscribeRepos#account',
'lex:com.atproto.sync.subscribeRepos#handle',
'lex:com.atproto.sync.subscribeRepos#migrate',
'lex:com.atproto.sync.subscribeRepos#tombstone',
'lex:com.atproto.sync.subscribeRepos#info',
],
},
Expand Down Expand Up @@ -4197,68 +4194,6 @@ export const schemaDict = {
},
},
},
handle: {
type: 'object',
description: 'DEPRECATED -- Use #identity event instead',
required: ['seq', 'did', 'handle', 'time'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
handle: {
type: 'string',
format: 'handle',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
migrate: {
type: 'object',
description: 'DEPRECATED -- Use #account event instead',
required: ['seq', 'did', 'migrateTo', 'time'],
nullable: ['migrateTo'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
migrateTo: {
type: 'string',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
tombstone: {
type: 'object',
description: 'DEPRECATED -- Use #account event instead',
required: ['seq', 'did', 'time'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
info: {
type: 'object',
required: ['name'],
Expand Down
56 changes: 0 additions & 56 deletions packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,62 +122,6 @@ export function validateAccount<V>(v: V) {
return validate<Account & V>(v, id, hashAccount)
}

/** DEPRECATED -- Use #identity event instead */
export interface Handle {
$type?: 'com.atproto.sync.subscribeRepos#handle'
seq: number
did: string
handle: string
time: string
}

const hashHandle = 'handle'

export function isHandle<V>(v: V) {
return is$typed(v, id, hashHandle)
}

export function validateHandle<V>(v: V) {
return validate<Handle & V>(v, id, hashHandle)
}

/** DEPRECATED -- Use #account event instead */
export interface Migrate {
$type?: 'com.atproto.sync.subscribeRepos#migrate'
seq: number
did: string
migrateTo: string | null
time: string
}

const hashMigrate = 'migrate'

export function isMigrate<V>(v: V) {
return is$typed(v, id, hashMigrate)
}

export function validateMigrate<V>(v: V) {
return validate<Migrate & V>(v, id, hashMigrate)
}

/** DEPRECATED -- Use #account event instead */
export interface Tombstone {
$type?: 'com.atproto.sync.subscribeRepos#tombstone'
seq: number
did: string
time: string
}

const hashTombstone = 'tombstone'

export function isTombstone<V>(v: V) {
return is$typed(v, id, hashTombstone)
}

export function validateTombstone<V>(v: V) {
return validate<Tombstone & V>(v, id, hashTombstone)
}

export interface Info {
$type?: 'com.atproto.sync.subscribeRepos#info'
name: 'OutdatedCursor' | (string & {})
Expand Down
81 changes: 0 additions & 81 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2035,16 +2035,6 @@ export const schemaDict = {
cursor: {
type: 'string',
},
rkeyStart: {
type: 'string',
description:
'DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)',
},
rkeyEnd: {
type: 'string',
description:
'DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)',
},
reverse: {
type: 'boolean',
description: 'Flag to reverse the order of the returned records.',
Expand Down Expand Up @@ -3585,12 +3575,6 @@ export const schemaDict = {
description: 'Record Key',
format: 'record-key',
},
commit: {
type: 'string',
format: 'cid',
description:
'DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit',
},
},
},
output: {
Expand Down Expand Up @@ -4007,9 +3991,6 @@ export const schemaDict = {
'lex:com.atproto.sync.subscribeRepos#sync',
'lex:com.atproto.sync.subscribeRepos#identity',
'lex:com.atproto.sync.subscribeRepos#account',
'lex:com.atproto.sync.subscribeRepos#handle',
'lex:com.atproto.sync.subscribeRepos#migrate',
'lex:com.atproto.sync.subscribeRepos#tombstone',
'lex:com.atproto.sync.subscribeRepos#info',
],
},
Expand Down Expand Up @@ -4213,68 +4194,6 @@ export const schemaDict = {
},
},
},
handle: {
type: 'object',
description: 'DEPRECATED -- Use #identity event instead',
required: ['seq', 'did', 'handle', 'time'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
handle: {
type: 'string',
format: 'handle',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
migrate: {
type: 'object',
description: 'DEPRECATED -- Use #account event instead',
required: ['seq', 'did', 'migrateTo', 'time'],
nullable: ['migrateTo'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
migrateTo: {
type: 'string',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
tombstone: {
type: 'object',
description: 'DEPRECATED -- Use #account event instead',
required: ['seq', 'did', 'time'],
properties: {
seq: {
type: 'integer',
},
did: {
type: 'string',
format: 'did',
},
time: {
type: 'string',
format: 'datetime',
},
},
},
info: {
type: 'object',
required: ['name'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export interface QueryParams {
/** The number of records to return. */
limit: number
cursor?: string
/** DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) */
rkeyStart?: string
/** DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) */
rkeyEnd?: string
/** Flag to reverse the order of the returned records. */
reverse?: boolean
}
Expand Down
2 changes: 0 additions & 2 deletions packages/bsky/src/lexicon/types/com/atproto/sync/getRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export interface QueryParams {
collection: string
/** Record Key */
rkey: string
/** DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit */
commit?: string
}

export type InputSchema = undefined
Expand Down
Loading

0 comments on commit 3832019

Please sign in to comment.