@atproto/pds 0.4.122 → 0.4.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/account-manager/account-manager.js +17 -7
- package/dist/account-manager/account-manager.js.map +1 -1
- package/dist/account-manager/db/index.d.ts.map +1 -1
- package/dist/account-manager/db/migrations/005-oauth-account-management.d.ts +20 -0
- package/dist/account-manager/db/migrations/005-oauth-account-management.d.ts.map +1 -0
- package/dist/account-manager/db/migrations/005-oauth-account-management.js +72 -0
- package/dist/account-manager/db/migrations/005-oauth-account-management.js.map +1 -0
- package/dist/account-manager/db/migrations/index.d.ts +2 -0
- package/dist/account-manager/db/migrations/index.d.ts.map +1 -1
- package/dist/account-manager/db/migrations/index.js +19 -7
- package/dist/account-manager/db/migrations/index.js.map +1 -1
- package/dist/account-manager/db/schema/account-device.d.ts +13 -0
- package/dist/account-manager/db/schema/account-device.d.ts.map +1 -0
- package/dist/account-manager/db/schema/{device-account.js → account-device.js} +2 -2
- package/dist/account-manager/db/schema/account-device.js.map +1 -0
- package/dist/account-manager/db/schema/authorization-request.d.ts +4 -4
- package/dist/account-manager/db/schema/authorization-request.d.ts.map +1 -1
- package/dist/account-manager/db/schema/authorization-request.js.map +1 -1
- package/dist/account-manager/db/schema/authorized-client.d.ts +16 -0
- package/dist/account-manager/db/schema/authorized-client.d.ts.map +1 -0
- package/dist/account-manager/db/schema/authorized-client.js +5 -0
- package/dist/account-manager/db/schema/authorized-client.js.map +1 -0
- package/dist/account-manager/db/schema/index.d.ts +4 -3
- package/dist/account-manager/db/schema/index.d.ts.map +1 -1
- package/dist/account-manager/db/schema/token.d.ts +5 -5
- package/dist/account-manager/db/schema/token.d.ts.map +1 -1
- package/dist/account-manager/db/schema/token.js.map +1 -1
- package/dist/account-manager/helpers/account-device.d.ts +204 -0
- package/dist/account-manager/helpers/account-device.d.ts.map +1 -0
- package/dist/account-manager/helpers/account-device.js +54 -0
- package/dist/account-manager/helpers/account-device.js.map +1 -0
- package/dist/account-manager/helpers/account.d.ts +2 -1
- package/dist/account-manager/helpers/account.d.ts.map +1 -1
- package/dist/account-manager/helpers/auth.d.ts.map +1 -1
- package/dist/account-manager/helpers/auth.js +17 -7
- package/dist/account-manager/helpers/auth.js.map +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -1
- package/dist/account-manager/helpers/authorization-request.js +4 -4
- package/dist/account-manager/helpers/authorization-request.js.map +1 -1
- package/dist/account-manager/helpers/authorized-client.d.ts +6 -0
- package/dist/account-manager/helpers/authorized-client.d.ts.map +1 -0
- package/dist/account-manager/helpers/authorized-client.js +47 -0
- package/dist/account-manager/helpers/authorized-client.js.map +1 -0
- package/dist/account-manager/helpers/device.d.ts +1 -1
- package/dist/account-manager/helpers/device.d.ts.map +1 -1
- package/dist/account-manager/helpers/device.js.map +1 -1
- package/dist/account-manager/helpers/email-token.d.ts.map +1 -1
- package/dist/account-manager/helpers/invite.d.ts.map +1 -1
- package/dist/account-manager/helpers/password.d.ts.map +1 -1
- package/dist/account-manager/helpers/password.js +17 -7
- package/dist/account-manager/helpers/password.js.map +1 -1
- package/dist/account-manager/helpers/repo.d.ts.map +1 -1
- package/dist/account-manager/helpers/scrypt.d.ts.map +1 -1
- package/dist/account-manager/helpers/scrypt.js +17 -7
- package/dist/account-manager/helpers/scrypt.js.map +1 -1
- package/dist/account-manager/helpers/token.d.ts +566 -59
- package/dist/account-manager/helpers/token.d.ts.map +1 -1
- package/dist/account-manager/helpers/token.js +17 -32
- package/dist/account-manager/helpers/token.js.map +1 -1
- package/dist/account-manager/helpers/used-refresh-token.d.ts.map +1 -1
- package/dist/account-manager/oauth-store.d.ts +17 -7
- package/dist/account-manager/oauth-store.d.ts.map +1 -1
- package/dist/account-manager/oauth-store.js +138 -86
- package/dist/account-manager/oauth-store.js.map +1 -1
- package/dist/actor-store/actor-store.js +17 -7
- package/dist/actor-store/actor-store.js.map +1 -1
- package/dist/actor-store/blob/transactor.js +17 -7
- package/dist/actor-store/blob/transactor.js.map +1 -1
- package/dist/actor-store/db/index.d.ts.map +1 -1
- package/dist/actor-store/db/migrations/index.js +17 -7
- package/dist/actor-store/db/migrations/index.js.map +1 -1
- package/dist/actor-store/migrate.d.ts.map +1 -1
- package/dist/actor-store/preference/reader.d.ts.map +1 -1
- package/dist/actor-store/preference/util.d.ts.map +1 -1
- package/dist/actor-store/record/reader.d.ts.map +1 -1
- package/dist/actor-store/record/reader.js +17 -7
- package/dist/actor-store/record/reader.js.map +1 -1
- package/dist/actor-store/repo/sql-repo-reader.d.ts +1 -1
- package/dist/api/app/bsky/util/resolver.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js +17 -7
- package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js +17 -7
- package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/repo/describeRepo.js +17 -7
- package/dist/api/com/atproto/repo/describeRepo.js.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAccount.js +17 -7
- package/dist/api/com/atproto/server/createAccount.js.map +1 -1
- package/dist/api/com/atproto/server/util.d.ts.map +1 -1
- package/dist/api/com/atproto/server/util.js +17 -7
- package/dist/api/com/atproto/server/util.js.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.js +17 -7
- package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/util.d.ts.map +1 -1
- package/dist/api/proxy.d.ts.map +1 -1
- package/dist/auth-routes.d.ts.map +1 -1
- package/dist/auth-routes.js +2 -3
- package/dist/auth-routes.js.map +1 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +19 -13
- package/dist/auth-verifier.js.map +1 -1
- package/dist/basic-routes.d.ts.map +1 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +1 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +1 -1
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +1 -1
- package/dist/config/env.js.map +1 -1
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/context.js +18 -8
- package/dist/context.js.map +1 -1
- package/dist/db/cast.d.ts +17 -13
- package/dist/db/cast.d.ts.map +1 -1
- package/dist/db/cast.js +13 -52
- package/dist/db/cast.js.map +1 -1
- package/dist/db/pagination.d.ts.map +1 -1
- package/dist/db/util.d.ts.map +1 -1
- package/dist/did-cache/db/index.d.ts.map +1 -1
- package/dist/disk-blobstore.d.ts.map +1 -1
- package/dist/handle/explicit-slurs.d.ts.map +1 -1
- package/dist/handle/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +254 -4
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +134 -2
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/defs.d.ts +2 -0
- package/dist/lexicon/types/com/atproto/sync/defs.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/defs.js +7 -0
- package/dist/lexicon/types/com/atproto/sync/defs.js.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/getHostStatus.d.ts +43 -0
- package/dist/lexicon/types/com/atproto/sync/getHostStatus.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/getHostStatus.js +7 -0
- package/dist/lexicon/types/com/atproto/sync/getHostStatus.js.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/listHosts.d.ts +51 -0
- package/dist/lexicon/types/com/atproto/sync/listHosts.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/listHosts.js +16 -0
- package/dist/lexicon/types/com/atproto/sync/listHosts.js.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/requestCrawl.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/requestCrawl.d.ts.map +1 -1
- package/dist/lexicon/util.d.ts.map +1 -1
- package/dist/mailer/index.js +17 -7
- package/dist/mailer/index.js.map +1 -1
- package/dist/mailer/templates/plc-operation.js +1 -1
- package/dist/mailer/templates/plc-operation.js.map +1 -1
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/read-after-write/util.d.ts.map +1 -1
- package/dist/redis.d.ts.map +1 -1
- package/dist/repo/prepare.d.ts.map +1 -1
- package/dist/repo/prepare.js +17 -7
- package/dist/repo/prepare.js.map +1 -1
- package/dist/scripts/publish-identity.d.ts.map +1 -1
- package/dist/scripts/rebuild-repo.d.ts.map +1 -1
- package/dist/scripts/rotate-keys.d.ts.map +1 -1
- package/dist/scripts/sequencer-recovery/index.d.ts.map +1 -1
- package/dist/scripts/sequencer-recovery/recoverer.d.ts.map +1 -1
- package/dist/scripts/sequencer-recovery/recovery-db.d.ts.map +1 -1
- package/dist/scripts/sequencer-recovery/repair-repos.d.ts.map +1 -1
- package/dist/scripts/util.d.ts.map +1 -1
- package/dist/sequencer/db/index.d.ts.map +1 -1
- package/dist/sequencer/db/migrations/index.js +17 -7
- package/dist/sequencer/db/migrations/index.js.map +1 -1
- package/dist/sequencer/events.d.ts +6 -6
- package/dist/sequencer/events.d.ts.map +1 -1
- package/dist/sequencer/sequencer.d.ts.map +1 -1
- package/dist/util/debug.d.ts.map +1 -1
- package/dist/util/params.d.ts.map +1 -1
- package/dist/well-known.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/account-manager/db/migrations/005-oauth-account-management.ts +112 -0
- package/src/account-manager/db/migrations/index.ts +2 -0
- package/src/account-manager/db/schema/account-device.ts +14 -0
- package/src/account-manager/db/schema/authorization-request.ts +5 -3
- package/src/account-manager/db/schema/authorized-client.ts +19 -0
- package/src/account-manager/db/schema/index.ts +5 -3
- package/src/account-manager/db/schema/token.ts +7 -4
- package/src/account-manager/helpers/account-device.ts +66 -0
- package/src/account-manager/helpers/authorization-request.ts +5 -5
- package/src/account-manager/helpers/authorized-client.ts +69 -0
- package/src/account-manager/helpers/device.ts +3 -1
- package/src/account-manager/helpers/token.ts +19 -57
- package/src/account-manager/oauth-store.ts +182 -103
- package/src/auth-routes.ts +11 -7
- package/src/auth-verifier.ts +2 -7
- package/src/config/config.ts +1 -1
- package/src/config/env.ts +2 -2
- package/src/context.ts +2 -2
- package/src/db/cast.ts +43 -50
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +141 -2
- package/src/lexicon/types/com/atproto/sync/defs.ts +23 -0
- package/src/lexicon/types/com/atproto/sync/getHostStatus.ts +61 -0
- package/src/lexicon/types/com/atproto/sync/listHosts.ts +77 -0
- package/src/lexicon/types/com/atproto/sync/requestCrawl.ts +1 -0
- package/src/mailer/templates/plc-operation.hbs +2 -2
- package/tests/db.test.ts +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
- package/dist/account-manager/db/schema/device-account.d.ts +0 -14
- package/dist/account-manager/db/schema/device-account.d.ts.map +0 -1
- package/dist/account-manager/db/schema/device-account.js.map +0 -1
- package/dist/account-manager/helpers/device-account.d.ts +0 -108
- package/dist/account-manager/helpers/device-account.d.ts.map +0 -1
- package/dist/account-manager/helpers/device-account.js +0 -83
- package/dist/account-manager/helpers/device-account.js.map +0 -1
- package/src/account-manager/db/schema/device-account.ts +0 -15
- package/src/account-manager/helpers/device-account.ts +0 -135
package/src/context.ts
CHANGED
@@ -10,7 +10,7 @@ import { KmsKeypair, S3BlobStore } from '@atproto/aws'
|
|
10
10
|
import * as crypto from '@atproto/crypto'
|
11
11
|
import { IdResolver } from '@atproto/identity'
|
12
12
|
import {
|
13
|
-
|
13
|
+
AccessTokenMode,
|
14
14
|
JoseKey,
|
15
15
|
OAuthProvider,
|
16
16
|
OAuthVerifier,
|
@@ -369,7 +369,7 @@ export class AppContext {
|
|
369
369
|
// entryway), there is no need to use JWTs as access tokens. Instead,
|
370
370
|
// the PDS can use tokenId as access tokens. This allows the PDS to
|
371
371
|
// always use up-to-date token data from the token store.
|
372
|
-
|
372
|
+
accessTokenMode: AccessTokenMode.light,
|
373
373
|
})
|
374
374
|
: undefined
|
375
375
|
|
package/src/db/cast.ts
CHANGED
@@ -1,59 +1,52 @@
|
|
1
1
|
export type DateISO = `${string}T${string}Z`
|
2
|
-
export
|
3
|
-
|
2
|
+
export function toDateISO(date: Date) {
|
3
|
+
return date.toISOString() as DateISO
|
4
|
+
}
|
5
|
+
export function fromDateISO(dateStr: DateISO) {
|
6
|
+
return new Date(dateStr)
|
7
|
+
}
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Allows to ensure that {@link JsonEncoded} is not used with non-JSON
|
11
|
+
* serializable values (e.g. {@link Date} or {@link Function}s).
|
12
|
+
*/
|
13
|
+
export type Encodable =
|
14
|
+
| string
|
15
|
+
| number
|
16
|
+
| boolean
|
17
|
+
| null
|
18
|
+
| readonly Encodable[]
|
19
|
+
| { readonly [_ in string]?: Encodable }
|
20
|
+
|
21
|
+
export type JsonString<T extends Encodable> = T extends readonly unknown[]
|
22
|
+
? `[${string}]`
|
23
|
+
: T extends object
|
24
|
+
? `{${string}}`
|
25
|
+
: T extends string
|
26
|
+
? `"${string}"`
|
27
|
+
: T extends number
|
28
|
+
? `${number}`
|
29
|
+
: T extends boolean
|
30
|
+
? `true` | `false`
|
31
|
+
: T extends null
|
32
|
+
? `null`
|
33
|
+
: never
|
4
34
|
|
5
|
-
|
6
|
-
export
|
7
|
-
|
35
|
+
declare const jsonEncodedType: unique symbol
|
36
|
+
export type JsonEncoded<T extends Encodable = Encodable> = JsonString<T> & {
|
37
|
+
[jsonEncodedType]: T
|
38
|
+
}
|
39
|
+
|
40
|
+
export function toJson<T extends Encodable>(value: T): JsonEncoded<T> {
|
41
|
+
const json = JSON.stringify(value)
|
8
42
|
if (json === undefined) throw new TypeError('Input not JSONifyable')
|
9
|
-
return json as
|
43
|
+
return json as JsonEncoded<T>
|
10
44
|
}
|
11
|
-
|
45
|
+
|
46
|
+
export function fromJson<T extends Encodable>(jsonStr: JsonEncoded<T>): T {
|
12
47
|
try {
|
13
|
-
return JSON.parse(
|
48
|
+
return JSON.parse(jsonStr) as T
|
14
49
|
} catch (cause) {
|
15
50
|
throw new TypeError('Database contains invalid JSON', { cause })
|
16
51
|
}
|
17
52
|
}
|
18
|
-
|
19
|
-
export type JsonArray = `[${string}]`
|
20
|
-
export const isJsonArray = (json: string): json is JsonArray =>
|
21
|
-
// Although the JSON in the DB should have been encoded using toJson,
|
22
|
-
// there should not be any leading or trailing whitespace. We will still trim
|
23
|
-
// the string to protect against any manual editing of the DB.
|
24
|
-
json.trimStart().startsWith('[') && json.trimEnd().endsWith(']')
|
25
|
-
export function assertJsonArray(json: string): asserts json is JsonArray {
|
26
|
-
if (!isJsonArray(json)) throw new TypeError('Not an Array')
|
27
|
-
}
|
28
|
-
export const toJsonArray = (obj: readonly unknown[]): JsonArray => {
|
29
|
-
const json = toJson(obj)
|
30
|
-
assertJsonArray(json)
|
31
|
-
return json as JsonArray
|
32
|
-
}
|
33
|
-
export const fromJsonArray = <T>(json: JsonArray): T[] => {
|
34
|
-
assertJsonArray(json)
|
35
|
-
return fromJson(json) as T[]
|
36
|
-
}
|
37
|
-
|
38
|
-
export type JsonObject = `{${string}}`
|
39
|
-
const isJsonObject = (json: string): json is JsonObject =>
|
40
|
-
// Although the JSON in the DB should have been encoded using toJson,
|
41
|
-
// there should not be any leading or trailing whitespace. We will still trim
|
42
|
-
// the string to protect against any manual editing of the DB.
|
43
|
-
json.trimStart().startsWith('{') && json.trimEnd().endsWith('}')
|
44
|
-
function assertJsonObject(json: string): asserts json is JsonObject {
|
45
|
-
if (!isJsonObject(json)) throw new TypeError('Not an Object')
|
46
|
-
}
|
47
|
-
export const toJsonObject = (
|
48
|
-
obj: Readonly<Record<string, unknown>>,
|
49
|
-
): JsonObject => {
|
50
|
-
const json = toJson(obj)
|
51
|
-
assertJsonObject(json)
|
52
|
-
return json as JsonObject
|
53
|
-
}
|
54
|
-
export const fromJsonObject = <T extends Record<string, unknown>>(
|
55
|
-
json: JsonObject,
|
56
|
-
): T => {
|
57
|
-
assertJsonObject(json)
|
58
|
-
return fromJson(json) as T
|
59
|
-
}
|
package/src/lexicon/index.ts
CHANGED
@@ -75,11 +75,13 @@ import * as ComAtprotoSyncGetBlob from './types/com/atproto/sync/getBlob.js'
|
|
75
75
|
import * as ComAtprotoSyncGetBlocks from './types/com/atproto/sync/getBlocks.js'
|
76
76
|
import * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout.js'
|
77
77
|
import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead.js'
|
78
|
+
import * as ComAtprotoSyncGetHostStatus from './types/com/atproto/sync/getHostStatus.js'
|
78
79
|
import * as ComAtprotoSyncGetLatestCommit from './types/com/atproto/sync/getLatestCommit.js'
|
79
80
|
import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js'
|
80
81
|
import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo.js'
|
81
82
|
import * as ComAtprotoSyncGetRepoStatus from './types/com/atproto/sync/getRepoStatus.js'
|
82
83
|
import * as ComAtprotoSyncListBlobs from './types/com/atproto/sync/listBlobs.js'
|
84
|
+
import * as ComAtprotoSyncListHosts from './types/com/atproto/sync/listHosts.js'
|
83
85
|
import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos.js'
|
84
86
|
import * as ComAtprotoSyncListReposByCollection from './types/com/atproto/sync/listReposByCollection.js'
|
85
87
|
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate.js'
|
@@ -1106,6 +1108,17 @@ export class ComAtprotoSyncNS {
|
|
1106
1108
|
return this._server.xrpc.method(nsid, cfg)
|
1107
1109
|
}
|
1108
1110
|
|
1111
|
+
getHostStatus<AV extends AuthVerifier>(
|
1112
|
+
cfg: ConfigOf<
|
1113
|
+
AV,
|
1114
|
+
ComAtprotoSyncGetHostStatus.Handler<ExtractAuth<AV>>,
|
1115
|
+
ComAtprotoSyncGetHostStatus.HandlerReqCtx<ExtractAuth<AV>>
|
1116
|
+
>,
|
1117
|
+
) {
|
1118
|
+
const nsid = 'com.atproto.sync.getHostStatus' // @ts-ignore
|
1119
|
+
return this._server.xrpc.method(nsid, cfg)
|
1120
|
+
}
|
1121
|
+
|
1109
1122
|
getLatestCommit<AV extends AuthVerifier>(
|
1110
1123
|
cfg: ConfigOf<
|
1111
1124
|
AV,
|
@@ -1161,6 +1174,17 @@ export class ComAtprotoSyncNS {
|
|
1161
1174
|
return this._server.xrpc.method(nsid, cfg)
|
1162
1175
|
}
|
1163
1176
|
|
1177
|
+
listHosts<AV extends AuthVerifier>(
|
1178
|
+
cfg: ConfigOf<
|
1179
|
+
AV,
|
1180
|
+
ComAtprotoSyncListHosts.Handler<ExtractAuth<AV>>,
|
1181
|
+
ComAtprotoSyncListHosts.HandlerReqCtx<ExtractAuth<AV>>
|
1182
|
+
>,
|
1183
|
+
) {
|
1184
|
+
const nsid = 'com.atproto.sync.listHosts' // @ts-ignore
|
1185
|
+
return this._server.xrpc.method(nsid, cfg)
|
1186
|
+
}
|
1187
|
+
|
1164
1188
|
listRepos<AV extends AuthVerifier>(
|
1165
1189
|
cfg: ConfigOf<
|
1166
1190
|
AV,
|
package/src/lexicon/lexicons.ts
CHANGED
@@ -3365,6 +3365,16 @@ export const schemaDict = {
|
|
3365
3365
|
},
|
3366
3366
|
},
|
3367
3367
|
},
|
3368
|
+
ComAtprotoSyncDefs: {
|
3369
|
+
lexicon: 1,
|
3370
|
+
id: 'com.atproto.sync.defs',
|
3371
|
+
defs: {
|
3372
|
+
hostStatus: {
|
3373
|
+
type: 'string',
|
3374
|
+
knownValues: ['active', 'idle', 'offline', 'throttled', 'banned'],
|
3375
|
+
},
|
3376
|
+
},
|
3377
|
+
},
|
3368
3378
|
ComAtprotoSyncGetBlob: {
|
3369
3379
|
lexicon: 1,
|
3370
3380
|
id: 'com.atproto.sync.getBlob',
|
@@ -3525,6 +3535,59 @@ export const schemaDict = {
|
|
3525
3535
|
},
|
3526
3536
|
},
|
3527
3537
|
},
|
3538
|
+
ComAtprotoSyncGetHostStatus: {
|
3539
|
+
lexicon: 1,
|
3540
|
+
id: 'com.atproto.sync.getHostStatus',
|
3541
|
+
defs: {
|
3542
|
+
main: {
|
3543
|
+
type: 'query',
|
3544
|
+
description:
|
3545
|
+
'Returns information about a specified upstream host, as consumed by the server. Implemented by relays.',
|
3546
|
+
parameters: {
|
3547
|
+
type: 'params',
|
3548
|
+
required: ['hostname'],
|
3549
|
+
properties: {
|
3550
|
+
hostname: {
|
3551
|
+
type: 'string',
|
3552
|
+
description:
|
3553
|
+
'Hostname of the host (eg, PDS or relay) being queried.',
|
3554
|
+
},
|
3555
|
+
},
|
3556
|
+
},
|
3557
|
+
output: {
|
3558
|
+
encoding: 'application/json',
|
3559
|
+
schema: {
|
3560
|
+
type: 'object',
|
3561
|
+
required: ['hostname'],
|
3562
|
+
properties: {
|
3563
|
+
hostname: {
|
3564
|
+
type: 'string',
|
3565
|
+
},
|
3566
|
+
seq: {
|
3567
|
+
type: 'integer',
|
3568
|
+
description:
|
3569
|
+
'Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor).',
|
3570
|
+
},
|
3571
|
+
accountCount: {
|
3572
|
+
type: 'integer',
|
3573
|
+
description:
|
3574
|
+
'Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts.',
|
3575
|
+
},
|
3576
|
+
status: {
|
3577
|
+
type: 'ref',
|
3578
|
+
ref: 'lex:com.atproto.sync.defs#hostStatus',
|
3579
|
+
},
|
3580
|
+
},
|
3581
|
+
},
|
3582
|
+
},
|
3583
|
+
errors: [
|
3584
|
+
{
|
3585
|
+
name: 'HostNotFound',
|
3586
|
+
},
|
3587
|
+
],
|
3588
|
+
},
|
3589
|
+
},
|
3590
|
+
},
|
3528
3591
|
ComAtprotoSyncGetLatestCommit: {
|
3529
3592
|
lexicon: 1,
|
3530
3593
|
id: 'com.atproto.sync.getLatestCommit',
|
@@ -3805,6 +3868,74 @@ export const schemaDict = {
|
|
3805
3868
|
},
|
3806
3869
|
},
|
3807
3870
|
},
|
3871
|
+
ComAtprotoSyncListHosts: {
|
3872
|
+
lexicon: 1,
|
3873
|
+
id: 'com.atproto.sync.listHosts',
|
3874
|
+
defs: {
|
3875
|
+
main: {
|
3876
|
+
type: 'query',
|
3877
|
+
description:
|
3878
|
+
'Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays.',
|
3879
|
+
parameters: {
|
3880
|
+
type: 'params',
|
3881
|
+
properties: {
|
3882
|
+
limit: {
|
3883
|
+
type: 'integer',
|
3884
|
+
minimum: 1,
|
3885
|
+
maximum: 1000,
|
3886
|
+
default: 200,
|
3887
|
+
},
|
3888
|
+
cursor: {
|
3889
|
+
type: 'string',
|
3890
|
+
},
|
3891
|
+
},
|
3892
|
+
},
|
3893
|
+
output: {
|
3894
|
+
encoding: 'application/json',
|
3895
|
+
schema: {
|
3896
|
+
type: 'object',
|
3897
|
+
required: ['hosts'],
|
3898
|
+
properties: {
|
3899
|
+
cursor: {
|
3900
|
+
type: 'string',
|
3901
|
+
},
|
3902
|
+
hosts: {
|
3903
|
+
type: 'array',
|
3904
|
+
items: {
|
3905
|
+
type: 'ref',
|
3906
|
+
ref: 'lex:com.atproto.sync.listHosts#host',
|
3907
|
+
},
|
3908
|
+
description:
|
3909
|
+
'Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first.',
|
3910
|
+
},
|
3911
|
+
},
|
3912
|
+
},
|
3913
|
+
},
|
3914
|
+
},
|
3915
|
+
host: {
|
3916
|
+
type: 'object',
|
3917
|
+
required: ['hostname'],
|
3918
|
+
properties: {
|
3919
|
+
hostname: {
|
3920
|
+
type: 'string',
|
3921
|
+
description: 'hostname of server; not a URL (no scheme)',
|
3922
|
+
},
|
3923
|
+
seq: {
|
3924
|
+
type: 'integer',
|
3925
|
+
description:
|
3926
|
+
'Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor).',
|
3927
|
+
},
|
3928
|
+
accountCount: {
|
3929
|
+
type: 'integer',
|
3930
|
+
},
|
3931
|
+
status: {
|
3932
|
+
type: 'ref',
|
3933
|
+
ref: 'lex:com.atproto.sync.defs#hostStatus',
|
3934
|
+
},
|
3935
|
+
},
|
3936
|
+
},
|
3937
|
+
},
|
3938
|
+
},
|
3808
3939
|
ComAtprotoSyncListRepos: {
|
3809
3940
|
lexicon: 1,
|
3810
3941
|
id: 'com.atproto.sync.listRepos',
|
@@ -3992,6 +4123,11 @@ export const schemaDict = {
|
|
3992
4123
|
},
|
3993
4124
|
},
|
3994
4125
|
},
|
4126
|
+
errors: [
|
4127
|
+
{
|
4128
|
+
name: 'HostBanned',
|
4129
|
+
},
|
4130
|
+
],
|
3995
4131
|
},
|
3996
4132
|
},
|
3997
4133
|
},
|
@@ -10928,7 +11064,7 @@ export const schemaDict = {
|
|
10928
11064
|
value: {
|
10929
11065
|
type: 'string',
|
10930
11066
|
minLength: 1,
|
10931
|
-
maxLength:
|
11067
|
+
maxLength: 64,
|
10932
11068
|
minGraphemes: 1,
|
10933
11069
|
maxGraphemes: 1,
|
10934
11070
|
},
|
@@ -11714,7 +11850,7 @@ export const schemaDict = {
|
|
11714
11850
|
value: {
|
11715
11851
|
type: 'string',
|
11716
11852
|
minLength: 1,
|
11717
|
-
maxLength:
|
11853
|
+
maxLength: 64,
|
11718
11854
|
minGraphemes: 1,
|
11719
11855
|
maxGraphemes: 1,
|
11720
11856
|
},
|
@@ -15315,15 +15451,18 @@ export const ids = {
|
|
15315
15451
|
ComAtprotoServerResetPassword: 'com.atproto.server.resetPassword',
|
15316
15452
|
ComAtprotoServerRevokeAppPassword: 'com.atproto.server.revokeAppPassword',
|
15317
15453
|
ComAtprotoServerUpdateEmail: 'com.atproto.server.updateEmail',
|
15454
|
+
ComAtprotoSyncDefs: 'com.atproto.sync.defs',
|
15318
15455
|
ComAtprotoSyncGetBlob: 'com.atproto.sync.getBlob',
|
15319
15456
|
ComAtprotoSyncGetBlocks: 'com.atproto.sync.getBlocks',
|
15320
15457
|
ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout',
|
15321
15458
|
ComAtprotoSyncGetHead: 'com.atproto.sync.getHead',
|
15459
|
+
ComAtprotoSyncGetHostStatus: 'com.atproto.sync.getHostStatus',
|
15322
15460
|
ComAtprotoSyncGetLatestCommit: 'com.atproto.sync.getLatestCommit',
|
15323
15461
|
ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord',
|
15324
15462
|
ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo',
|
15325
15463
|
ComAtprotoSyncGetRepoStatus: 'com.atproto.sync.getRepoStatus',
|
15326
15464
|
ComAtprotoSyncListBlobs: 'com.atproto.sync.listBlobs',
|
15465
|
+
ComAtprotoSyncListHosts: 'com.atproto.sync.listHosts',
|
15327
15466
|
ComAtprotoSyncListRepos: 'com.atproto.sync.listRepos',
|
15328
15467
|
ComAtprotoSyncListReposByCollection: 'com.atproto.sync.listReposByCollection',
|
15329
15468
|
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
5
|
+
import { CID } from 'multiformats/cid'
|
6
|
+
import { validate as _validate } from '../../../../lexicons'
|
7
|
+
import {
|
8
|
+
type $Typed,
|
9
|
+
is$typed as _is$typed,
|
10
|
+
type OmitKey,
|
11
|
+
} from '../../../../util'
|
12
|
+
|
13
|
+
const is$typed = _is$typed,
|
14
|
+
validate = _validate
|
15
|
+
const id = 'com.atproto.sync.defs'
|
16
|
+
|
17
|
+
export type HostStatus =
|
18
|
+
| 'active'
|
19
|
+
| 'idle'
|
20
|
+
| 'offline'
|
21
|
+
| 'throttled'
|
22
|
+
| 'banned'
|
23
|
+
| (string & {})
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import express from 'express'
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
6
|
+
import { CID } from 'multiformats/cid'
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
8
|
+
import {
|
9
|
+
type $Typed,
|
10
|
+
is$typed as _is$typed,
|
11
|
+
type OmitKey,
|
12
|
+
} from '../../../../util'
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
14
|
+
import type * as ComAtprotoSyncDefs from './defs.js'
|
15
|
+
|
16
|
+
const is$typed = _is$typed,
|
17
|
+
validate = _validate
|
18
|
+
const id = 'com.atproto.sync.getHostStatus'
|
19
|
+
|
20
|
+
export interface QueryParams {
|
21
|
+
/** Hostname of the host (eg, PDS or relay) being queried. */
|
22
|
+
hostname: string
|
23
|
+
}
|
24
|
+
|
25
|
+
export type InputSchema = undefined
|
26
|
+
|
27
|
+
export interface OutputSchema {
|
28
|
+
hostname: string
|
29
|
+
/** Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). */
|
30
|
+
seq?: number
|
31
|
+
/** Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. */
|
32
|
+
accountCount?: number
|
33
|
+
status?: ComAtprotoSyncDefs.HostStatus
|
34
|
+
}
|
35
|
+
|
36
|
+
export type HandlerInput = undefined
|
37
|
+
|
38
|
+
export interface HandlerSuccess {
|
39
|
+
encoding: 'application/json'
|
40
|
+
body: OutputSchema
|
41
|
+
headers?: { [key: string]: string }
|
42
|
+
}
|
43
|
+
|
44
|
+
export interface HandlerError {
|
45
|
+
status: number
|
46
|
+
message?: string
|
47
|
+
error?: 'HostNotFound'
|
48
|
+
}
|
49
|
+
|
50
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
51
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
52
|
+
auth: HA
|
53
|
+
params: QueryParams
|
54
|
+
input: HandlerInput
|
55
|
+
req: express.Request
|
56
|
+
res: express.Response
|
57
|
+
resetRouteRateLimits: () => Promise<void>
|
58
|
+
}
|
59
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
60
|
+
ctx: HandlerReqCtx<HA>,
|
61
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import express from 'express'
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
6
|
+
import { CID } from 'multiformats/cid'
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
8
|
+
import {
|
9
|
+
type $Typed,
|
10
|
+
is$typed as _is$typed,
|
11
|
+
type OmitKey,
|
12
|
+
} from '../../../../util'
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
14
|
+
import type * as ComAtprotoSyncDefs from './defs.js'
|
15
|
+
|
16
|
+
const is$typed = _is$typed,
|
17
|
+
validate = _validate
|
18
|
+
const id = 'com.atproto.sync.listHosts'
|
19
|
+
|
20
|
+
export interface QueryParams {
|
21
|
+
limit: number
|
22
|
+
cursor?: string
|
23
|
+
}
|
24
|
+
|
25
|
+
export type InputSchema = undefined
|
26
|
+
|
27
|
+
export interface OutputSchema {
|
28
|
+
cursor?: string
|
29
|
+
/** Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first. */
|
30
|
+
hosts: Host[]
|
31
|
+
}
|
32
|
+
|
33
|
+
export type HandlerInput = undefined
|
34
|
+
|
35
|
+
export interface HandlerSuccess {
|
36
|
+
encoding: 'application/json'
|
37
|
+
body: OutputSchema
|
38
|
+
headers?: { [key: string]: string }
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface HandlerError {
|
42
|
+
status: number
|
43
|
+
message?: string
|
44
|
+
}
|
45
|
+
|
46
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
47
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
48
|
+
auth: HA
|
49
|
+
params: QueryParams
|
50
|
+
input: HandlerInput
|
51
|
+
req: express.Request
|
52
|
+
res: express.Response
|
53
|
+
resetRouteRateLimits: () => Promise<void>
|
54
|
+
}
|
55
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
56
|
+
ctx: HandlerReqCtx<HA>,
|
57
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
58
|
+
|
59
|
+
export interface Host {
|
60
|
+
$type?: 'com.atproto.sync.listHosts#host'
|
61
|
+
/** hostname of server; not a URL (no scheme) */
|
62
|
+
hostname: string
|
63
|
+
/** Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). */
|
64
|
+
seq?: number
|
65
|
+
accountCount?: number
|
66
|
+
status?: ComAtprotoSyncDefs.HostStatus
|
67
|
+
}
|
68
|
+
|
69
|
+
const hashHost = 'host'
|
70
|
+
|
71
|
+
export function isHost<V>(v: V) {
|
72
|
+
return is$typed(v, id, hashHost)
|
73
|
+
}
|
74
|
+
|
75
|
+
export function validateHost<V>(v: V) {
|
76
|
+
return validate<Host & V>(v, id, hashHost)
|
77
|
+
}
|
@@ -6,12 +6,12 @@
|
|
6
6
|
<title>PLC update requested</title>
|
7
7
|
<meta
|
8
8
|
name="description"
|
9
|
-
content="We
|
9
|
+
content="We received a request to update your PLC."
|
10
10
|
/>
|
11
11
|
</head>
|
12
12
|
<div
|
13
13
|
style="display:none;overflow:hidden;line-height:1px;opacity:0;max-height:0;max-width:0"
|
14
|
-
>We
|
14
|
+
>We received a request to update your PLC.<div
|
15
15
|
> </div>
|
16
16
|
</div>
|
17
17
|
|
package/tests/db.test.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { TestNetworkNoAppView } from '@atproto/dev-env'
|
2
|
-
|
2
|
+
// Importing from `dist` to circumvent circular dependency typing issues
|
3
|
+
import { AccountDb } from '../dist/account-manager/db'
|
3
4
|
|
4
5
|
describe('db', () => {
|
5
6
|
let network: TestNetworkNoAppView
|