From 00ce729e73c7534e7662e92beaf352587dbfd575 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Fri, 1 Mar 2024 17:06:05 -0800 Subject: [PATCH 01/11] subscribe repos lex: new #account event type --- lexicons/com/atproto/sync/defs.json | 22 ++++++++++++++++ lexicons/com/atproto/sync/subscribeRepos.json | 25 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lexicons/com/atproto/sync/defs.json diff --git a/lexicons/com/atproto/sync/defs.json b/lexicons/com/atproto/sync/defs.json new file mode 100644 index 00000000000..1f3bb567f8b --- /dev/null +++ b/lexicons/com/atproto/sync/defs.json @@ -0,0 +1,22 @@ +{ + "lexicon": 1, + "id": "com.atproto.sync.defs", + "defs": { + "takendown": { + "type": "token", + "description": "Account hosting status indicating that an administrator has taken down the account, for a permanent period (though this may be reversed)." + }, + "suspended": { + "type": "token", + "description": "Account hosting status indicating that an administrator has taken down the account, for a limited (but possibly indefinite) time period." + }, + "deleted": { + "type": "token", + "description": "Account hosting status indicating that the repository has been removed. The account may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened." + }, + "deactivated": { + "type": "token", + "description": "Account hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite." + } + } +} diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index 31d68b91c07..a2f674a70a4 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -20,6 +20,7 @@ "refs": [ "#commit", "#identity", + "#account", "#handle", "#migrate", "#tombstone", @@ -121,6 +122,30 @@ "time": { "type": "string", "format": "datetime" } } }, + "account": { + "type": "object", + "description": "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", + "required": ["seq", "did", "time", "active"], + "properties": { + "seq": { "type": "integer" }, + "did": { "type": "string", "format": "did" }, + "time": { "type": "string", "format": "datetime" }, + "active": { + "type": "boolean", + "description": "Indicates that the account has a repository which can be fetched from the host that emitted this event." + }, + "status": { + "type": "union", + "description": "If active=false, this optional field indicates a reason for why the account is not active.", + "refs": [ + "com.atproto.sync.defs#takendown", + "com.atproto.sync.defs#suspended", + "com.atproto.sync.defs#deleted", + "com.atproto.sync.defs#deactivated" + ] + } + } + }, "handle": { "type": "object", "description": "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", From a626d787f97ebbc6ee9b0c43b2210369ee16c483 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Fri, 1 Mar 2024 17:28:19 -0800 Subject: [PATCH 02/11] lex: getAccountStatus endpoint --- .../com/atproto/sync/getAccountStatus.json | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lexicons/com/atproto/sync/getAccountStatus.json diff --git a/lexicons/com/atproto/sync/getAccountStatus.json b/lexicons/com/atproto/sync/getAccountStatus.json new file mode 100644 index 00000000000..499e3154637 --- /dev/null +++ b/lexicons/com/atproto/sync/getAccountStatus.json @@ -0,0 +1,46 @@ +{ + "lexicon": 1, + "id": "com.atproto.sync.getAccountStatus", + "defs": { + "main": { + "type": "query", + "description": "Get the repository hosting status for an account, on this server. Expected to be implemented by PDS and Relay.", + "parameters": { + "type": "params", + "required": ["identifier"], + "properties": { + "did": { + "type": "string", + "format": "at-identifier", + "description": "The handle or DID of the account." + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["did", "active"], + "properties": { + "did": { "type": "string", "format": "did" }, + "active": { "type": "boolean" }, + "status": { + "type": "union", + "description": "If active=false, this optional field indicates a reason for why the account is not active.", + "refs": [ + "com.atproto.sync.defs#takendown", + "com.atproto.sync.defs#suspended", + "com.atproto.sync.defs#deactivated" + ] + }, + "rev": { + "type": "string", + "description": "Optional field, the current rev of the repo, if active=true" + } + } + } + }, + "errors": [{ "name": "AccountNotFound" }] + } + } +} From a78e62342da24a22b30505ebcc9644b5d96666b9 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Fri, 1 Mar 2024 17:28:58 -0800 Subject: [PATCH 03/11] lex: add account status errors to sync methods --- lexicons/com/atproto/sync/getBlob.json | 9 ++++++++- lexicons/com/atproto/sync/getBlocks.json | 9 ++++++++- lexicons/com/atproto/sync/getLatestCommit.json | 7 ++++++- lexicons/com/atproto/sync/getRecord.json | 9 ++++++++- lexicons/com/atproto/sync/getRepo.json | 8 +++++++- lexicons/com/atproto/sync/listBlobs.json | 8 +++++++- 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/lexicons/com/atproto/sync/getBlob.json b/lexicons/com/atproto/sync/getBlob.json index 57ece7a9d8a..6e652c648b9 100644 --- a/lexicons/com/atproto/sync/getBlob.json +++ b/lexicons/com/atproto/sync/getBlob.json @@ -23,7 +23,14 @@ }, "output": { "encoding": "*/*" - } + }, + "errors": [ + { "name": "BlobNotFound" }, + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } diff --git a/lexicons/com/atproto/sync/getBlocks.json b/lexicons/com/atproto/sync/getBlocks.json index 29dd4971904..f1f4a1b057f 100644 --- a/lexicons/com/atproto/sync/getBlocks.json +++ b/lexicons/com/atproto/sync/getBlocks.json @@ -22,7 +22,14 @@ }, "output": { "encoding": "application/vnd.ipld.car" - } + }, + "errors": [ + { "name": "BlockNotFound" }, + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } diff --git a/lexicons/com/atproto/sync/getLatestCommit.json b/lexicons/com/atproto/sync/getLatestCommit.json index ac7faf57570..34c0c023182 100644 --- a/lexicons/com/atproto/sync/getLatestCommit.json +++ b/lexicons/com/atproto/sync/getLatestCommit.json @@ -27,7 +27,12 @@ } } }, - "errors": [{ "name": "RepoNotFound" }] + "errors": [ + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } diff --git a/lexicons/com/atproto/sync/getRecord.json b/lexicons/com/atproto/sync/getRecord.json index 718245a5195..92454e69b64 100644 --- a/lexicons/com/atproto/sync/getRecord.json +++ b/lexicons/com/atproto/sync/getRecord.json @@ -25,7 +25,14 @@ }, "output": { "encoding": "application/vnd.ipld.car" - } + }, + "errors": [ + { "name": "RecordNotFound" }, + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } diff --git a/lexicons/com/atproto/sync/getRepo.json b/lexicons/com/atproto/sync/getRepo.json index 7fa710abfb5..30ba74acf27 100644 --- a/lexicons/com/atproto/sync/getRepo.json +++ b/lexicons/com/atproto/sync/getRepo.json @@ -22,7 +22,13 @@ }, "output": { "encoding": "application/vnd.ipld.car" - } + }, + "errors": [ + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } diff --git a/lexicons/com/atproto/sync/listBlobs.json b/lexicons/com/atproto/sync/listBlobs.json index b4c954d999a..dc22b73df56 100644 --- a/lexicons/com/atproto/sync/listBlobs.json +++ b/lexicons/com/atproto/sync/listBlobs.json @@ -40,7 +40,13 @@ } } } - } + }, + "errors": [ + { "name": "AccountNotFound" }, + { "name": "AccountTakendown" }, + { "name": "AccountSuspended" }, + { "name": "AccountDeactivated" } + ] } } } From 618c61e307abb4bc9efa37ff96c8aa208c18aa67 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 4 Mar 2024 16:24:42 -0600 Subject: [PATCH 04/11] tweak type of token union --- lexicons/com/atproto/sync/getAccountStatus.json | 4 ++-- lexicons/com/atproto/sync/subscribeRepos.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lexicons/com/atproto/sync/getAccountStatus.json b/lexicons/com/atproto/sync/getAccountStatus.json index 499e3154637..6d73df0900e 100644 --- a/lexicons/com/atproto/sync/getAccountStatus.json +++ b/lexicons/com/atproto/sync/getAccountStatus.json @@ -25,9 +25,9 @@ "did": { "type": "string", "format": "did" }, "active": { "type": "boolean" }, "status": { - "type": "union", + "type": "string", "description": "If active=false, this optional field indicates a reason for why the account is not active.", - "refs": [ + "knownValues": [ "com.atproto.sync.defs#takendown", "com.atproto.sync.defs#suspended", "com.atproto.sync.defs#deactivated" diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index a2f674a70a4..6a92c89bbf5 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -135,9 +135,9 @@ "description": "Indicates that the account has a repository which can be fetched from the host that emitted this event." }, "status": { - "type": "union", + "type": "string", "description": "If active=false, this optional field indicates a reason for why the account is not active.", - "refs": [ + "knownValues": [ "com.atproto.sync.defs#takendown", "com.atproto.sync.defs#suspended", "com.atproto.sync.defs#deleted", From efbf94abe5e5b2a396b071d50b6b0852f8c6fbb7 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 4 Mar 2024 16:27:25 -0600 Subject: [PATCH 05/11] fix getAccountStatus parameter name --- lexicons/com/atproto/sync/getAccountStatus.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/com/atproto/sync/getAccountStatus.json b/lexicons/com/atproto/sync/getAccountStatus.json index 6d73df0900e..e5de7722dd4 100644 --- a/lexicons/com/atproto/sync/getAccountStatus.json +++ b/lexicons/com/atproto/sync/getAccountStatus.json @@ -7,7 +7,7 @@ "description": "Get the repository hosting status for an account, on this server. Expected to be implemented by PDS and Relay.", "parameters": { "type": "params", - "required": ["identifier"], + "required": ["did"], "properties": { "did": { "type": "string", From a0a111bd4badce1dfd2f0a40c86adeeaaf3ce35d Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 4 Mar 2024 16:51:11 -0600 Subject: [PATCH 06/11] Account -> Repo --- lexicons/com/atproto/sync/defs.json | 8 ++++---- lexicons/com/atproto/sync/getBlob.json | 8 ++++---- lexicons/com/atproto/sync/getBlocks.json | 8 ++++---- lexicons/com/atproto/sync/getLatestCommit.json | 8 ++++---- lexicons/com/atproto/sync/getRecord.json | 8 ++++---- lexicons/com/atproto/sync/getRepo.json | 8 ++++---- .../sync/{getAccountStatus.json => getRepoStatus.json} | 10 +++++----- lexicons/com/atproto/sync/listBlobs.json | 8 ++++---- 8 files changed, 33 insertions(+), 33 deletions(-) rename lexicons/com/atproto/sync/{getAccountStatus.json => getRepoStatus.json} (77%) diff --git a/lexicons/com/atproto/sync/defs.json b/lexicons/com/atproto/sync/defs.json index 1f3bb567f8b..0cb40923ec7 100644 --- a/lexicons/com/atproto/sync/defs.json +++ b/lexicons/com/atproto/sync/defs.json @@ -4,19 +4,19 @@ "defs": { "takendown": { "type": "token", - "description": "Account hosting status indicating that an administrator has taken down the account, for a permanent period (though this may be reversed)." + "description": "Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed)." }, "suspended": { "type": "token", - "description": "Account hosting status indicating that an administrator has taken down the account, for a limited (but possibly indefinite) time period." + "description": "Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period." }, "deleted": { "type": "token", - "description": "Account hosting status indicating that the repository has been removed. The account may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened." + "description": "Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened." }, "deactivated": { "type": "token", - "description": "Account hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite." + "description": "Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite." } } } diff --git a/lexicons/com/atproto/sync/getBlob.json b/lexicons/com/atproto/sync/getBlob.json index 6e652c648b9..501cba1eccb 100644 --- a/lexicons/com/atproto/sync/getBlob.json +++ b/lexicons/com/atproto/sync/getBlob.json @@ -26,10 +26,10 @@ }, "errors": [ { "name": "BlobNotFound" }, - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } diff --git a/lexicons/com/atproto/sync/getBlocks.json b/lexicons/com/atproto/sync/getBlocks.json index f1f4a1b057f..aa507d74342 100644 --- a/lexicons/com/atproto/sync/getBlocks.json +++ b/lexicons/com/atproto/sync/getBlocks.json @@ -25,10 +25,10 @@ }, "errors": [ { "name": "BlockNotFound" }, - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } diff --git a/lexicons/com/atproto/sync/getLatestCommit.json b/lexicons/com/atproto/sync/getLatestCommit.json index 34c0c023182..759e4ba37dc 100644 --- a/lexicons/com/atproto/sync/getLatestCommit.json +++ b/lexicons/com/atproto/sync/getLatestCommit.json @@ -28,10 +28,10 @@ } }, "errors": [ - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } diff --git a/lexicons/com/atproto/sync/getRecord.json b/lexicons/com/atproto/sync/getRecord.json index 92454e69b64..decf181af80 100644 --- a/lexicons/com/atproto/sync/getRecord.json +++ b/lexicons/com/atproto/sync/getRecord.json @@ -28,10 +28,10 @@ }, "errors": [ { "name": "RecordNotFound" }, - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } diff --git a/lexicons/com/atproto/sync/getRepo.json b/lexicons/com/atproto/sync/getRepo.json index 30ba74acf27..321aec450e7 100644 --- a/lexicons/com/atproto/sync/getRepo.json +++ b/lexicons/com/atproto/sync/getRepo.json @@ -24,10 +24,10 @@ "encoding": "application/vnd.ipld.car" }, "errors": [ - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } diff --git a/lexicons/com/atproto/sync/getAccountStatus.json b/lexicons/com/atproto/sync/getRepoStatus.json similarity index 77% rename from lexicons/com/atproto/sync/getAccountStatus.json rename to lexicons/com/atproto/sync/getRepoStatus.json index e5de7722dd4..101f046928b 100644 --- a/lexicons/com/atproto/sync/getAccountStatus.json +++ b/lexicons/com/atproto/sync/getRepoStatus.json @@ -1,18 +1,18 @@ { "lexicon": 1, - "id": "com.atproto.sync.getAccountStatus", + "id": "com.atproto.sync.getRepoStatus", "defs": { "main": { "type": "query", - "description": "Get the repository hosting status for an account, on this server. Expected to be implemented by PDS and Relay.", + "description": "Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.", "parameters": { "type": "params", "required": ["did"], "properties": { "did": { "type": "string", - "format": "at-identifier", - "description": "The handle or DID of the account." + "format": "did", + "description": "The handle or DID of the repo." } } }, @@ -40,7 +40,7 @@ } } }, - "errors": [{ "name": "AccountNotFound" }] + "errors": [{ "name": "RepoNotFound" }] } } } diff --git a/lexicons/com/atproto/sync/listBlobs.json b/lexicons/com/atproto/sync/listBlobs.json index dc22b73df56..d50904dbf54 100644 --- a/lexicons/com/atproto/sync/listBlobs.json +++ b/lexicons/com/atproto/sync/listBlobs.json @@ -42,10 +42,10 @@ } }, "errors": [ - { "name": "AccountNotFound" }, - { "name": "AccountTakendown" }, - { "name": "AccountSuspended" }, - { "name": "AccountDeactivated" } + { "name": "RepoNotFound" }, + { "name": "RepoTakendown" }, + { "name": "RepoSuspended" }, + { "name": "RepoDeactivated" } ] } } From bd2ac10ec6f18f7c5fbb84c86e44d0b46fc2935a Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 4 Mar 2024 18:51:58 -0600 Subject: [PATCH 07/11] codegen --- packages/api/src/client/index.ts | 21 ++ packages/api/src/client/lexicons.ts | 210 ++++++++++++++++++ .../src/client/types/com/atproto/sync/defs.ts | 16 ++ .../client/types/com/atproto/sync/getBlob.ts | 35 +++ .../types/com/atproto/sync/getBlocks.ts | 35 +++ .../types/com/atproto/sync/getLatestCommit.ts | 21 ++ .../types/com/atproto/sync/getRecord.ts | 35 +++ .../client/types/com/atproto/sync/getRepo.ts | 28 +++ .../types/com/atproto/sync/getRepoStatus.ts | 52 +++++ .../types/com/atproto/sync/listBlobs.ts | 28 +++ .../types/com/atproto/sync/subscribeRepos.ts | 29 +++ packages/bsky/src/lexicon/index.ts | 18 ++ packages/bsky/src/lexicon/lexicons.ts | 210 ++++++++++++++++++ .../lexicon/types/com/atproto/sync/defs.ts | 16 ++ .../lexicon/types/com/atproto/sync/getBlob.ts | 6 + .../types/com/atproto/sync/getBlocks.ts | 6 + .../types/com/atproto/sync/getLatestCommit.ts | 2 +- .../types/com/atproto/sync/getRecord.ts | 6 + .../lexicon/types/com/atproto/sync/getRepo.ts | 1 + .../types/com/atproto/sync/getRepoStatus.ts | 56 +++++ .../types/com/atproto/sync/listBlobs.ts | 1 + .../types/com/atproto/sync/subscribeRepos.ts | 30 +++ packages/ozone/src/lexicon/index.ts | 18 ++ packages/ozone/src/lexicon/lexicons.ts | 210 ++++++++++++++++++ .../lexicon/types/com/atproto/sync/defs.ts | 16 ++ .../lexicon/types/com/atproto/sync/getBlob.ts | 6 + .../types/com/atproto/sync/getBlocks.ts | 6 + .../types/com/atproto/sync/getLatestCommit.ts | 2 +- .../types/com/atproto/sync/getRecord.ts | 6 + .../lexicon/types/com/atproto/sync/getRepo.ts | 1 + .../types/com/atproto/sync/getRepoStatus.ts | 56 +++++ .../types/com/atproto/sync/listBlobs.ts | 1 + .../types/com/atproto/sync/subscribeRepos.ts | 30 +++ packages/pds/src/lexicon/index.ts | 18 ++ packages/pds/src/lexicon/lexicons.ts | 210 ++++++++++++++++++ .../lexicon/types/com/atproto/sync/defs.ts | 16 ++ .../lexicon/types/com/atproto/sync/getBlob.ts | 6 + .../types/com/atproto/sync/getBlocks.ts | 6 + .../types/com/atproto/sync/getLatestCommit.ts | 2 +- .../types/com/atproto/sync/getRecord.ts | 6 + .../lexicon/types/com/atproto/sync/getRepo.ts | 1 + .../types/com/atproto/sync/getRepoStatus.ts | 56 +++++ .../types/com/atproto/sync/listBlobs.ts | 1 + .../types/com/atproto/sync/subscribeRepos.ts | 30 +++ 44 files changed, 1563 insertions(+), 3 deletions(-) create mode 100644 packages/api/src/client/types/com/atproto/sync/defs.ts create mode 100644 packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts create mode 100644 packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts create mode 100644 packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/sync/defs.ts create mode 100644 packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index 846c379b7a8..b96d0087dd5 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -80,6 +80,7 @@ import * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/r import * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword' import * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword' import * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail' +import * as ComAtprotoSyncDefs from './types/com/atproto/sync/defs' import * as ComAtprotoSyncGetBlob from './types/com/atproto/sync/getBlob' import * as ComAtprotoSyncGetBlocks from './types/com/atproto/sync/getBlocks' import * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout' @@ -87,6 +88,7 @@ import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead' import * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit' import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord' import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo' +import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate' @@ -234,6 +236,7 @@ export * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/r export * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword' export * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword' export * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail' +export * as ComAtprotoSyncDefs from './types/com/atproto/sync/defs' export * as ComAtprotoSyncGetBlob from './types/com/atproto/sync/getBlob' export * as ComAtprotoSyncGetBlocks from './types/com/atproto/sync/getBlocks' export * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout' @@ -241,6 +244,7 @@ export * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead' export * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit' export * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord' export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo' +export * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus' export * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs' export * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos' export * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate' @@ -329,6 +333,12 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } +export const COM_ATPROTO_SYNC = { + DefsTakendown: 'com.atproto.sync.defs#takendown', + DefsSuspended: 'com.atproto.sync.defs#suspended', + DefsDeleted: 'com.atproto.sync.defs#deleted', + DefsDeactivated: 'com.atproto.sync.defs#deactivated', +} export const APP_BSKY_GRAPH = { DefsModlist: 'app.bsky.graph.defs#modlist', DefsCuratelist: 'app.bsky.graph.defs#curatelist', @@ -1302,6 +1312,17 @@ export class ComAtprotoSyncNS { }) } + getRepoStatus( + params?: ComAtprotoSyncGetRepoStatus.QueryParams, + opts?: ComAtprotoSyncGetRepoStatus.CallOptions, + ): Promise { + return this._service.xrpc + .call('com.atproto.sync.getRepoStatus', params, undefined, opts) + .catch((e) => { + throw ComAtprotoSyncGetRepoStatus.toKnownErr(e) + }) + } + listBlobs( params?: ComAtprotoSyncListBlobs.QueryParams, opts?: ComAtprotoSyncListBlobs.CallOptions, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 14e4c1cb81e..92cfc8cdb85 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -4181,6 +4181,32 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncDefs: { + lexicon: 1, + id: 'com.atproto.sync.defs', + defs: { + takendown: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', + }, + suspended: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', + }, + deleted: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', + }, + deactivated: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', + }, + }, + }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -4208,6 +4234,23 @@ export const schemaDict = { output: { encoding: '*/*', }, + errors: [ + { + name: 'BlobNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4240,6 +4283,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'BlockNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4346,6 +4406,15 @@ export const schemaDict = { { name: 'RepoNotFound', }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, ], }, }, @@ -4385,6 +4454,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RecordNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4415,6 +4501,78 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], + }, + }, + }, + ComAtprotoSyncGetRepoStatus: { + lexicon: 1, + id: 'com.atproto.sync.getRepoStatus', + defs: { + main: { + type: 'query', + description: + 'Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.', + parameters: { + type: 'params', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + description: 'The handle or DID of the repo.', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['did', 'active'], + properties: { + did: { + type: 'string', + format: 'did', + }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deactivated', + ], + }, + rev: { + type: 'string', + description: + 'Optional field, the current rev of the repo, if active=true', + }, + }, + }, + }, + errors: [ + { + name: 'RepoNotFound', + }, + ], }, }, }, @@ -4469,6 +4627,20 @@ export const schemaDict = { }, }, }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4607,6 +4779,7 @@ export const schemaDict = { refs: [ 'lex:com.atproto.sync.subscribeRepos#commit', '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', @@ -4732,6 +4905,41 @@ export const schemaDict = { }, }, }, + account: { + type: 'object', + description: + "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", + required: ['seq', 'did', 'time', 'active'], + properties: { + seq: { + type: 'integer', + }, + did: { + type: 'string', + format: 'did', + }, + time: { + type: 'string', + format: 'datetime', + }, + active: { + type: 'boolean', + description: + 'Indicates that the account has a repository which can be fetched from the host that emitted this event.', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deleted', + 'com.atproto.sync.defs#deactivated', + ], + }, + }, + }, handle: { type: 'object', description: @@ -8949,6 +9157,7 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', + ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', @@ -8956,6 +9165,7 @@ export const ids = { ComAtprotoSyncGetLatestCommit: 'com.atproto.sync.getLatestCommit', ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord', ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo', + ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', diff --git a/packages/api/src/client/types/com/atproto/sync/defs.ts b/packages/api/src/client/types/com/atproto/sync/defs.ts new file mode 100644 index 00000000000..0c8c796d271 --- /dev/null +++ b/packages/api/src/client/types/com/atproto/sync/defs.ts @@ -0,0 +1,16 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ +export const TAKENDOWN = 'com.atproto.sync.defs#takendown' +/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ +export const SUSPENDED = 'com.atproto.sync.defs#suspended' +/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ +export const DELETED = 'com.atproto.sync.defs#deleted' +/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ +export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/api/src/client/types/com/atproto/sync/getBlob.ts b/packages/api/src/client/types/com/atproto/sync/getBlob.ts index 83d8b79ca08..4ea99759d57 100644 --- a/packages/api/src/client/types/com/atproto/sync/getBlob.ts +++ b/packages/api/src/client/types/com/atproto/sync/getBlob.ts @@ -26,8 +26,43 @@ export interface Response { data: Uint8Array } +export class BlobNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { + if (e.error === 'BlobNotFound') return new BlobNotFoundError(e) + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/getBlocks.ts b/packages/api/src/client/types/com/atproto/sync/getBlocks.ts index 024d58b7c3b..3253a46a43a 100644 --- a/packages/api/src/client/types/com/atproto/sync/getBlocks.ts +++ b/packages/api/src/client/types/com/atproto/sync/getBlocks.ts @@ -25,8 +25,43 @@ export interface Response { data: Uint8Array } +export class BlockNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { + if (e.error === 'BlockNotFound') return new BlockNotFoundError(e) + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/getLatestCommit.ts b/packages/api/src/client/types/com/atproto/sync/getLatestCommit.ts index 8d98adeec39..8fb354e392e 100644 --- a/packages/api/src/client/types/com/atproto/sync/getLatestCommit.ts +++ b/packages/api/src/client/types/com/atproto/sync/getLatestCommit.ts @@ -36,9 +36,30 @@ export class RepoNotFoundError extends XRPCError { } } +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/getRecord.ts b/packages/api/src/client/types/com/atproto/sync/getRecord.ts index 1fc9a94b406..8ac4899d879 100644 --- a/packages/api/src/client/types/com/atproto/sync/getRecord.ts +++ b/packages/api/src/client/types/com/atproto/sync/getRecord.ts @@ -29,8 +29,43 @@ export interface Response { data: Uint8Array } +export class RecordNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { + if (e.error === 'RecordNotFound') return new RecordNotFoundError(e) + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/getRepo.ts b/packages/api/src/client/types/com/atproto/sync/getRepo.ts index 53e0883d74e..cd9296fa9d6 100644 --- a/packages/api/src/client/types/com/atproto/sync/getRepo.ts +++ b/packages/api/src/client/types/com/atproto/sync/getRepo.ts @@ -26,8 +26,36 @@ export interface Response { data: Uint8Array } +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts b/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts new file mode 100644 index 00000000000..2589af29e7f --- /dev/null +++ b/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts @@ -0,0 +1,52 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { Headers, XRPCError } from '@atproto/xrpc' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { isObj, hasProp } from '../../../../util' +import { lexicons } from '../../../../lexicons' +import { CID } from 'multiformats/cid' + +export interface QueryParams { + /** The handle or DID of the repo. */ + did: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + did: string + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + /** Optional field, the current rev of the repo, if active=true */ + rev?: string + [k: string]: unknown +} + +export interface CallOptions { + headers?: Headers +} + +export interface Response { + success: boolean + headers: Headers + data: OutputSchema +} + +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export function toKnownErr(e: any) { + if (e instanceof XRPCError) { + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + } + return e +} diff --git a/packages/api/src/client/types/com/atproto/sync/listBlobs.ts b/packages/api/src/client/types/com/atproto/sync/listBlobs.ts index d775ce35a6a..83e1f4406d6 100644 --- a/packages/api/src/client/types/com/atproto/sync/listBlobs.ts +++ b/packages/api/src/client/types/com/atproto/sync/listBlobs.ts @@ -34,8 +34,36 @@ export interface Response { data: OutputSchema } +export class RepoNotFoundError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoTakendownError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoSuspendedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + +export class RepoDeactivatedError extends XRPCError { + constructor(src: XRPCError) { + super(src.status, src.error, src.message, src.headers) + } +} + export function toKnownErr(e: any) { if (e instanceof XRPCError) { + if (e.error === 'RepoNotFound') return new RepoNotFoundError(e) + if (e.error === 'RepoTakendown') return new RepoTakendownError(e) + if (e.error === 'RepoSuspended') return new RepoSuspendedError(e) + if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e) } return e } diff --git a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts index f4a362f755f..686eac26946 100644 --- a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts @@ -66,6 +66,35 @@ export function validateIdentity(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#identity', v) } +/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ +export interface Account { + seq: number + did: string + time: string + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deleted' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + [k: string]: unknown +} + +export function isAccount(v: unknown): v is Account { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.sync.subscribeRepos#account' + ) +} + +export function validateAccount(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) +} + /** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ export interface Handle { seq: number diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index cf2c613e686..7f43e184bfb 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -84,6 +84,7 @@ import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead' import * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit' import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord' import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo' +import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate' @@ -152,6 +153,12 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } +export const COM_ATPROTO_SYNC = { + DefsTakendown: 'com.atproto.sync.defs#takendown', + DefsSuspended: 'com.atproto.sync.defs#suspended', + DefsDeleted: 'com.atproto.sync.defs#deleted', + DefsDeactivated: 'com.atproto.sync.defs#deactivated', +} export const APP_BSKY_GRAPH = { DefsModlist: 'app.bsky.graph.defs#modlist', DefsCuratelist: 'app.bsky.graph.defs#curatelist', @@ -1091,6 +1098,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + getRepoStatus( + cfg: ConfigOf< + AV, + ComAtprotoSyncGetRepoStatus.Handler>, + ComAtprotoSyncGetRepoStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.getRepoStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listBlobs( cfg: ConfigOf< AV, diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 14e4c1cb81e..92cfc8cdb85 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -4181,6 +4181,32 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncDefs: { + lexicon: 1, + id: 'com.atproto.sync.defs', + defs: { + takendown: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', + }, + suspended: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', + }, + deleted: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', + }, + deactivated: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', + }, + }, + }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -4208,6 +4234,23 @@ export const schemaDict = { output: { encoding: '*/*', }, + errors: [ + { + name: 'BlobNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4240,6 +4283,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'BlockNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4346,6 +4406,15 @@ export const schemaDict = { { name: 'RepoNotFound', }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, ], }, }, @@ -4385,6 +4454,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RecordNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4415,6 +4501,78 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], + }, + }, + }, + ComAtprotoSyncGetRepoStatus: { + lexicon: 1, + id: 'com.atproto.sync.getRepoStatus', + defs: { + main: { + type: 'query', + description: + 'Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.', + parameters: { + type: 'params', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + description: 'The handle or DID of the repo.', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['did', 'active'], + properties: { + did: { + type: 'string', + format: 'did', + }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deactivated', + ], + }, + rev: { + type: 'string', + description: + 'Optional field, the current rev of the repo, if active=true', + }, + }, + }, + }, + errors: [ + { + name: 'RepoNotFound', + }, + ], }, }, }, @@ -4469,6 +4627,20 @@ export const schemaDict = { }, }, }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4607,6 +4779,7 @@ export const schemaDict = { refs: [ 'lex:com.atproto.sync.subscribeRepos#commit', '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', @@ -4732,6 +4905,41 @@ export const schemaDict = { }, }, }, + account: { + type: 'object', + description: + "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", + required: ['seq', 'did', 'time', 'active'], + properties: { + seq: { + type: 'integer', + }, + did: { + type: 'string', + format: 'did', + }, + time: { + type: 'string', + format: 'datetime', + }, + active: { + type: 'boolean', + description: + 'Indicates that the account has a repository which can be fetched from the host that emitted this event.', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deleted', + 'com.atproto.sync.defs#deactivated', + ], + }, + }, + }, handle: { type: 'object', description: @@ -8949,6 +9157,7 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', + ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', @@ -8956,6 +9165,7 @@ export const ids = { ComAtprotoSyncGetLatestCommit: 'com.atproto.sync.getLatestCommit', ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord', ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo', + ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts new file mode 100644 index 00000000000..ad8e6012482 --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts @@ -0,0 +1,16 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' + +/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ +export const TAKENDOWN = 'com.atproto.sync.defs#takendown' +/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ +export const SUSPENDED = 'com.atproto.sync.defs#suspended' +/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ +export const DELETED = 'com.atproto.sync.defs#deleted' +/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ +export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getBlob.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getBlob.ts index 93e50403f20..b1581d6e473 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getBlob.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getBlob.ts @@ -28,6 +28,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlobNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getBlocks.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getBlocks.ts index f1b8ebe5db1..925b4a7d50b 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getBlocks.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getBlocks.ts @@ -27,6 +27,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlockNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getLatestCommit.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getLatestCommit.ts index bbae68bbe76..f0e9a757d04 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getLatestCommit.ts @@ -32,7 +32,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string - error?: 'RepoNotFound' + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getRecord.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getRecord.ts index c78ff8c2089..315800f5df1 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getRecord.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getRecord.ts @@ -31,6 +31,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'RecordNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getRepo.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepo.ts index 0d426557c5f..883ff37def1 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getRepo.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepo.ts @@ -28,6 +28,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts new file mode 100644 index 00000000000..77fecbc057b --- /dev/null +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -0,0 +1,56 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The handle or DID of the repo. */ + did: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + did: string + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + /** Optional field, the current rev of the repo, if active=true */ + rev?: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'RepoNotFound' +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/listBlobs.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/listBlobs.ts index 67a66577809..c6ea955ee0c 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/listBlobs.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/listBlobs.ts @@ -36,6 +36,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 19874b06083..c095af29e1a 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -16,6 +16,7 @@ export interface QueryParams { export type OutputSchema = | Commit | Identity + | Account | Handle | Migrate | Tombstone @@ -92,6 +93,35 @@ export function validateIdentity(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#identity', v) } +/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ +export interface Account { + seq: number + did: string + time: string + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deleted' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + [k: string]: unknown +} + +export function isAccount(v: unknown): v is Account { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.sync.subscribeRepos#account' + ) +} + +export function validateAccount(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) +} + /** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ export interface Handle { seq: number diff --git a/packages/ozone/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts index cf2c613e686..7f43e184bfb 100644 --- a/packages/ozone/src/lexicon/index.ts +++ b/packages/ozone/src/lexicon/index.ts @@ -84,6 +84,7 @@ import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead' import * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit' import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord' import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo' +import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate' @@ -152,6 +153,12 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } +export const COM_ATPROTO_SYNC = { + DefsTakendown: 'com.atproto.sync.defs#takendown', + DefsSuspended: 'com.atproto.sync.defs#suspended', + DefsDeleted: 'com.atproto.sync.defs#deleted', + DefsDeactivated: 'com.atproto.sync.defs#deactivated', +} export const APP_BSKY_GRAPH = { DefsModlist: 'app.bsky.graph.defs#modlist', DefsCuratelist: 'app.bsky.graph.defs#curatelist', @@ -1091,6 +1098,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + getRepoStatus( + cfg: ConfigOf< + AV, + ComAtprotoSyncGetRepoStatus.Handler>, + ComAtprotoSyncGetRepoStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.getRepoStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listBlobs( cfg: ConfigOf< AV, diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index 14e4c1cb81e..92cfc8cdb85 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -4181,6 +4181,32 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncDefs: { + lexicon: 1, + id: 'com.atproto.sync.defs', + defs: { + takendown: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', + }, + suspended: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', + }, + deleted: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', + }, + deactivated: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', + }, + }, + }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -4208,6 +4234,23 @@ export const schemaDict = { output: { encoding: '*/*', }, + errors: [ + { + name: 'BlobNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4240,6 +4283,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'BlockNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4346,6 +4406,15 @@ export const schemaDict = { { name: 'RepoNotFound', }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, ], }, }, @@ -4385,6 +4454,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RecordNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4415,6 +4501,78 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], + }, + }, + }, + ComAtprotoSyncGetRepoStatus: { + lexicon: 1, + id: 'com.atproto.sync.getRepoStatus', + defs: { + main: { + type: 'query', + description: + 'Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.', + parameters: { + type: 'params', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + description: 'The handle or DID of the repo.', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['did', 'active'], + properties: { + did: { + type: 'string', + format: 'did', + }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deactivated', + ], + }, + rev: { + type: 'string', + description: + 'Optional field, the current rev of the repo, if active=true', + }, + }, + }, + }, + errors: [ + { + name: 'RepoNotFound', + }, + ], }, }, }, @@ -4469,6 +4627,20 @@ export const schemaDict = { }, }, }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4607,6 +4779,7 @@ export const schemaDict = { refs: [ 'lex:com.atproto.sync.subscribeRepos#commit', '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', @@ -4732,6 +4905,41 @@ export const schemaDict = { }, }, }, + account: { + type: 'object', + description: + "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", + required: ['seq', 'did', 'time', 'active'], + properties: { + seq: { + type: 'integer', + }, + did: { + type: 'string', + format: 'did', + }, + time: { + type: 'string', + format: 'datetime', + }, + active: { + type: 'boolean', + description: + 'Indicates that the account has a repository which can be fetched from the host that emitted this event.', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deleted', + 'com.atproto.sync.defs#deactivated', + ], + }, + }, + }, handle: { type: 'object', description: @@ -8949,6 +9157,7 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', + ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', @@ -8956,6 +9165,7 @@ export const ids = { ComAtprotoSyncGetLatestCommit: 'com.atproto.sync.getLatestCommit', ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord', ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo', + ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts new file mode 100644 index 00000000000..ad8e6012482 --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts @@ -0,0 +1,16 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' + +/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ +export const TAKENDOWN = 'com.atproto.sync.defs#takendown' +/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ +export const SUSPENDED = 'com.atproto.sync.defs#suspended' +/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ +export const DELETED = 'com.atproto.sync.defs#deleted' +/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ +export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts index 93e50403f20..b1581d6e473 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts @@ -28,6 +28,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlobNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts index f1b8ebe5db1..925b4a7d50b 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts @@ -27,6 +27,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlockNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts index bbae68bbe76..f0e9a757d04 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts @@ -32,7 +32,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string - error?: 'RepoNotFound' + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts index c78ff8c2089..315800f5df1 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts @@ -31,6 +31,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'RecordNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts index 0d426557c5f..883ff37def1 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts @@ -28,6 +28,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts new file mode 100644 index 00000000000..77fecbc057b --- /dev/null +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -0,0 +1,56 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The handle or DID of the repo. */ + did: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + did: string + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + /** Optional field, the current rev of the repo, if active=true */ + rev?: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'RepoNotFound' +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts index 67a66577809..c6ea955ee0c 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts @@ -36,6 +36,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 19874b06083..c095af29e1a 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -16,6 +16,7 @@ export interface QueryParams { export type OutputSchema = | Commit | Identity + | Account | Handle | Migrate | Tombstone @@ -92,6 +93,35 @@ export function validateIdentity(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#identity', v) } +/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ +export interface Account { + seq: number + did: string + time: string + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deleted' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + [k: string]: unknown +} + +export function isAccount(v: unknown): v is Account { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.sync.subscribeRepos#account' + ) +} + +export function validateAccount(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) +} + /** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ export interface Handle { seq: number diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index cf2c613e686..7f43e184bfb 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -84,6 +84,7 @@ import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead' import * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit' import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord' import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo' +import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus' import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs' import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos' import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate' @@ -152,6 +153,12 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } +export const COM_ATPROTO_SYNC = { + DefsTakendown: 'com.atproto.sync.defs#takendown', + DefsSuspended: 'com.atproto.sync.defs#suspended', + DefsDeleted: 'com.atproto.sync.defs#deleted', + DefsDeactivated: 'com.atproto.sync.defs#deactivated', +} export const APP_BSKY_GRAPH = { DefsModlist: 'app.bsky.graph.defs#modlist', DefsCuratelist: 'app.bsky.graph.defs#curatelist', @@ -1091,6 +1098,17 @@ export class ComAtprotoSyncNS { return this._server.xrpc.method(nsid, cfg) } + getRepoStatus( + cfg: ConfigOf< + AV, + ComAtprotoSyncGetRepoStatus.Handler>, + ComAtprotoSyncGetRepoStatus.HandlerReqCtx> + >, + ) { + const nsid = 'com.atproto.sync.getRepoStatus' // @ts-ignore + return this._server.xrpc.method(nsid, cfg) + } + listBlobs( cfg: ConfigOf< AV, diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 14e4c1cb81e..92cfc8cdb85 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -4181,6 +4181,32 @@ export const schemaDict = { }, }, }, + ComAtprotoSyncDefs: { + lexicon: 1, + id: 'com.atproto.sync.defs', + defs: { + takendown: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', + }, + suspended: { + type: 'token', + description: + 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', + }, + deleted: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', + }, + deactivated: { + type: 'token', + description: + 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', + }, + }, + }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -4208,6 +4234,23 @@ export const schemaDict = { output: { encoding: '*/*', }, + errors: [ + { + name: 'BlobNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4240,6 +4283,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'BlockNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4346,6 +4406,15 @@ export const schemaDict = { { name: 'RepoNotFound', }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, ], }, }, @@ -4385,6 +4454,23 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RecordNotFound', + }, + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4415,6 +4501,78 @@ export const schemaDict = { output: { encoding: 'application/vnd.ipld.car', }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], + }, + }, + }, + ComAtprotoSyncGetRepoStatus: { + lexicon: 1, + id: 'com.atproto.sync.getRepoStatus', + defs: { + main: { + type: 'query', + description: + 'Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.', + parameters: { + type: 'params', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + description: 'The handle or DID of the repo.', + }, + }, + }, + output: { + encoding: 'application/json', + schema: { + type: 'object', + required: ['did', 'active'], + properties: { + did: { + type: 'string', + format: 'did', + }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deactivated', + ], + }, + rev: { + type: 'string', + description: + 'Optional field, the current rev of the repo, if active=true', + }, + }, + }, + }, + errors: [ + { + name: 'RepoNotFound', + }, + ], }, }, }, @@ -4469,6 +4627,20 @@ export const schemaDict = { }, }, }, + errors: [ + { + name: 'RepoNotFound', + }, + { + name: 'RepoTakendown', + }, + { + name: 'RepoSuspended', + }, + { + name: 'RepoDeactivated', + }, + ], }, }, }, @@ -4607,6 +4779,7 @@ export const schemaDict = { refs: [ 'lex:com.atproto.sync.subscribeRepos#commit', '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', @@ -4732,6 +4905,41 @@ export const schemaDict = { }, }, }, + account: { + type: 'object', + description: + "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", + required: ['seq', 'did', 'time', 'active'], + properties: { + seq: { + type: 'integer', + }, + did: { + type: 'string', + format: 'did', + }, + time: { + type: 'string', + format: 'datetime', + }, + active: { + type: 'boolean', + description: + 'Indicates that the account has a repository which can be fetched from the host that emitted this event.', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a reason for why the account is not active.', + knownValues: [ + 'com.atproto.sync.defs#takendown', + 'com.atproto.sync.defs#suspended', + 'com.atproto.sync.defs#deleted', + 'com.atproto.sync.defs#deactivated', + ], + }, + }, + }, handle: { type: 'object', description: @@ -8949,6 +9157,7 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', + ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', @@ -8956,6 +9165,7 @@ export const ids = { ComAtprotoSyncGetLatestCommit: 'com.atproto.sync.getLatestCommit', ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord', ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo', + ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus', ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs', ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos', ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate', diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts b/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts new file mode 100644 index 00000000000..ad8e6012482 --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts @@ -0,0 +1,16 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' + +/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ +export const TAKENDOWN = 'com.atproto.sync.defs#takendown' +/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ +export const SUSPENDED = 'com.atproto.sync.defs#suspended' +/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ +export const DELETED = 'com.atproto.sync.defs#deleted' +/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ +export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getBlob.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getBlob.ts index 93e50403f20..b1581d6e473 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getBlob.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getBlob.ts @@ -28,6 +28,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlobNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getBlocks.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getBlocks.ts index f1b8ebe5db1..925b4a7d50b 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getBlocks.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getBlocks.ts @@ -27,6 +27,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'BlockNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getLatestCommit.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getLatestCommit.ts index bbae68bbe76..f0e9a757d04 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getLatestCommit.ts @@ -32,7 +32,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string - error?: 'RepoNotFound' + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getRecord.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getRecord.ts index c78ff8c2089..315800f5df1 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getRecord.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getRecord.ts @@ -31,6 +31,12 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: + | 'RecordNotFound' + | 'RepoNotFound' + | 'RepoTakendown' + | 'RepoSuspended' + | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getRepo.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getRepo.ts index 0d426557c5f..883ff37def1 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getRepo.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getRepo.ts @@ -28,6 +28,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts new file mode 100644 index 00000000000..77fecbc057b --- /dev/null +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -0,0 +1,56 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import express from 'express' +import { ValidationResult, BlobRef } from '@atproto/lexicon' +import { lexicons } from '../../../../lexicons' +import { isObj, hasProp } from '../../../../util' +import { CID } from 'multiformats/cid' +import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' + +export interface QueryParams { + /** The handle or DID of the repo. */ + did: string +} + +export type InputSchema = undefined + +export interface OutputSchema { + did: string + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + /** Optional field, the current rev of the repo, if active=true */ + rev?: string + [k: string]: unknown +} + +export type HandlerInput = undefined + +export interface HandlerSuccess { + encoding: 'application/json' + body: OutputSchema + headers?: { [key: string]: string } +} + +export interface HandlerError { + status: number + message?: string + error?: 'RepoNotFound' +} + +export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough +export type HandlerReqCtx = { + auth: HA + params: QueryParams + input: HandlerInput + req: express.Request + res: express.Response +} +export type Handler = ( + ctx: HandlerReqCtx, +) => Promise | HandlerOutput diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/listBlobs.ts b/packages/pds/src/lexicon/types/com/atproto/sync/listBlobs.ts index 67a66577809..c6ea955ee0c 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/listBlobs.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/listBlobs.ts @@ -36,6 +36,7 @@ export interface HandlerSuccess { export interface HandlerError { status: number message?: string + error?: 'RepoNotFound' | 'RepoTakendown' | 'RepoSuspended' | 'RepoDeactivated' } export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 19874b06083..c095af29e1a 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -16,6 +16,7 @@ export interface QueryParams { export type OutputSchema = | Commit | Identity + | Account | Handle | Migrate | Tombstone @@ -92,6 +93,35 @@ export function validateIdentity(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#identity', v) } +/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */ +export interface Account { + seq: number + did: string + time: string + /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ + active: boolean + /** If active=false, this optional field indicates a reason for why the account is not active. */ + status?: + | 'com.atproto.sync.defs#takendown' + | 'com.atproto.sync.defs#suspended' + | 'com.atproto.sync.defs#deleted' + | 'com.atproto.sync.defs#deactivated' + | (string & {}) + [k: string]: unknown +} + +export function isAccount(v: unknown): v is Account { + return ( + isObj(v) && + hasProp(v, '$type') && + v.$type === 'com.atproto.sync.subscribeRepos#account' + ) +} + +export function validateAccount(v: unknown): ValidationResult { + return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) +} + /** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ export interface Handle { seq: number From 673c7f643190ac07faaa431c02f61fc5d69c1335 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 20 May 2024 19:01:37 -0500 Subject: [PATCH 08/11] schema tweaks --- lexicons/com/atproto/sync/defs.json | 22 --------- lexicons/com/atproto/sync/getRepoStatus.json | 10 ++-- lexicons/com/atproto/sync/subscribeRepos.json | 10 ++-- packages/api/src/client/index.ts | 8 ---- packages/api/src/client/lexicons.ts | 47 +++---------------- .../src/client/types/com/atproto/sync/defs.ts | 16 ------- .../types/com/atproto/sync/getRepoStatus.ts | 10 ++-- .../types/com/atproto/sync/subscribeRepos.ts | 8 +--- packages/bsky/src/lexicon/index.ts | 6 --- packages/bsky/src/lexicon/lexicons.ts | 47 +++---------------- .../lexicon/types/com/atproto/sync/defs.ts | 16 ------- .../types/com/atproto/sync/getRepoStatus.ts | 10 ++-- .../types/com/atproto/sync/subscribeRepos.ts | 8 +--- packages/ozone/src/lexicon/index.ts | 6 --- packages/ozone/src/lexicon/lexicons.ts | 47 +++---------------- .../lexicon/types/com/atproto/sync/defs.ts | 16 ------- .../types/com/atproto/sync/getRepoStatus.ts | 10 ++-- .../types/com/atproto/sync/subscribeRepos.ts | 8 +--- packages/pds/src/lexicon/index.ts | 6 --- packages/pds/src/lexicon/lexicons.ts | 47 +++---------------- .../lexicon/types/com/atproto/sync/defs.ts | 16 ------- .../types/com/atproto/sync/getRepoStatus.ts | 10 ++-- .../types/com/atproto/sync/subscribeRepos.ts | 8 +--- 23 files changed, 54 insertions(+), 338 deletions(-) delete mode 100644 lexicons/com/atproto/sync/defs.json delete mode 100644 packages/api/src/client/types/com/atproto/sync/defs.ts delete mode 100644 packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts delete mode 100644 packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts delete mode 100644 packages/pds/src/lexicon/types/com/atproto/sync/defs.ts diff --git a/lexicons/com/atproto/sync/defs.json b/lexicons/com/atproto/sync/defs.json deleted file mode 100644 index 0cb40923ec7..00000000000 --- a/lexicons/com/atproto/sync/defs.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "lexicon": 1, - "id": "com.atproto.sync.defs", - "defs": { - "takendown": { - "type": "token", - "description": "Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed)." - }, - "suspended": { - "type": "token", - "description": "Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period." - }, - "deleted": { - "type": "token", - "description": "Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened." - }, - "deactivated": { - "type": "token", - "description": "Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite." - } - } -} diff --git a/lexicons/com/atproto/sync/getRepoStatus.json b/lexicons/com/atproto/sync/getRepoStatus.json index 101f046928b..42ab307277a 100644 --- a/lexicons/com/atproto/sync/getRepoStatus.json +++ b/lexicons/com/atproto/sync/getRepoStatus.json @@ -12,7 +12,7 @@ "did": { "type": "string", "format": "did", - "description": "The handle or DID of the repo." + "description": "The DID of the repo." } } }, @@ -26,12 +26,8 @@ "active": { "type": "boolean" }, "status": { "type": "string", - "description": "If active=false, this optional field indicates a reason for why the account is not active.", - "knownValues": [ - "com.atproto.sync.defs#takendown", - "com.atproto.sync.defs#suspended", - "com.atproto.sync.defs#deactivated" - ] + "description": "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.", + "knownValues": ["takendown", "suspended", "deactivated"] }, "rev": { "type": "string", diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index 6a92c89bbf5..bf11a8a2f0e 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -119,7 +119,8 @@ "properties": { "seq": { "type": "integer" }, "did": { "type": "string", "format": "did" }, - "time": { "type": "string", "format": "datetime" } + "time": { "type": "string", "format": "datetime" }, + "didDoc": { "type": "unknown" } } }, "account": { @@ -137,12 +138,7 @@ "status": { "type": "string", "description": "If active=false, this optional field indicates a reason for why the account is not active.", - "knownValues": [ - "com.atproto.sync.defs#takendown", - "com.atproto.sync.defs#suspended", - "com.atproto.sync.defs#deleted", - "com.atproto.sync.defs#deactivated" - ] + "knownValues": ["takendown", "suspended", "deleted", "deactivated"] } } }, diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index b0ccbd49495..a28f7565211 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -69,7 +69,6 @@ import * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/r import * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword' import * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword' import * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail' -import * as ComAtprotoSyncDefs from './types/com/atproto/sync/defs' import * as ComAtprotoSyncGetBlob from './types/com/atproto/sync/getBlob' import * as ComAtprotoSyncGetBlocks from './types/com/atproto/sync/getBlocks' import * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout' @@ -252,7 +251,6 @@ export * as ComAtprotoServerReserveSigningKey from './types/com/atproto/server/r export * as ComAtprotoServerResetPassword from './types/com/atproto/server/resetPassword' export * as ComAtprotoServerRevokeAppPassword from './types/com/atproto/server/revokeAppPassword' export * as ComAtprotoServerUpdateEmail from './types/com/atproto/server/updateEmail' -export * as ComAtprotoSyncDefs from './types/com/atproto/sync/defs' export * as ComAtprotoSyncGetBlob from './types/com/atproto/sync/getBlob' export * as ComAtprotoSyncGetBlocks from './types/com/atproto/sync/getBlocks' export * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout' @@ -382,12 +380,6 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } -export const COM_ATPROTO_SYNC = { - DefsTakendown: 'com.atproto.sync.defs#takendown', - DefsSuspended: 'com.atproto.sync.defs#suspended', - DefsDeleted: 'com.atproto.sync.defs#deleted', - DefsDeactivated: 'com.atproto.sync.defs#deactivated', -} export const APP_BSKY_FEED = { DefsRequestLess: 'app.bsky.feed.defs#requestLess', DefsRequestMore: 'app.bsky.feed.defs#requestMore', diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 2d384413b16..e0e22b032e7 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -2874,32 +2874,6 @@ export const schemaDict = { }, }, }, - ComAtprotoSyncDefs: { - lexicon: 1, - id: 'com.atproto.sync.defs', - defs: { - takendown: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', - }, - suspended: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', - }, - deleted: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', - }, - deactivated: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', - }, - }, - }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -3227,7 +3201,7 @@ export const schemaDict = { did: { type: 'string', format: 'did', - description: 'The handle or DID of the repo.', + description: 'The DID of the repo.', }, }, }, @@ -3247,12 +3221,8 @@ export const schemaDict = { status: { type: 'string', description: - 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deactivated', - ], + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], }, rev: { type: 'string', @@ -3597,6 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, + didDoc: { + type: 'unknown', + }, }, }, account: { @@ -3625,12 +3598,7 @@ export const schemaDict = { type: 'string', description: 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deleted', - 'com.atproto.sync.defs#deactivated', - ], + knownValues: ['takendown', 'suspended', 'deleted', 'deactivated'], }, }, }, @@ -10814,7 +10782,6 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', - ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', diff --git a/packages/api/src/client/types/com/atproto/sync/defs.ts b/packages/api/src/client/types/com/atproto/sync/defs.ts deleted file mode 100644 index 0c8c796d271..00000000000 --- a/packages/api/src/client/types/com/atproto/sync/defs.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * GENERATED CODE - DO NOT MODIFY - */ -import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' -import { CID } from 'multiformats/cid' - -/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ -export const TAKENDOWN = 'com.atproto.sync.defs#takendown' -/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ -export const SUSPENDED = 'com.atproto.sync.defs#suspended' -/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ -export const DELETED = 'com.atproto.sync.defs#deleted' -/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ -export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts b/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts index 2589af29e7f..a3c2154ec1d 100644 --- a/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts +++ b/packages/api/src/client/types/com/atproto/sync/getRepoStatus.ts @@ -8,7 +8,7 @@ import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' export interface QueryParams { - /** The handle or DID of the repo. */ + /** The DID of the repo. */ did: string } @@ -17,12 +17,8 @@ export type InputSchema = undefined export interface OutputSchema { did: string active: boolean - /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) /** Optional field, the current rev of the repo, if active=true */ rev?: string [k: string]: unknown diff --git a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts index 686eac26946..77794c0d563 100644 --- a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts @@ -51,6 +51,7 @@ export interface Identity { seq: number did: string time: string + didDoc?: {} [k: string]: unknown } @@ -74,12 +75,7 @@ export interface Account { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deleted' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + status?: 'takendown' | 'suspended' | 'deleted' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/index.ts b/packages/bsky/src/lexicon/index.ts index ecc401c3883..67d5baddd30 100644 --- a/packages/bsky/src/lexicon/index.ts +++ b/packages/bsky/src/lexicon/index.ts @@ -157,12 +157,6 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } -export const COM_ATPROTO_SYNC = { - DefsTakendown: 'com.atproto.sync.defs#takendown', - DefsSuspended: 'com.atproto.sync.defs#suspended', - DefsDeleted: 'com.atproto.sync.defs#deleted', - DefsDeactivated: 'com.atproto.sync.defs#deactivated', -} export const APP_BSKY_FEED = { DefsRequestLess: 'app.bsky.feed.defs#requestLess', DefsRequestMore: 'app.bsky.feed.defs#requestMore', diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index d8ee42ec4db..e25852baf34 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -2874,32 +2874,6 @@ export const schemaDict = { }, }, }, - ComAtprotoSyncDefs: { - lexicon: 1, - id: 'com.atproto.sync.defs', - defs: { - takendown: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', - }, - suspended: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', - }, - deleted: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', - }, - deactivated: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', - }, - }, - }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -3227,7 +3201,7 @@ export const schemaDict = { did: { type: 'string', format: 'did', - description: 'The handle or DID of the repo.', + description: 'The DID of the repo.', }, }, }, @@ -3247,12 +3221,8 @@ export const schemaDict = { status: { type: 'string', description: - 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deactivated', - ], + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], }, rev: { type: 'string', @@ -3597,6 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, + didDoc: { + type: 'unknown', + }, }, }, account: { @@ -3625,12 +3598,7 @@ export const schemaDict = { type: 'string', description: 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deleted', - 'com.atproto.sync.defs#deactivated', - ], + knownValues: ['takendown', 'suspended', 'deleted', 'deactivated'], }, }, }, @@ -9390,7 +9358,6 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', - ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts deleted file mode 100644 index ad8e6012482..00000000000 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/defs.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * GENERATED CODE - DO NOT MODIFY - */ -import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { lexicons } from '../../../../lexicons' -import { isObj, hasProp } from '../../../../util' -import { CID } from 'multiformats/cid' - -/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ -export const TAKENDOWN = 'com.atproto.sync.defs#takendown' -/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ -export const SUSPENDED = 'com.atproto.sync.defs#suspended' -/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ -export const DELETED = 'com.atproto.sync.defs#deleted' -/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ -export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts index 77fecbc057b..00abbeaa84b 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -9,7 +9,7 @@ import { CID } from 'multiformats/cid' import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' export interface QueryParams { - /** The handle or DID of the repo. */ + /** The DID of the repo. */ did: string } @@ -18,12 +18,8 @@ export type InputSchema = undefined export interface OutputSchema { did: string active: boolean - /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) /** Optional field, the current rev of the repo, if active=true */ rev?: string [k: string]: unknown diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index c095af29e1a..98a2cad7311 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + didDoc?: {} [k: string]: unknown } @@ -101,12 +102,7 @@ export interface Account { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deleted' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + status?: 'takendown' | 'suspended' | 'deleted' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/ozone/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts index eda9f0edb80..7dfd3ef2f6f 100644 --- a/packages/ozone/src/lexicon/index.ts +++ b/packages/ozone/src/lexicon/index.ts @@ -168,12 +168,6 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } -export const COM_ATPROTO_SYNC = { - DefsTakendown: 'com.atproto.sync.defs#takendown', - DefsSuspended: 'com.atproto.sync.defs#suspended', - DefsDeleted: 'com.atproto.sync.defs#deleted', - DefsDeactivated: 'com.atproto.sync.defs#deactivated', -} export const APP_BSKY_FEED = { DefsRequestLess: 'app.bsky.feed.defs#requestLess', DefsRequestMore: 'app.bsky.feed.defs#requestMore', diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index 2d384413b16..e0e22b032e7 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -2874,32 +2874,6 @@ export const schemaDict = { }, }, }, - ComAtprotoSyncDefs: { - lexicon: 1, - id: 'com.atproto.sync.defs', - defs: { - takendown: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', - }, - suspended: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', - }, - deleted: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', - }, - deactivated: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', - }, - }, - }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -3227,7 +3201,7 @@ export const schemaDict = { did: { type: 'string', format: 'did', - description: 'The handle or DID of the repo.', + description: 'The DID of the repo.', }, }, }, @@ -3247,12 +3221,8 @@ export const schemaDict = { status: { type: 'string', description: - 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deactivated', - ], + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], }, rev: { type: 'string', @@ -3597,6 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, + didDoc: { + type: 'unknown', + }, }, }, account: { @@ -3625,12 +3598,7 @@ export const schemaDict = { type: 'string', description: 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deleted', - 'com.atproto.sync.defs#deactivated', - ], + knownValues: ['takendown', 'suspended', 'deleted', 'deactivated'], }, }, }, @@ -10814,7 +10782,6 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', - ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts deleted file mode 100644 index ad8e6012482..00000000000 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/defs.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * GENERATED CODE - DO NOT MODIFY - */ -import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { lexicons } from '../../../../lexicons' -import { isObj, hasProp } from '../../../../util' -import { CID } from 'multiformats/cid' - -/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ -export const TAKENDOWN = 'com.atproto.sync.defs#takendown' -/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ -export const SUSPENDED = 'com.atproto.sync.defs#suspended' -/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ -export const DELETED = 'com.atproto.sync.defs#deleted' -/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ -export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts index 77fecbc057b..00abbeaa84b 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -9,7 +9,7 @@ import { CID } from 'multiformats/cid' import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' export interface QueryParams { - /** The handle or DID of the repo. */ + /** The DID of the repo. */ did: string } @@ -18,12 +18,8 @@ export type InputSchema = undefined export interface OutputSchema { did: string active: boolean - /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) /** Optional field, the current rev of the repo, if active=true */ rev?: string [k: string]: unknown diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index c095af29e1a..98a2cad7311 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + didDoc?: {} [k: string]: unknown } @@ -101,12 +102,7 @@ export interface Account { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deleted' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + status?: 'takendown' | 'suspended' | 'deleted' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/pds/src/lexicon/index.ts b/packages/pds/src/lexicon/index.ts index eda9f0edb80..7dfd3ef2f6f 100644 --- a/packages/pds/src/lexicon/index.ts +++ b/packages/pds/src/lexicon/index.ts @@ -168,12 +168,6 @@ export const COM_ATPROTO_MODERATION = { DefsReasonOther: 'com.atproto.moderation.defs#reasonOther', DefsReasonAppeal: 'com.atproto.moderation.defs#reasonAppeal', } -export const COM_ATPROTO_SYNC = { - DefsTakendown: 'com.atproto.sync.defs#takendown', - DefsSuspended: 'com.atproto.sync.defs#suspended', - DefsDeleted: 'com.atproto.sync.defs#deleted', - DefsDeactivated: 'com.atproto.sync.defs#deactivated', -} export const APP_BSKY_FEED = { DefsRequestLess: 'app.bsky.feed.defs#requestLess', DefsRequestMore: 'app.bsky.feed.defs#requestMore', diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 2d384413b16..e0e22b032e7 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -2874,32 +2874,6 @@ export const schemaDict = { }, }, }, - ComAtprotoSyncDefs: { - lexicon: 1, - id: 'com.atproto.sync.defs', - defs: { - takendown: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed).', - }, - suspended: { - type: 'token', - description: - 'Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period.', - }, - deleted: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened.', - }, - deactivated: { - type: 'token', - description: - 'Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite.', - }, - }, - }, ComAtprotoSyncGetBlob: { lexicon: 1, id: 'com.atproto.sync.getBlob', @@ -3227,7 +3201,7 @@ export const schemaDict = { did: { type: 'string', format: 'did', - description: 'The handle or DID of the repo.', + description: 'The DID of the repo.', }, }, }, @@ -3247,12 +3221,8 @@ export const schemaDict = { status: { type: 'string', description: - 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deactivated', - ], + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], }, rev: { type: 'string', @@ -3597,6 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, + didDoc: { + type: 'unknown', + }, }, }, account: { @@ -3625,12 +3598,7 @@ export const schemaDict = { type: 'string', description: 'If active=false, this optional field indicates a reason for why the account is not active.', - knownValues: [ - 'com.atproto.sync.defs#takendown', - 'com.atproto.sync.defs#suspended', - 'com.atproto.sync.defs#deleted', - 'com.atproto.sync.defs#deactivated', - ], + knownValues: ['takendown', 'suspended', 'deleted', 'deactivated'], }, }, }, @@ -10814,7 +10782,6 @@ export const ids = { ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword', ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword', ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail', - ComAtprotoSyncDefs: 'com.atproto.sync.defs', ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob', ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks', ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout', diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts b/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts deleted file mode 100644 index ad8e6012482..00000000000 --- a/packages/pds/src/lexicon/types/com/atproto/sync/defs.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * GENERATED CODE - DO NOT MODIFY - */ -import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { lexicons } from '../../../../lexicons' -import { isObj, hasProp } from '../../../../util' -import { CID } from 'multiformats/cid' - -/** Repo hosting status indicating that an administrator has taken down the repo, for a permanent period (though this may be reversed). */ -export const TAKENDOWN = 'com.atproto.sync.defs#takendown' -/** Repo hosting status indicating that an administrator has taken down the repo, for a limited (but possibly indefinite) time period. */ -export const SUSPENDED = 'com.atproto.sync.defs#suspended' -/** Repo hosting status indicating that the repository has been removed. The repo may be re-opened or migrated back to this host in the future, but the contents have been deleted for now. Does not clarify if the account self-deleted or an administrator or operator intervened. */ -export const DELETED = 'com.atproto.sync.defs#deleted' -/** Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite. */ -export const DEACTIVATED = 'com.atproto.sync.defs#deactivated' diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts b/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts index 77fecbc057b..00abbeaa84b 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/getRepoStatus.ts @@ -9,7 +9,7 @@ import { CID } from 'multiformats/cid' import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' export interface QueryParams { - /** The handle or DID of the repo. */ + /** The DID of the repo. */ did: string } @@ -18,12 +18,8 @@ export type InputSchema = undefined export interface OutputSchema { did: string active: boolean - /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) /** Optional field, the current rev of the repo, if active=true */ rev?: string [k: string]: unknown diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index c095af29e1a..98a2cad7311 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + didDoc?: {} [k: string]: unknown } @@ -101,12 +102,7 @@ export interface Account { /** Indicates that the account has a repository which can be fetched from the host that emitted this event. */ active: boolean /** If active=false, this optional field indicates a reason for why the account is not active. */ - status?: - | 'com.atproto.sync.defs#takendown' - | 'com.atproto.sync.defs#suspended' - | 'com.atproto.sync.defs#deleted' - | 'com.atproto.sync.defs#deactivated' - | (string & {}) + status?: 'takendown' | 'suspended' | 'deleted' | 'deactivated' | (string & {}) [k: string]: unknown } From 2e122ef4065c58745950ce242d4e9c9c002bc8d1 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 27 May 2024 16:06:43 -0500 Subject: [PATCH 09/11] update identity evt --- lexicons/com/atproto/sync/subscribeRepos.json | 2 +- packages/api/src/client/lexicons.ts | 5 +++-- .../api/src/client/types/com/atproto/sync/subscribeRepos.ts | 2 +- packages/bsky/src/lexicon/lexicons.ts | 5 +++-- .../src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 2 +- packages/ozone/src/lexicon/lexicons.ts | 5 +++-- .../src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 2 +- packages/pds/src/lexicon/lexicons.ts | 5 +++-- .../pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 2 +- 9 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index bf11a8a2f0e..f04773e03ea 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -120,7 +120,7 @@ "seq": { "type": "integer" }, "did": { "type": "string", "format": "did" }, "time": { "type": "string", "format": "datetime" }, - "didDoc": { "type": "unknown" } + "handle": { "type": "string", "format": "handle" } } }, "account": { diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index e0e22b032e7..e283b24e0a8 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3567,8 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, - didDoc: { - type: 'unknown', + handle: { + type: 'string', + format: 'handle', }, }, }, diff --git a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts index 77794c0d563..a8cf2f949f2 100644 --- a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts @@ -51,7 +51,7 @@ export interface Identity { seq: number did: string time: string - didDoc?: {} + handle?: string [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index e25852baf34..680aa30ebf0 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3567,8 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, - didDoc: { - type: 'unknown', + handle: { + type: 'string', + format: 'handle', }, }, }, diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 98a2cad7311..97576dfdea3 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,7 +78,7 @@ export interface Identity { seq: number did: string time: string - didDoc?: {} + handle?: string [k: string]: unknown } diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index e0e22b032e7..e283b24e0a8 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -3567,8 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, - didDoc: { - type: 'unknown', + handle: { + type: 'string', + format: 'handle', }, }, }, diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 98a2cad7311..97576dfdea3 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,7 +78,7 @@ export interface Identity { seq: number did: string time: string - didDoc?: {} + handle?: string [k: string]: unknown } diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index e0e22b032e7..e283b24e0a8 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3567,8 +3567,9 @@ export const schemaDict = { type: 'string', format: 'datetime', }, - didDoc: { - type: 'unknown', + handle: { + type: 'string', + format: 'handle', }, }, }, diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 98a2cad7311..97576dfdea3 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,7 +78,7 @@ export interface Identity { seq: number did: string time: string - didDoc?: {} + handle?: string [k: string]: unknown } From 07ac1fe9c532cb3efa52bc227106e547d5d1f248 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 27 May 2024 16:40:07 -0500 Subject: [PATCH 10/11] add description to handle field --- lexicons/com/atproto/sync/subscribeRepos.json | 6 +++++- packages/api/src/client/lexicons.ts | 2 ++ .../api/src/client/types/com/atproto/sync/subscribeRepos.ts | 1 + packages/bsky/src/lexicon/lexicons.ts | 2 ++ .../src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 1 + packages/ozone/src/lexicon/lexicons.ts | 2 ++ .../src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 1 + packages/pds/src/lexicon/lexicons.ts | 2 ++ .../src/lexicon/types/com/atproto/sync/subscribeRepos.ts | 1 + 9 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index f04773e03ea..1f1c58fac25 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -120,7 +120,11 @@ "seq": { "type": "integer" }, "did": { "type": "string", "format": "did" }, "time": { "type": "string", "format": "datetime" }, - "handle": { "type": "string", "format": "handle" } + "handle": { + "type": "string", + "format": "handle", + "description": "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details." + } } }, "account": { diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index e283b24e0a8..b3473dcefb3 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3570,6 +3570,8 @@ export const schemaDict = { handle: { type: 'string', format: 'handle', + description: + "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.", }, }, }, diff --git a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts index a8cf2f949f2..206eb76615f 100644 --- a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts @@ -51,6 +51,7 @@ export interface Identity { seq: number did: string time: string + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: string [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 680aa30ebf0..80dc94fc39c 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3570,6 +3570,8 @@ export const schemaDict = { handle: { type: 'string', format: 'handle', + description: + "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.", }, }, }, diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 97576dfdea3..0d8da9379b1 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: string [k: string]: unknown } diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index e283b24e0a8..b3473dcefb3 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -3570,6 +3570,8 @@ export const schemaDict = { handle: { type: 'string', format: 'handle', + description: + "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.", }, }, }, diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 97576dfdea3..0d8da9379b1 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: string [k: string]: unknown } diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index e283b24e0a8..b3473dcefb3 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3570,6 +3570,8 @@ export const schemaDict = { handle: { type: 'string', format: 'handle', + description: + "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.", }, }, }, diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 97576dfdea3..0d8da9379b1 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -78,6 +78,7 @@ export interface Identity { seq: number did: string time: string + /** The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. */ handle?: string [k: string]: unknown } From b9e1700b7dc67ab0a5e31196a8b7d98f4eaf6692 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 27 May 2024 17:17:47 -0500 Subject: [PATCH 11/11] status on listRepos & notate deprecated firehose events --- lexicons/com/atproto/sync/listRepos.json | 8 +++++++- lexicons/com/atproto/sync/subscribeRepos.json | 6 +++--- packages/api/src/client/lexicons.ts | 18 ++++++++++++------ .../client/types/com/atproto/sync/listRepos.ts | 3 +++ .../types/com/atproto/sync/subscribeRepos.ts | 6 +++--- packages/bsky/src/lexicon/lexicons.ts | 18 ++++++++++++------ .../types/com/atproto/sync/listRepos.ts | 3 +++ .../types/com/atproto/sync/subscribeRepos.ts | 6 +++--- packages/ozone/src/lexicon/lexicons.ts | 18 ++++++++++++------ .../types/com/atproto/sync/listRepos.ts | 3 +++ .../types/com/atproto/sync/subscribeRepos.ts | 6 +++--- packages/pds/src/lexicon/lexicons.ts | 18 ++++++++++++------ .../types/com/atproto/sync/listRepos.ts | 3 +++ .../types/com/atproto/sync/subscribeRepos.ts | 6 +++--- 14 files changed, 82 insertions(+), 40 deletions(-) diff --git a/lexicons/com/atproto/sync/listRepos.json b/lexicons/com/atproto/sync/listRepos.json index 07ae35e2c5e..af77169ecb4 100644 --- a/lexicons/com/atproto/sync/listRepos.json +++ b/lexicons/com/atproto/sync/listRepos.json @@ -42,7 +42,13 @@ "format": "cid", "description": "Current repo commit CID" }, - "rev": { "type": "string" } + "rev": { "type": "string" }, + "active": { "type": "boolean" }, + "status": { + "type": "string", + "description": "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.", + "knownValues": ["takendown", "suspended", "deactivated"] + } } } } diff --git a/lexicons/com/atproto/sync/subscribeRepos.json b/lexicons/com/atproto/sync/subscribeRepos.json index 1f1c58fac25..8132c22a448 100644 --- a/lexicons/com/atproto/sync/subscribeRepos.json +++ b/lexicons/com/atproto/sync/subscribeRepos.json @@ -148,7 +148,7 @@ }, "handle": { "type": "object", - "description": "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", + "description": "DEPRECATED -- Use #identity event instead", "required": ["seq", "did", "handle", "time"], "properties": { "seq": { "type": "integer" }, @@ -159,7 +159,7 @@ }, "migrate": { "type": "object", - "description": "Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead", + "description": "DEPRECATED -- Use #account event instead", "required": ["seq", "did", "migrateTo", "time"], "nullable": ["migrateTo"], "properties": { @@ -171,7 +171,7 @@ }, "tombstone": { "type": "object", - "description": "Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event", + "description": "DEPRECATED -- Use #account event instead", "required": ["seq", "did", "time"], "properties": { "seq": { "type": "integer" }, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index b3473dcefb3..d36c9084524 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3366,6 +3366,15 @@ export const schemaDict = { rev: { type: 'string', }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], + }, }, }, }, @@ -3607,8 +3616,7 @@ export const schemaDict = { }, handle: { type: 'object', - description: - "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", + description: 'DEPRECATED -- Use #identity event instead', required: ['seq', 'did', 'handle', 'time'], properties: { seq: { @@ -3630,8 +3638,7 @@ export const schemaDict = { }, migrate: { type: 'object', - description: - 'Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'migrateTo', 'time'], nullable: ['migrateTo'], properties: { @@ -3653,8 +3660,7 @@ export const schemaDict = { }, tombstone: { type: 'object', - description: - 'Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'time'], properties: { seq: { diff --git a/packages/api/src/client/types/com/atproto/sync/listRepos.ts b/packages/api/src/client/types/com/atproto/sync/listRepos.ts index eccf796acb6..707de444ea0 100644 --- a/packages/api/src/client/types/com/atproto/sync/listRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/listRepos.ts @@ -41,6 +41,9 @@ export interface Repo { /** Current repo commit CID */ head: string rev: string + active?: boolean + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts index 206eb76615f..11ebfcda91f 100644 --- a/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/api/src/client/types/com/atproto/sync/subscribeRepos.ts @@ -92,7 +92,7 @@ export function validateAccount(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) } -/** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ +/** DEPRECATED -- Use #identity event instead */ export interface Handle { seq: number did: string @@ -113,7 +113,7 @@ export function validateHandle(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v) } -/** Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead */ +/** DEPRECATED -- Use #account event instead */ export interface Migrate { seq: number did: string @@ -134,7 +134,7 @@ export function validateMigrate(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v) } -/** Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event */ +/** DEPRECATED -- Use #account event instead */ export interface Tombstone { seq: number did: string diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 80dc94fc39c..78d96a6636d 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3366,6 +3366,15 @@ export const schemaDict = { rev: { type: 'string', }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], + }, }, }, }, @@ -3607,8 +3616,7 @@ export const schemaDict = { }, handle: { type: 'object', - description: - "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", + description: 'DEPRECATED -- Use #identity event instead', required: ['seq', 'did', 'handle', 'time'], properties: { seq: { @@ -3630,8 +3638,7 @@ export const schemaDict = { }, migrate: { type: 'object', - description: - 'Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'migrateTo', 'time'], nullable: ['migrateTo'], properties: { @@ -3653,8 +3660,7 @@ export const schemaDict = { }, tombstone: { type: 'object', - description: - 'Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'time'], properties: { seq: { diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/listRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/listRepos.ts index e5a8e2ca9d6..5628b0b5147 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/listRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/listRepos.ts @@ -51,6 +51,9 @@ export interface Repo { /** Current repo commit CID */ head: string rev: string + active?: boolean + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 0d8da9379b1..8f9855a5da4 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -119,7 +119,7 @@ export function validateAccount(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) } -/** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ +/** DEPRECATED -- Use #identity event instead */ export interface Handle { seq: number did: string @@ -140,7 +140,7 @@ export function validateHandle(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v) } -/** Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead */ +/** DEPRECATED -- Use #account event instead */ export interface Migrate { seq: number did: string @@ -161,7 +161,7 @@ export function validateMigrate(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v) } -/** Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event */ +/** DEPRECATED -- Use #account event instead */ export interface Tombstone { seq: number did: string diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index b3473dcefb3..d36c9084524 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -3366,6 +3366,15 @@ export const schemaDict = { rev: { type: 'string', }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], + }, }, }, }, @@ -3607,8 +3616,7 @@ export const schemaDict = { }, handle: { type: 'object', - description: - "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", + description: 'DEPRECATED -- Use #identity event instead', required: ['seq', 'did', 'handle', 'time'], properties: { seq: { @@ -3630,8 +3638,7 @@ export const schemaDict = { }, migrate: { type: 'object', - description: - 'Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'migrateTo', 'time'], nullable: ['migrateTo'], properties: { @@ -3653,8 +3660,7 @@ export const schemaDict = { }, tombstone: { type: 'object', - description: - 'Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'time'], properties: { seq: { diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts index e5a8e2ca9d6..5628b0b5147 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts @@ -51,6 +51,9 @@ export interface Repo { /** Current repo commit CID */ head: string rev: string + active?: boolean + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 0d8da9379b1..8f9855a5da4 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -119,7 +119,7 @@ export function validateAccount(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) } -/** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ +/** DEPRECATED -- Use #identity event instead */ export interface Handle { seq: number did: string @@ -140,7 +140,7 @@ export function validateHandle(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v) } -/** Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead */ +/** DEPRECATED -- Use #account event instead */ export interface Migrate { seq: number did: string @@ -161,7 +161,7 @@ export function validateMigrate(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v) } -/** Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event */ +/** DEPRECATED -- Use #account event instead */ export interface Tombstone { seq: number did: string diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index b3473dcefb3..d36c9084524 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3366,6 +3366,15 @@ export const schemaDict = { rev: { type: 'string', }, + active: { + type: 'boolean', + }, + status: { + type: 'string', + description: + 'If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.', + knownValues: ['takendown', 'suspended', 'deactivated'], + }, }, }, }, @@ -3607,8 +3616,7 @@ export const schemaDict = { }, handle: { type: 'object', - description: - "Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.", + description: 'DEPRECATED -- Use #identity event instead', required: ['seq', 'did', 'handle', 'time'], properties: { seq: { @@ -3630,8 +3638,7 @@ export const schemaDict = { }, migrate: { type: 'object', - description: - 'Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'migrateTo', 'time'], nullable: ['migrateTo'], properties: { @@ -3653,8 +3660,7 @@ export const schemaDict = { }, tombstone: { type: 'object', - description: - 'Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event', + description: 'DEPRECATED -- Use #account event instead', required: ['seq', 'did', 'time'], properties: { seq: { diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/listRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/listRepos.ts index e5a8e2ca9d6..5628b0b5147 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/listRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/listRepos.ts @@ -51,6 +51,9 @@ export interface Repo { /** Current repo commit CID */ head: string rev: string + active?: boolean + /** If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. */ + status?: 'takendown' | 'suspended' | 'deactivated' | (string & {}) [k: string]: unknown } diff --git a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts index 0d8da9379b1..8f9855a5da4 100644 --- a/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +++ b/packages/pds/src/lexicon/types/com/atproto/sync/subscribeRepos.ts @@ -119,7 +119,7 @@ export function validateAccount(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#account', v) } -/** Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity. */ +/** DEPRECATED -- Use #identity event instead */ export interface Handle { seq: number did: string @@ -140,7 +140,7 @@ export function validateHandle(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#handle', v) } -/** Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead */ +/** DEPRECATED -- Use #account event instead */ export interface Migrate { seq: number did: string @@ -161,7 +161,7 @@ export function validateMigrate(v: unknown): ValidationResult { return lexicons.validate('com.atproto.sync.subscribeRepos#migrate', v) } -/** Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event */ +/** DEPRECATED -- Use #account event instead */ export interface Tombstone { seq: number did: string