@atproto/bsky 0.0.148 → 0.0.149
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 +7 -0
- package/LICENSE.txt +1 -1
- package/dist/api/app/bsky/unspecced/getConfig.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getConfig.js +1 -0
- package/dist/api/app/bsky/unspecced/getConfig.js.map +1 -1
- package/dist/api/well-known.d.ts.map +1 -1
- package/dist/api/well-known.js +4 -1
- package/dist/api/well-known.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -1
- package/dist/lexicon/index.d.ts +2 -2
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -4
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +128 -82
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +65 -42
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getConfig.d.ts +9 -0
- package/dist/lexicon/types/app/bsky/unspecced/getConfig.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getConfig.js +9 -0
- package/dist/lexicon/types/app/bsky/unspecced/getConfig.js.map +1 -1
- package/package.json +4 -4
- package/src/api/app/bsky/unspecced/getConfig.ts +1 -0
- package/src/api/well-known.ts +4 -1
- package/src/config.ts +39 -0
- package/src/lexicon/index.ts +9 -9
- package/src/lexicon/lexicons.ts +66 -43
- package/src/lexicon/types/app/bsky/unspecced/getConfig.ts +17 -0
- package/tests/views/get-config.test.ts +66 -0
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
4
|
import express from 'express';
|
|
5
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
|
5
6
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
7
|
export interface QueryParams {
|
|
7
8
|
}
|
|
8
9
|
export type InputSchema = undefined;
|
|
9
10
|
export interface OutputSchema {
|
|
10
11
|
checkEmailConfirmed?: boolean;
|
|
12
|
+
liveNow?: LiveNowConfig[];
|
|
11
13
|
}
|
|
12
14
|
export type HandlerInput = undefined;
|
|
13
15
|
export interface HandlerSuccess {
|
|
@@ -31,4 +33,11 @@ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
|
31
33
|
resetRouteRateLimits: () => Promise<void>;
|
|
32
34
|
};
|
|
33
35
|
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
36
|
+
export interface LiveNowConfig {
|
|
37
|
+
$type?: 'app.bsky.unspecced.getConfig#liveNowConfig';
|
|
38
|
+
did: string;
|
|
39
|
+
domains: string[];
|
|
40
|
+
}
|
|
41
|
+
export declare function isLiveNowConfig<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.unspecced.getConfig", "liveNowConfig">;
|
|
42
|
+
export declare function validateLiveNowConfig<V>(v: V): ValidationResult<LiveNowConfig & V>;
|
|
34
43
|
//# sourceMappingURL=getConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAQjE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAMtE,MAAM,WAAW,WAAW;CAAG;AAE/B,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;IACrB,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA;AAE3C,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,4CAA4C,CAAA;IACpD,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAID,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,oGAEtC;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,uCAE5C"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLiveNowConfig = isLiveNowConfig;
|
|
4
|
+
exports.validateLiveNowConfig = validateLiveNowConfig;
|
|
3
5
|
const lexicons_1 = require("../../../../lexicons");
|
|
4
6
|
const util_1 = require("../../../../util");
|
|
5
7
|
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
6
8
|
const id = 'app.bsky.unspecced.getConfig';
|
|
9
|
+
const hashLiveNowConfig = 'liveNowConfig';
|
|
10
|
+
function isLiveNowConfig(v) {
|
|
11
|
+
return is$typed(v, id, hashLiveNowConfig);
|
|
12
|
+
}
|
|
13
|
+
function validateLiveNowConfig(v) {
|
|
14
|
+
return validate(v, id, hashLiveNowConfig);
|
|
15
|
+
}
|
|
7
16
|
//# sourceMappingURL=getConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getConfig.ts"],"names":[],"mappings":";;AA6DA,0CAEC;AAED,sDAEC;AA7DD,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8BAA8B,CAAA;AA2CzC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAEzC,SAAgB,eAAe,CAAI,CAAI;IACrC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC3C,CAAC;AAED,SAAgB,qBAAqB,CAAI,CAAI;IAC3C,OAAO,QAAQ,CAAoB,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC9D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.149",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"undici": "^6.19.8",
|
|
50
50
|
"@atproto-labs/fetch-node": "0.1.8",
|
|
51
51
|
"@atproto-labs/xrpc-utils": "0.0.14",
|
|
52
|
-
"@atproto/api": "^0.15.
|
|
52
|
+
"@atproto/api": "^0.15.7",
|
|
53
53
|
"@atproto/common": "^0.4.11",
|
|
54
54
|
"@atproto/crypto": "^0.4.4",
|
|
55
55
|
"@atproto/did": "^0.1.5",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"jest": "^28.1.2",
|
|
74
74
|
"ts-node": "^10.8.2",
|
|
75
75
|
"typescript": "^5.6.3",
|
|
76
|
-
"@atproto/api": "^0.15.
|
|
76
|
+
"@atproto/api": "^0.15.7",
|
|
77
77
|
"@atproto/lex-cli": "^0.8.1",
|
|
78
|
-
"@atproto/pds": "^0.4.
|
|
78
|
+
"@atproto/pds": "^0.4.137",
|
|
79
79
|
"@atproto/xrpc": "^0.7.0"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
package/src/api/well-known.ts
CHANGED
|
@@ -11,7 +11,10 @@ export const createRouter = (ctx: AppContext): Router => {
|
|
|
11
11
|
|
|
12
12
|
router.get('/.well-known/did.json', (_req, res) => {
|
|
13
13
|
res.json({
|
|
14
|
-
'@context': [
|
|
14
|
+
'@context': [
|
|
15
|
+
'https://www.w3.org/ns/did/v1',
|
|
16
|
+
'https://w3id.org/security/multikey/v1',
|
|
17
|
+
],
|
|
15
18
|
id: did,
|
|
16
19
|
verificationMethod: [
|
|
17
20
|
{
|
package/src/config.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
|
+
import { subLogger as log } from './logger'
|
|
3
|
+
|
|
4
|
+
type LiveNowConfig = {
|
|
5
|
+
did: string
|
|
6
|
+
domains: string[]
|
|
7
|
+
}[]
|
|
2
8
|
|
|
3
9
|
export interface ServerConfigValues {
|
|
4
10
|
// service
|
|
@@ -9,6 +15,7 @@ export interface ServerConfigValues {
|
|
|
9
15
|
serverDid: string
|
|
10
16
|
alternateAudienceDids: string[]
|
|
11
17
|
entrywayJwtPublicKeyHex?: string
|
|
18
|
+
liveNowConfig?: LiveNowConfig
|
|
12
19
|
// external services
|
|
13
20
|
etcdHosts: string[]
|
|
14
21
|
dataplaneUrls: string[]
|
|
@@ -81,6 +88,19 @@ export class ServerConfig {
|
|
|
81
88
|
const alternateAudienceDids = envList(process.env.BSKY_ALT_AUDIENCE_DIDS)
|
|
82
89
|
const entrywayJwtPublicKeyHex =
|
|
83
90
|
process.env.BSKY_ENTRYWAY_JWT_PUBLIC_KEY_HEX || undefined
|
|
91
|
+
let liveNowConfig: LiveNowConfig | undefined
|
|
92
|
+
if (process.env.BSKY_LIVE_NOW_CONFIG) {
|
|
93
|
+
try {
|
|
94
|
+
const parsed = JSON.parse(process.env.BSKY_LIVE_NOW_CONFIG)
|
|
95
|
+
if (isLiveNowConfig(parsed)) {
|
|
96
|
+
liveNowConfig = parsed
|
|
97
|
+
} else {
|
|
98
|
+
throw new Error('Live Now config failed format validation')
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
log.error({ err }, 'Invalid BSKY_LIVE_NOW_CONFIG')
|
|
102
|
+
}
|
|
103
|
+
}
|
|
84
104
|
const handleResolveNameservers = envList(
|
|
85
105
|
process.env.BSKY_HANDLE_RESOLVE_NAMESERVERS,
|
|
86
106
|
)
|
|
@@ -200,6 +220,7 @@ export class ServerConfig {
|
|
|
200
220
|
serverDid,
|
|
201
221
|
alternateAudienceDids,
|
|
202
222
|
entrywayJwtPublicKeyHex,
|
|
223
|
+
liveNowConfig,
|
|
203
224
|
etcdHosts,
|
|
204
225
|
dataplaneUrls,
|
|
205
226
|
dataplaneUrlsEtcdKeyPrefix,
|
|
@@ -285,6 +306,10 @@ export class ServerConfig {
|
|
|
285
306
|
return this.cfg.entrywayJwtPublicKeyHex
|
|
286
307
|
}
|
|
287
308
|
|
|
309
|
+
get liveNowConfig() {
|
|
310
|
+
return this.cfg.liveNowConfig
|
|
311
|
+
}
|
|
312
|
+
|
|
288
313
|
get etcdHosts() {
|
|
289
314
|
return this.cfg.etcdHosts
|
|
290
315
|
}
|
|
@@ -482,3 +507,17 @@ function envList(str: string | undefined): string[] {
|
|
|
482
507
|
if (str === undefined || str.length === 0) return []
|
|
483
508
|
return str.split(',')
|
|
484
509
|
}
|
|
510
|
+
|
|
511
|
+
function isLiveNowConfig(data: any): data is LiveNowConfig {
|
|
512
|
+
return (
|
|
513
|
+
Array.isArray(data) &&
|
|
514
|
+
data.every(
|
|
515
|
+
(item) =>
|
|
516
|
+
typeof item === 'object' &&
|
|
517
|
+
item !== null &&
|
|
518
|
+
typeof item.did === 'string' &&
|
|
519
|
+
Array.isArray(item.domains) &&
|
|
520
|
+
item.domains.every((domain: any) => typeof domain === 'string'),
|
|
521
|
+
)
|
|
522
|
+
)
|
|
523
|
+
}
|
package/src/lexicon/index.ts
CHANGED
|
@@ -108,8 +108,8 @@ import * as AppBskyFeedGetFeedGenerators from './types/app/bsky/feed/getFeedGene
|
|
|
108
108
|
import * as AppBskyFeedGetFeedSkeleton from './types/app/bsky/feed/getFeedSkeleton.js'
|
|
109
109
|
import * as AppBskyFeedGetLikes from './types/app/bsky/feed/getLikes.js'
|
|
110
110
|
import * as AppBskyFeedGetListFeed from './types/app/bsky/feed/getListFeed.js'
|
|
111
|
-
import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
|
|
112
111
|
import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
|
|
112
|
+
import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
|
|
113
113
|
import * as AppBskyFeedGetQuotes from './types/app/bsky/feed/getQuotes.js'
|
|
114
114
|
import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy.js'
|
|
115
115
|
import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds.js'
|
|
@@ -1497,25 +1497,25 @@ export class AppBskyFeedNS {
|
|
|
1497
1497
|
return this._server.xrpc.method(nsid, cfg)
|
|
1498
1498
|
}
|
|
1499
1499
|
|
|
1500
|
-
|
|
1500
|
+
getPosts<AV extends AuthVerifier>(
|
|
1501
1501
|
cfg: ConfigOf<
|
|
1502
1502
|
AV,
|
|
1503
|
-
|
|
1504
|
-
|
|
1503
|
+
AppBskyFeedGetPosts.Handler<ExtractAuth<AV>>,
|
|
1504
|
+
AppBskyFeedGetPosts.HandlerReqCtx<ExtractAuth<AV>>
|
|
1505
1505
|
>,
|
|
1506
1506
|
) {
|
|
1507
|
-
const nsid = 'app.bsky.feed.
|
|
1507
|
+
const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
|
|
1508
1508
|
return this._server.xrpc.method(nsid, cfg)
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
|
-
|
|
1511
|
+
getPostThread<AV extends AuthVerifier>(
|
|
1512
1512
|
cfg: ConfigOf<
|
|
1513
1513
|
AV,
|
|
1514
|
-
|
|
1515
|
-
|
|
1514
|
+
AppBskyFeedGetPostThread.Handler<ExtractAuth<AV>>,
|
|
1515
|
+
AppBskyFeedGetPostThread.HandlerReqCtx<ExtractAuth<AV>>
|
|
1516
1516
|
>,
|
|
1517
1517
|
) {
|
|
1518
|
-
const nsid = 'app.bsky.feed.
|
|
1518
|
+
const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
|
|
1519
1519
|
return this._server.xrpc.method(nsid, cfg)
|
|
1520
1520
|
}
|
|
1521
1521
|
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -7213,6 +7213,48 @@ export const schemaDict = {
|
|
|
7213
7213
|
},
|
|
7214
7214
|
},
|
|
7215
7215
|
},
|
|
7216
|
+
AppBskyFeedGetPosts: {
|
|
7217
|
+
lexicon: 1,
|
|
7218
|
+
id: 'app.bsky.feed.getPosts',
|
|
7219
|
+
defs: {
|
|
7220
|
+
main: {
|
|
7221
|
+
type: 'query',
|
|
7222
|
+
description:
|
|
7223
|
+
"Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
|
|
7224
|
+
parameters: {
|
|
7225
|
+
type: 'params',
|
|
7226
|
+
required: ['uris'],
|
|
7227
|
+
properties: {
|
|
7228
|
+
uris: {
|
|
7229
|
+
type: 'array',
|
|
7230
|
+
description: 'List of post AT-URIs to return hydrated views for.',
|
|
7231
|
+
items: {
|
|
7232
|
+
type: 'string',
|
|
7233
|
+
format: 'at-uri',
|
|
7234
|
+
},
|
|
7235
|
+
maxLength: 25,
|
|
7236
|
+
},
|
|
7237
|
+
},
|
|
7238
|
+
},
|
|
7239
|
+
output: {
|
|
7240
|
+
encoding: 'application/json',
|
|
7241
|
+
schema: {
|
|
7242
|
+
type: 'object',
|
|
7243
|
+
required: ['posts'],
|
|
7244
|
+
properties: {
|
|
7245
|
+
posts: {
|
|
7246
|
+
type: 'array',
|
|
7247
|
+
items: {
|
|
7248
|
+
type: 'ref',
|
|
7249
|
+
ref: 'lex:app.bsky.feed.defs#postView',
|
|
7250
|
+
},
|
|
7251
|
+
},
|
|
7252
|
+
},
|
|
7253
|
+
},
|
|
7254
|
+
},
|
|
7255
|
+
},
|
|
7256
|
+
},
|
|
7257
|
+
},
|
|
7216
7258
|
AppBskyFeedGetPostThread: {
|
|
7217
7259
|
lexicon: 1,
|
|
7218
7260
|
id: 'app.bsky.feed.getPostThread',
|
|
@@ -7277,48 +7319,6 @@ export const schemaDict = {
|
|
|
7277
7319
|
},
|
|
7278
7320
|
},
|
|
7279
7321
|
},
|
|
7280
|
-
AppBskyFeedGetPosts: {
|
|
7281
|
-
lexicon: 1,
|
|
7282
|
-
id: 'app.bsky.feed.getPosts',
|
|
7283
|
-
defs: {
|
|
7284
|
-
main: {
|
|
7285
|
-
type: 'query',
|
|
7286
|
-
description:
|
|
7287
|
-
"Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
|
|
7288
|
-
parameters: {
|
|
7289
|
-
type: 'params',
|
|
7290
|
-
required: ['uris'],
|
|
7291
|
-
properties: {
|
|
7292
|
-
uris: {
|
|
7293
|
-
type: 'array',
|
|
7294
|
-
description: 'List of post AT-URIs to return hydrated views for.',
|
|
7295
|
-
items: {
|
|
7296
|
-
type: 'string',
|
|
7297
|
-
format: 'at-uri',
|
|
7298
|
-
},
|
|
7299
|
-
maxLength: 25,
|
|
7300
|
-
},
|
|
7301
|
-
},
|
|
7302
|
-
},
|
|
7303
|
-
output: {
|
|
7304
|
-
encoding: 'application/json',
|
|
7305
|
-
schema: {
|
|
7306
|
-
type: 'object',
|
|
7307
|
-
required: ['posts'],
|
|
7308
|
-
properties: {
|
|
7309
|
-
posts: {
|
|
7310
|
-
type: 'array',
|
|
7311
|
-
items: {
|
|
7312
|
-
type: 'ref',
|
|
7313
|
-
ref: 'lex:app.bsky.feed.defs#postView',
|
|
7314
|
-
},
|
|
7315
|
-
},
|
|
7316
|
-
},
|
|
7317
|
-
},
|
|
7318
|
-
},
|
|
7319
|
-
},
|
|
7320
|
-
},
|
|
7321
|
-
},
|
|
7322
7322
|
AppBskyFeedGetQuotes: {
|
|
7323
7323
|
lexicon: 1,
|
|
7324
7324
|
id: 'app.bsky.feed.getQuotes',
|
|
@@ -10183,6 +10183,29 @@ export const schemaDict = {
|
|
|
10183
10183
|
checkEmailConfirmed: {
|
|
10184
10184
|
type: 'boolean',
|
|
10185
10185
|
},
|
|
10186
|
+
liveNow: {
|
|
10187
|
+
type: 'array',
|
|
10188
|
+
items: {
|
|
10189
|
+
type: 'ref',
|
|
10190
|
+
ref: 'lex:app.bsky.unspecced.getConfig#liveNowConfig',
|
|
10191
|
+
},
|
|
10192
|
+
},
|
|
10193
|
+
},
|
|
10194
|
+
},
|
|
10195
|
+
},
|
|
10196
|
+
},
|
|
10197
|
+
liveNowConfig: {
|
|
10198
|
+
type: 'object',
|
|
10199
|
+
required: ['did', 'domains'],
|
|
10200
|
+
properties: {
|
|
10201
|
+
did: {
|
|
10202
|
+
type: 'string',
|
|
10203
|
+
format: 'did',
|
|
10204
|
+
},
|
|
10205
|
+
domains: {
|
|
10206
|
+
type: 'array',
|
|
10207
|
+
items: {
|
|
10208
|
+
type: 'string',
|
|
10186
10209
|
},
|
|
10187
10210
|
},
|
|
10188
10211
|
},
|
|
@@ -12600,8 +12623,8 @@ export const ids = {
|
|
|
12600
12623
|
AppBskyFeedGetFeedSkeleton: 'app.bsky.feed.getFeedSkeleton',
|
|
12601
12624
|
AppBskyFeedGetLikes: 'app.bsky.feed.getLikes',
|
|
12602
12625
|
AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
|
|
12603
|
-
AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
|
|
12604
12626
|
AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
|
|
12627
|
+
AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
|
|
12605
12628
|
AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
|
|
12606
12629
|
AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
|
|
12607
12630
|
AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
|
|
@@ -22,6 +22,7 @@ export type InputSchema = undefined
|
|
|
22
22
|
|
|
23
23
|
export interface OutputSchema {
|
|
24
24
|
checkEmailConfirmed?: boolean
|
|
25
|
+
liveNow?: LiveNowConfig[]
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export type HandlerInput = undefined
|
|
@@ -49,3 +50,19 @@ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
|
49
50
|
export type Handler<HA extends HandlerAuth = never> = (
|
|
50
51
|
ctx: HandlerReqCtx<HA>,
|
|
51
52
|
) => Promise<HandlerOutput> | HandlerOutput
|
|
53
|
+
|
|
54
|
+
export interface LiveNowConfig {
|
|
55
|
+
$type?: 'app.bsky.unspecced.getConfig#liveNowConfig'
|
|
56
|
+
did: string
|
|
57
|
+
domains: string[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const hashLiveNowConfig = 'liveNowConfig'
|
|
61
|
+
|
|
62
|
+
export function isLiveNowConfig<V>(v: V) {
|
|
63
|
+
return is$typed(v, id, hashLiveNowConfig)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function validateLiveNowConfig<V>(v: V) {
|
|
67
|
+
return validate<LiveNowConfig & V>(v, id, hashLiveNowConfig)
|
|
68
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import AtpAgent from '@atproto/api'
|
|
2
|
+
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
+
|
|
4
|
+
describe('get config', () => {
|
|
5
|
+
describe('when live now is NOT configured', () => {
|
|
6
|
+
let network: TestNetwork
|
|
7
|
+
let agent: AtpAgent
|
|
8
|
+
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
network = await TestNetwork.create({
|
|
11
|
+
dbPostgresSchema: 'bsky_tests_live_now_config_off',
|
|
12
|
+
})
|
|
13
|
+
agent = network.bsky.getClient()
|
|
14
|
+
|
|
15
|
+
await network.processAll()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
afterAll(async () => {
|
|
19
|
+
await network.close()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('omits the live now config', async () => {
|
|
23
|
+
const res = await agent.app.bsky.unspecced.getConfig()
|
|
24
|
+
|
|
25
|
+
expect(res.data).not.toHaveProperty('liveNow')
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('when live now is configured', () => {
|
|
30
|
+
const liveNowConfig = [
|
|
31
|
+
{
|
|
32
|
+
did: 'did:plc:asdf123',
|
|
33
|
+
domains: ['example.com', 'atproto.com'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
did: 'did:plc:sdfg234',
|
|
37
|
+
domains: ['example.com'],
|
|
38
|
+
},
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
let network: TestNetwork
|
|
42
|
+
let agent: AtpAgent
|
|
43
|
+
|
|
44
|
+
beforeAll(async () => {
|
|
45
|
+
network = await TestNetwork.create({
|
|
46
|
+
dbPostgresSchema: 'bsky_tests_live_now_config_on',
|
|
47
|
+
bsky: {
|
|
48
|
+
liveNowConfig,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
agent = network.bsky.getClient()
|
|
52
|
+
|
|
53
|
+
await network.processAll()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
afterAll(async () => {
|
|
57
|
+
await network.close()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it(`returns the config`, async () => {
|
|
61
|
+
const res = await agent.app.bsky.unspecced.getConfig()
|
|
62
|
+
|
|
63
|
+
expect(res.data.liveNow).toEqual(liveNowConfig)
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./tests/_util.ts","./tests/auth.test.ts","./tests/blob-resolver.test.ts","./tests/entryway-auth.test.ts","./tests/etcd.test.ts","./tests/feed-generation.test.ts","./tests/label-hydration.test.ts","./tests/postgates.test.ts","./tests/query-labels.test.ts","./tests/redis-cache.test.ts","./tests/server.test.ts","./tests/admin/admin-auth.test.ts","./tests/admin/moderation.test.ts","./tests/data-plane/db.test.ts","./tests/data-plane/duplicate-records.test.ts","./tests/data-plane/handle-invalidation.test.ts","./tests/data-plane/indexing.test.ts","./tests/data-plane/subscription.test.ts","./tests/data-plane/thread-mutes.test.ts","./tests/hydration/util.test.ts","./tests/image/server.test.ts","./tests/image/sharp.test.ts","./tests/image/uri.test.ts","./tests/seed/feed-hidden-replies.ts","./tests/seed/get-suggested-starter-packs.ts","./tests/seed/get-trends.ts","./tests/seed/known-followers.ts","./tests/seed/postgates.ts","./tests/views/account-deactivation.test.ts","./tests/views/actor-likes.test.ts","./tests/views/actor-search.test.ts","./tests/views/author-feed.test.ts","./tests/views/block-lists.test.ts","./tests/views/blocks.test.ts","./tests/views/feed-hidden-replies.test.ts","./tests/views/feed-view-post.test.ts","./tests/views/follows.test.ts","./tests/views/get-suggested-starter-packs.test.ts","./tests/views/get-trends.test.ts","./tests/views/known-followers.test.ts","./tests/views/labeler-service.test.ts","./tests/views/labels-needs-review.test.ts","./tests/views/labels-takedown.test.ts","./tests/views/likes.test.ts","./tests/views/list-feed.test.ts","./tests/views/lists.test.ts","./tests/views/mute-lists.test.ts","./tests/views/mutes.test.ts","./tests/views/notifications.test.ts","./tests/views/posts.test.ts","./tests/views/profile.test.ts","./tests/views/quotes.test.ts","./tests/views/reposts.test.ts","./tests/views/starter-packs.test.ts","./tests/views/suggested-follows.test.ts","./tests/views/suggestions.test.ts","./tests/views/thread.test.ts","./tests/views/threadgating.test.ts","./tests/views/timeline.test.ts","./tests/views/verification.test.ts"],"version":"5.8.2"}
|
|
1
|
+
{"root":["./tests/_util.ts","./tests/auth.test.ts","./tests/blob-resolver.test.ts","./tests/entryway-auth.test.ts","./tests/etcd.test.ts","./tests/feed-generation.test.ts","./tests/label-hydration.test.ts","./tests/postgates.test.ts","./tests/query-labels.test.ts","./tests/redis-cache.test.ts","./tests/server.test.ts","./tests/admin/admin-auth.test.ts","./tests/admin/moderation.test.ts","./tests/data-plane/db.test.ts","./tests/data-plane/duplicate-records.test.ts","./tests/data-plane/handle-invalidation.test.ts","./tests/data-plane/indexing.test.ts","./tests/data-plane/subscription.test.ts","./tests/data-plane/thread-mutes.test.ts","./tests/hydration/util.test.ts","./tests/image/server.test.ts","./tests/image/sharp.test.ts","./tests/image/uri.test.ts","./tests/seed/feed-hidden-replies.ts","./tests/seed/get-suggested-starter-packs.ts","./tests/seed/get-trends.ts","./tests/seed/known-followers.ts","./tests/seed/postgates.ts","./tests/views/account-deactivation.test.ts","./tests/views/actor-likes.test.ts","./tests/views/actor-search.test.ts","./tests/views/author-feed.test.ts","./tests/views/block-lists.test.ts","./tests/views/blocks.test.ts","./tests/views/feed-hidden-replies.test.ts","./tests/views/feed-view-post.test.ts","./tests/views/follows.test.ts","./tests/views/get-config.test.ts","./tests/views/get-suggested-starter-packs.test.ts","./tests/views/get-trends.test.ts","./tests/views/known-followers.test.ts","./tests/views/labeler-service.test.ts","./tests/views/labels-needs-review.test.ts","./tests/views/labels-takedown.test.ts","./tests/views/likes.test.ts","./tests/views/list-feed.test.ts","./tests/views/lists.test.ts","./tests/views/mute-lists.test.ts","./tests/views/mutes.test.ts","./tests/views/notifications.test.ts","./tests/views/posts.test.ts","./tests/views/profile.test.ts","./tests/views/quotes.test.ts","./tests/views/reposts.test.ts","./tests/views/starter-packs.test.ts","./tests/views/suggested-follows.test.ts","./tests/views/suggestions.test.ts","./tests/views/thread.test.ts","./tests/views/threadgating.test.ts","./tests/views/timeline.test.ts","./tests/views/verification.test.ts"],"version":"5.8.2"}
|