@atproto/bsky 0.0.97 → 0.0.99
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 +22 -0
- package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js +6 -2
- package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
- package/dist/api/app/bsky/notification/listNotifications.js +45 -3
- package/dist/api/app/bsky/notification/listNotifications.js.map +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/app/bsky/unspecced/getTrendingTopics.d.ts +4 -0
- package/dist/api/app/bsky/unspecced/getTrendingTopics.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/getTrendingTopics.js +51 -0
- package/dist/api/app/bsky/unspecced/getTrendingTopics.js.map +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -0
- package/dist/context.js.map +1 -1
- package/dist/hydration/actor.d.ts.map +1 -1
- package/dist/hydration/actor.js +6 -6
- package/dist/hydration/actor.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +2 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +150 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +76 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts +9 -0
- package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/defs.js +10 -0
- package/dist/lexicon/types/app/bsky/unspecced/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getTrendingTopics.d.ts +39 -0
- package/dist/lexicon/types/app/bsky/unspecced/getTrendingTopics.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/getTrendingTopics.js +3 -0
- package/dist/lexicon/types/app/bsky/unspecced/getTrendingTopics.js.map +1 -0
- package/package.json +11 -11
- package/src/api/app/bsky/actor/getProfiles.ts +6 -2
- package/src/api/app/bsky/notification/listNotifications.ts +57 -3
- package/src/api/app/bsky/unspecced/getConfig.ts +1 -0
- package/src/api/app/bsky/unspecced/getTrendingTopics.ts +97 -0
- package/src/api/index.ts +2 -0
- package/src/config.ts +21 -0
- package/src/context.ts +5 -0
- package/src/hydration/actor.ts +9 -9
- package/src/index.ts +11 -0
- package/src/lexicon/index.ts +12 -0
- package/src/lexicon/lexicons.ts +78 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +2 -0
- package/src/lexicon/types/app/bsky/unspecced/defs.ts +20 -0
- package/src/lexicon/types/app/bsky/unspecced/getTrendingTopics.ts +49 -0
- package/tests/views/__snapshots__/notifications.test.ts.snap +257 -0
- package/tests/views/notifications.test.ts +78 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -7,6 +7,8 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
|
7
7
|
import * as AppBskyActorDefs from '../actor/defs';
|
|
8
8
|
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs';
|
|
9
9
|
export interface QueryParams {
|
|
10
|
+
/** Notification reasons to include in response. */
|
|
11
|
+
reasons?: string[];
|
|
10
12
|
limit: number;
|
|
11
13
|
priority?: boolean;
|
|
12
14
|
cursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listNotifications.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAI5D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,gBAAgB,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAA;AAEtE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;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,CAA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S,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;CACtB,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,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,gBAAgB,CAAC,WAAW,CAAA;IACpC,6GAA6G;IAC7G,MAAM,EACF,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,oBAAoB,GACpB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,EAAE,CAAA;IACV,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,CAAA;IACpC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAM5D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAKjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listNotifications.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"listNotifications.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":";;AA8EA,wCAMC;AAED,oDAKC;AAtFD,mDAA+C;AAC/C,2CAAiD;AAwEjD,SAAgB,cAAc,CAAC,CAAU;IACvC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,sDAAsD,CACnE,CAAA;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,mBAAQ,CAAC,QAAQ,CACtB,sDAAsD,EACtD,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -20,4 +20,13 @@ export interface SkeletonSearchStarterPack {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function isSkeletonSearchStarterPack(v: unknown): v is SkeletonSearchStarterPack;
|
|
22
22
|
export declare function validateSkeletonSearchStarterPack(v: unknown): ValidationResult;
|
|
23
|
+
export interface TrendingTopic {
|
|
24
|
+
topic: string;
|
|
25
|
+
displayName?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
link: string;
|
|
28
|
+
[k: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export declare function isTrendingTopic(v: unknown): v is TrendingTopic;
|
|
31
|
+
export declare function validateTrendingTopic(v: unknown): ValidationResult;
|
|
23
32
|
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAK5D,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,kBAAkB,CAMxE;AAED,wB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G,gBAAgB,CAExE;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAA;IACX,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI,yBAAyB,CAMhC;AAED,wBAAgB,iCAAiC,CAC/C,CAAC,EAAE,OAAO,GACT,gBAAgB,CAKlB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAM9D;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAElE"}
|
|
@@ -6,6 +6,8 @@ exports.isSkeletonSearchActor = isSkeletonSearchActor;
|
|
|
6
6
|
exports.validateSkeletonSearchActor = validateSkeletonSearchActor;
|
|
7
7
|
exports.isSkeletonSearchStarterPack = isSkeletonSearchStarterPack;
|
|
8
8
|
exports.validateSkeletonSearchStarterPack = validateSkeletonSearchStarterPack;
|
|
9
|
+
exports.isTrendingTopic = isTrendingTopic;
|
|
10
|
+
exports.validateTrendingTopic = validateTrendingTopic;
|
|
9
11
|
const lexicons_1 = require("../../../../lexicons");
|
|
10
12
|
const util_1 = require("../../../../util");
|
|
11
13
|
function isSkeletonSearchPost(v) {
|
|
@@ -32,4 +34,12 @@ function isSkeletonSearchStarterPack(v) {
|
|
|
32
34
|
function validateSkeletonSearchStarterPack(v) {
|
|
33
35
|
return lexicons_1.lexicons.validate('app.bsky.unspecced.defs#skeletonSearchStarterPack', v);
|
|
34
36
|
}
|
|
37
|
+
function isTrendingTopic(v) {
|
|
38
|
+
return ((0, util_1.isObj)(v) &&
|
|
39
|
+
(0, util_1.hasProp)(v, '$type') &&
|
|
40
|
+
v.$type === 'app.bsky.unspecced.defs#trendingTopic');
|
|
41
|
+
}
|
|
42
|
+
function validateTrendingTopic(v) {
|
|
43
|
+
return lexicons_1.lexicons.validate('app.bsky.unspecced.defs#trendingTopic', v);
|
|
44
|
+
}
|
|
35
45
|
//# sourceMappingURL=defs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/defs.ts"],"names":[],"mappings":";;AAaA,oDAMC;AAED,gEAEC;AAOD,sDAMC;AAED,kEAEC;AAOD,kEAQC;AAED,8EAOC;
|
|
1
|
+
{"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/defs.ts"],"names":[],"mappings":";;AAaA,oDAMC;AAED,gEAEC;AAOD,sDAMC;AAED,kEAEC;AAOD,kEAQC;AAED,8EAOC;AAUD,0CAMC;AAED,sDAEC;AAhFD,mDAA+C;AAC/C,2CAAiD;AAQjD,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,4CAA4C,CACzD,CAAA;AACH,CAAC;AAED,SAAgB,0BAA0B,CAAC,CAAU;IACnD,OAAO,mBAAQ,CAAC,QAAQ,CAAC,4CAA4C,EAAE,CAAC,CAAC,CAAA;AAC3E,CAAC;AAOD,SAAgB,qBAAqB,CAAC,CAAU;IAC9C,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,6CAA6C,CAC1D,CAAA;AACH,CAAC;AAED,SAAgB,2BAA2B,CAAC,CAAU;IACpD,OAAO,mBAAQ,CAAC,QAAQ,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAA;AAC5E,CAAC;AAOD,SAAgB,2BAA2B,CACzC,CAAU;IAEV,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,mDAAmD,CAChE,CAAA;AACH,CAAC;AAED,SAAgB,iCAAiC,CAC/C,CAAU;IAEV,OAAO,mBAAQ,CAAC,QAAQ,CACtB,mDAAmD,EACnD,CAAC,CACF,CAAA;AACH,CAAC;AAUD,SAAgB,eAAe,CAAC,CAAU;IACxC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,uCAAuC,CACpD,CAAA;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,CAAU;IAC9C,OAAO,mBAAQ,CAAC,QAAQ,CAAC,uCAAuC,EAAE,CAAC,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
|
+
import * as AppBskyUnspeccedDefs from './defs';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
/** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */
|
|
9
|
+
viewer?: string;
|
|
10
|
+
limit: number;
|
|
11
|
+
}
|
|
12
|
+
export type InputSchema = undefined;
|
|
13
|
+
export interface OutputSchema {
|
|
14
|
+
topics: AppBskyUnspeccedDefs.TrendingTopic[];
|
|
15
|
+
suggested: AppBskyUnspeccedDefs.TrendingTopic[];
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export type HandlerInput = undefined;
|
|
19
|
+
export interface HandlerSuccess {
|
|
20
|
+
encoding: 'application/json';
|
|
21
|
+
body: OutputSchema;
|
|
22
|
+
headers?: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number;
|
|
28
|
+
message?: string;
|
|
29
|
+
}
|
|
30
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
31
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
32
|
+
auth: HA;
|
|
33
|
+
params: QueryParams;
|
|
34
|
+
input: HandlerInput;
|
|
35
|
+
req: express.Request;
|
|
36
|
+
res: express.Response;
|
|
37
|
+
};
|
|
38
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
39
|
+
//# sourceMappingURL=getTrendingTopics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTrendingTopics.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getTrendingTopics.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,oBAAoB,MAAM,QAAQ,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC1B,2IAA2I;IAC3I,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAAA;IAC5C,SAAS,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAAA;IAC/C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;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;CACtB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTrendingTopics.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getTrendingTopics.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"structured-headers": "^1.0.1",
|
|
43
43
|
"typed-emitter": "^2.1.0",
|
|
44
44
|
"uint8arrays": "3.0.0",
|
|
45
|
-
"@atproto/api": "^0.13.
|
|
45
|
+
"@atproto/api": "^0.13.21",
|
|
46
|
+
"@atproto/common": "^0.4.5",
|
|
46
47
|
"@atproto/crypto": "^0.4.2",
|
|
47
48
|
"@atproto/identity": "^0.4.3",
|
|
48
|
-
"@atproto/
|
|
49
|
-
"@atproto/
|
|
50
|
-
"@atproto/
|
|
51
|
-
"@atproto/sync": "^0.1.6",
|
|
49
|
+
"@atproto/lexicon": "^0.4.4",
|
|
50
|
+
"@atproto/repo": "^0.6.0",
|
|
51
|
+
"@atproto/sync": "^0.1.7",
|
|
52
52
|
"@atproto/syntax": "^0.3.1",
|
|
53
|
-
"@atproto/xrpc-server": "^0.7.
|
|
53
|
+
"@atproto/xrpc-server": "^0.7.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@bufbuild/buf": "^1.28.1",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"jest": "^28.1.2",
|
|
67
67
|
"ts-node": "^10.8.2",
|
|
68
68
|
"typescript": "^5.6.3",
|
|
69
|
-
"@atproto/api": "^0.13.
|
|
70
|
-
"@atproto/
|
|
71
|
-
"@atproto/
|
|
72
|
-
"@atproto/xrpc": "^0.6.
|
|
69
|
+
"@atproto/api": "^0.13.21",
|
|
70
|
+
"@atproto/lex-cli": "^0.5.3",
|
|
71
|
+
"@atproto/pds": "^0.4.77",
|
|
72
|
+
"@atproto/xrpc": "^0.6.5"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/*",
|
|
@@ -25,9 +25,13 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
25
25
|
},
|
|
26
26
|
}),
|
|
27
27
|
handler: async ({ auth, params, req }) => {
|
|
28
|
-
const viewer =
|
|
28
|
+
const { viewer, includeTakedowns } = ctx.authVerifier.parseCreds(auth)
|
|
29
29
|
const labelers = ctx.reqLabelers(req)
|
|
30
|
-
const hydrateCtx = await ctx.hydrator.createContext({
|
|
30
|
+
const hydrateCtx = await ctx.hydrator.createContext({
|
|
31
|
+
viewer,
|
|
32
|
+
labelers,
|
|
33
|
+
includeTakedowns,
|
|
34
|
+
})
|
|
31
35
|
|
|
32
36
|
const result = await getProfile({ ...params, hydrateCtx }, ctx)
|
|
33
37
|
|
|
@@ -43,6 +43,56 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
43
43
|
})
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
const paginateNotifications = async (opts: {
|
|
47
|
+
ctx: Context
|
|
48
|
+
priority: boolean
|
|
49
|
+
reasons?: string[]
|
|
50
|
+
cursor?: string
|
|
51
|
+
limit: number
|
|
52
|
+
viewer: string
|
|
53
|
+
}) => {
|
|
54
|
+
const { ctx, priority, reasons, limit, viewer } = opts
|
|
55
|
+
|
|
56
|
+
// if not filtering, then just pass through the response from dataplane
|
|
57
|
+
if (!reasons) {
|
|
58
|
+
const res = await ctx.hydrator.dataplane.getNotifications({
|
|
59
|
+
actorDid: viewer,
|
|
60
|
+
priority,
|
|
61
|
+
cursor: opts.cursor,
|
|
62
|
+
limit,
|
|
63
|
+
})
|
|
64
|
+
return {
|
|
65
|
+
notifications: res.notifications,
|
|
66
|
+
cursor: res.cursor,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let nextCursor: string | undefined = opts.cursor
|
|
71
|
+
let toReturn: Notification[] = []
|
|
72
|
+
const maxAttempts = 10
|
|
73
|
+
const attemptSize = Math.ceil(limit / 2)
|
|
74
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
75
|
+
const res = await ctx.hydrator.dataplane.getNotifications({
|
|
76
|
+
actorDid: viewer,
|
|
77
|
+
priority,
|
|
78
|
+
cursor: nextCursor,
|
|
79
|
+
limit,
|
|
80
|
+
})
|
|
81
|
+
const filtered = res.notifications.filter((notif) =>
|
|
82
|
+
reasons.includes(notif.reason),
|
|
83
|
+
)
|
|
84
|
+
toReturn = [...toReturn, ...filtered]
|
|
85
|
+
nextCursor = res.cursor ?? undefined
|
|
86
|
+
if (toReturn.length >= attemptSize || !nextCursor) {
|
|
87
|
+
break
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
notifications: toReturn,
|
|
92
|
+
cursor: nextCursor,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
46
96
|
const skeleton = async (
|
|
47
97
|
input: SkeletonFnInput<Context, Params>,
|
|
48
98
|
): Promise<SkeletonState> => {
|
|
@@ -56,11 +106,13 @@ const skeleton = async (
|
|
|
56
106
|
return { notifs: [], priority }
|
|
57
107
|
}
|
|
58
108
|
const [res, lastSeenRes] = await Promise.all([
|
|
59
|
-
|
|
60
|
-
|
|
109
|
+
paginateNotifications({
|
|
110
|
+
ctx,
|
|
61
111
|
priority,
|
|
112
|
+
reasons: params.reasons,
|
|
62
113
|
cursor: params.cursor,
|
|
63
114
|
limit: params.limit,
|
|
115
|
+
viewer,
|
|
64
116
|
}),
|
|
65
117
|
ctx.hydrator.dataplane.getNotificationSeen({
|
|
66
118
|
actorDid: viewer,
|
|
@@ -126,7 +178,9 @@ const noBlockOrMutesOrNeedsReview = (
|
|
|
126
178
|
if (
|
|
127
179
|
item.reason === 'reply' ||
|
|
128
180
|
item.reason === 'quote' ||
|
|
129
|
-
item.reason === 'mention'
|
|
181
|
+
item.reason === 'mention' ||
|
|
182
|
+
item.reason === 'like' ||
|
|
183
|
+
item.reason === 'follow'
|
|
130
184
|
) {
|
|
131
185
|
if (!ctx.views.viewerSeesNeedsReview(did, hydration)) {
|
|
132
186
|
return false
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { noUndefinedVals } from '@atproto/common'
|
|
2
|
+
import AppContext from '../../../../context'
|
|
3
|
+
import { Server } from '../../../../lexicon'
|
|
4
|
+
import {
|
|
5
|
+
createPipeline,
|
|
6
|
+
HydrationFnInput,
|
|
7
|
+
PresentationFnInput,
|
|
8
|
+
RulesFnInput,
|
|
9
|
+
SkeletonFnInput,
|
|
10
|
+
} from '../../../../pipeline'
|
|
11
|
+
import { HydrateCtx, Hydrator } from '../../../../hydration/hydrator'
|
|
12
|
+
import { Views } from '../../../../views'
|
|
13
|
+
import { QueryParams } from '../../../../lexicon/types/app/bsky/unspecced/getTrendingTopics'
|
|
14
|
+
import AtpAgent from '@atproto/api'
|
|
15
|
+
import { TrendingTopic } from '../../../../lexicon/types/app/bsky/unspecced/defs'
|
|
16
|
+
import { InternalServerError } from '@atproto/xrpc-server'
|
|
17
|
+
|
|
18
|
+
export default function (server: Server, ctx: AppContext) {
|
|
19
|
+
const getTrendingTopics = createPipeline(
|
|
20
|
+
skeleton,
|
|
21
|
+
hydration,
|
|
22
|
+
noBlocksOrMutes,
|
|
23
|
+
presentation,
|
|
24
|
+
)
|
|
25
|
+
server.app.bsky.unspecced.getTrendingTopics({
|
|
26
|
+
auth: ctx.authVerifier.standardOptional,
|
|
27
|
+
handler: async ({ auth, params, req }) => {
|
|
28
|
+
const viewer = auth.credentials.iss
|
|
29
|
+
const labelers = ctx.reqLabelers(req)
|
|
30
|
+
const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
|
|
31
|
+
const headers = noUndefinedVals({
|
|
32
|
+
'accept-language': req.headers['accept-language'],
|
|
33
|
+
})
|
|
34
|
+
const { ...result } = await getTrendingTopics(
|
|
35
|
+
{ ...params, hydrateCtx: hydrateCtx.copy({ viewer }), headers },
|
|
36
|
+
ctx,
|
|
37
|
+
)
|
|
38
|
+
return {
|
|
39
|
+
encoding: 'application/json',
|
|
40
|
+
body: result,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
|
47
|
+
const { params, ctx } = input
|
|
48
|
+
if (ctx.topicsAgent) {
|
|
49
|
+
const res = await ctx.topicsAgent.app.bsky.unspecced.getTrendingTopics(
|
|
50
|
+
{
|
|
51
|
+
viewer: params.viewer,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
headers: params.headers,
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
return res.data
|
|
58
|
+
} else {
|
|
59
|
+
throw new InternalServerError('Topics agent not available')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const hydration = async (
|
|
64
|
+
_: HydrationFnInput<Context, Params, SkeletonState>,
|
|
65
|
+
) => {
|
|
66
|
+
return {}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const noBlocksOrMutes = (
|
|
70
|
+
input: RulesFnInput<Context, Params, SkeletonState>,
|
|
71
|
+
) => {
|
|
72
|
+
const { skeleton } = input
|
|
73
|
+
return skeleton
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const presentation = (
|
|
77
|
+
input: PresentationFnInput<Context, Params, SkeletonState>,
|
|
78
|
+
) => {
|
|
79
|
+
const { skeleton } = input
|
|
80
|
+
return skeleton
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type Context = {
|
|
84
|
+
hydrator: Hydrator
|
|
85
|
+
views: Views
|
|
86
|
+
topicsAgent: AtpAgent | undefined
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type Params = QueryParams & {
|
|
90
|
+
hydrateCtx: HydrateCtx & { viewer: string | null }
|
|
91
|
+
headers: Record<string, string>
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type SkeletonState = {
|
|
95
|
+
topics: TrendingTopic[]
|
|
96
|
+
suggested: TrendingTopic[]
|
|
97
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ import unmuteActorList from './app/bsky/graph/unmuteActorList'
|
|
|
38
38
|
import muteThread from './app/bsky/graph/muteThread'
|
|
39
39
|
import unmuteThread from './app/bsky/graph/unmuteThread'
|
|
40
40
|
import getSuggestedFollowsByActor from './app/bsky/graph/getSuggestedFollowsByActor'
|
|
41
|
+
import getTrendingTopics from './app/bsky/unspecced/getTrendingTopics'
|
|
41
42
|
import getLabelerServices from './app/bsky/labeler/getServices'
|
|
42
43
|
import searchActors from './app/bsky/actor/searchActors'
|
|
43
44
|
import searchActorsTypeahead from './app/bsky/actor/searchActorsTypeahead'
|
|
@@ -104,6 +105,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
104
105
|
muteThread(server, ctx)
|
|
105
106
|
unmuteThread(server, ctx)
|
|
106
107
|
getSuggestedFollowsByActor(server, ctx)
|
|
108
|
+
getTrendingTopics(server, ctx)
|
|
107
109
|
getLabelerServices(server, ctx)
|
|
108
110
|
searchActors(server, ctx)
|
|
109
111
|
searchActorsTypeahead(server, ctx)
|
package/src/config.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface ServerConfigValues {
|
|
|
24
24
|
searchUrl?: string
|
|
25
25
|
suggestionsUrl?: string
|
|
26
26
|
suggestionsApiKey?: string
|
|
27
|
+
topicsUrl?: string
|
|
28
|
+
topicsApiKey?: string
|
|
27
29
|
cdnUrl?: string
|
|
28
30
|
videoPlaylistUrlPattern?: string
|
|
29
31
|
videoThumbnailUrlPattern?: string
|
|
@@ -47,6 +49,7 @@ export interface ServerConfigValues {
|
|
|
47
49
|
maxThreadDepth?: number
|
|
48
50
|
// client config
|
|
49
51
|
clientCheckEmailConfirmed?: boolean
|
|
52
|
+
topicsEnabled?: boolean
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
export class ServerConfig {
|
|
@@ -82,6 +85,8 @@ export class ServerConfig {
|
|
|
82
85
|
undefined
|
|
83
86
|
const suggestionsUrl = process.env.BSKY_SUGGESTIONS_URL || undefined
|
|
84
87
|
const suggestionsApiKey = process.env.BSKY_SUGGESTIONS_API_KEY || undefined
|
|
88
|
+
const topicsUrl = process.env.BSKY_TOPICS_URL || undefined
|
|
89
|
+
const topicsApiKey = process.env.BSKY_TOPICS_API_KEY
|
|
85
90
|
let dataplaneUrls = overrides?.dataplaneUrls
|
|
86
91
|
dataplaneUrls ??= process.env.BSKY_DATAPLANE_URLS
|
|
87
92
|
? process.env.BSKY_DATAPLANE_URLS.split(',')
|
|
@@ -130,6 +135,7 @@ export class ServerConfig {
|
|
|
130
135
|
: process.env.BSKY_STATSIG_ENV || 'development'
|
|
131
136
|
const clientCheckEmailConfirmed =
|
|
132
137
|
process.env.BSKY_CLIENT_CHECK_EMAIL_CONFIRMED === 'true'
|
|
138
|
+
const topicsEnabled = process.env.BSKY_TOPICS_ENABLED === 'true'
|
|
133
139
|
const indexedAtEpoch = process.env.BSKY_INDEXED_AT_EPOCH
|
|
134
140
|
? new Date(process.env.BSKY_INDEXED_AT_EPOCH)
|
|
135
141
|
: undefined
|
|
@@ -158,6 +164,8 @@ export class ServerConfig {
|
|
|
158
164
|
searchUrl,
|
|
159
165
|
suggestionsUrl,
|
|
160
166
|
suggestionsApiKey,
|
|
167
|
+
topicsUrl,
|
|
168
|
+
topicsApiKey,
|
|
161
169
|
didPlcUrl,
|
|
162
170
|
labelsFromIssuerDids,
|
|
163
171
|
handleResolveNameservers,
|
|
@@ -180,6 +188,7 @@ export class ServerConfig {
|
|
|
180
188
|
statsigKey,
|
|
181
189
|
statsigEnv,
|
|
182
190
|
clientCheckEmailConfirmed,
|
|
191
|
+
topicsEnabled,
|
|
183
192
|
indexedAtEpoch,
|
|
184
193
|
bigThreadUris,
|
|
185
194
|
bigThreadDepth,
|
|
@@ -285,6 +294,14 @@ export class ServerConfig {
|
|
|
285
294
|
return this.cfg.suggestionsApiKey
|
|
286
295
|
}
|
|
287
296
|
|
|
297
|
+
get topicsUrl() {
|
|
298
|
+
return this.cfg.topicsUrl
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
get topicsApiKey() {
|
|
302
|
+
return this.cfg.topicsApiKey
|
|
303
|
+
}
|
|
304
|
+
|
|
288
305
|
get cdnUrl() {
|
|
289
306
|
return this.cfg.cdnUrl
|
|
290
307
|
}
|
|
@@ -341,6 +358,10 @@ export class ServerConfig {
|
|
|
341
358
|
return this.cfg.clientCheckEmailConfirmed
|
|
342
359
|
}
|
|
343
360
|
|
|
361
|
+
get topicsEnabled() {
|
|
362
|
+
return this.cfg.topicsEnabled
|
|
363
|
+
}
|
|
364
|
+
|
|
344
365
|
get indexedAtEpoch() {
|
|
345
366
|
return this.cfg.indexedAtEpoch
|
|
346
367
|
}
|
package/src/context.ts
CHANGED
|
@@ -25,6 +25,7 @@ export class AppContext {
|
|
|
25
25
|
dataplane: DataPlaneClient
|
|
26
26
|
searchAgent: AtpAgent | undefined
|
|
27
27
|
suggestionsAgent: AtpAgent | undefined
|
|
28
|
+
topicsAgent: AtpAgent | undefined
|
|
28
29
|
hydrator: Hydrator
|
|
29
30
|
views: Views
|
|
30
31
|
signingKey: Keypair
|
|
@@ -52,6 +53,10 @@ export class AppContext {
|
|
|
52
53
|
return this.opts.suggestionsAgent
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
get topicsAgent(): AtpAgent | undefined {
|
|
57
|
+
return this.opts.topicsAgent
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
get hydrator(): Hydrator {
|
|
56
61
|
return this.opts.hydrator
|
|
57
62
|
}
|
package/src/hydration/actor.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
HydrationMap,
|
|
6
6
|
RecordInfo,
|
|
7
7
|
parseRecord,
|
|
8
|
-
parseRecordBytes,
|
|
9
8
|
parseString,
|
|
10
9
|
safeTakedownRef,
|
|
11
10
|
} from './util'
|
|
@@ -116,18 +115,19 @@ export class ActorHydrator {
|
|
|
116
115
|
) {
|
|
117
116
|
return acc.set(did, null)
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
|
|
119
|
+
const profile = actor.profile
|
|
120
|
+
? parseRecord<ProfileRecord>(actor.profile, includeTakedowns)
|
|
121
|
+
: undefined
|
|
122
|
+
|
|
123
123
|
return acc.set(did, {
|
|
124
124
|
did,
|
|
125
125
|
handle: parseString(actor.handle),
|
|
126
|
-
profile:
|
|
126
|
+
profile: profile?.record,
|
|
127
127
|
profileCid: profile?.cid,
|
|
128
|
-
profileTakedownRef:
|
|
129
|
-
sortedAt: profile?.sortedAt
|
|
130
|
-
indexedAt: profile?.indexedAt
|
|
128
|
+
profileTakedownRef: profile?.takedownRef,
|
|
129
|
+
sortedAt: profile?.sortedAt,
|
|
130
|
+
indexedAt: profile?.indexedAt,
|
|
131
131
|
takedownRef: safeTakedownRef(actor),
|
|
132
132
|
isLabeler: actor.labeler ?? false,
|
|
133
133
|
allowIncomingChatsFrom: actor.allowIncomingChatsFrom || undefined,
|
package/src/index.ts
CHANGED
|
@@ -96,6 +96,16 @@ export class BskyAppView {
|
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
const topicsAgent = config.topicsUrl
|
|
100
|
+
? new AtpAgent({ service: config.topicsUrl })
|
|
101
|
+
: undefined
|
|
102
|
+
if (topicsAgent && config.topicsApiKey) {
|
|
103
|
+
topicsAgent.api.setHeader(
|
|
104
|
+
'authorization',
|
|
105
|
+
`Bearer ${config.topicsApiKey}`,
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
99
109
|
const dataplane = createDataPlaneClient(config.dataplaneUrls, {
|
|
100
110
|
httpVersion: config.dataplaneHttpVersion,
|
|
101
111
|
rejectUnauthorized: !config.dataplaneIgnoreBadTls,
|
|
@@ -146,6 +156,7 @@ export class BskyAppView {
|
|
|
146
156
|
dataplane,
|
|
147
157
|
searchAgent,
|
|
148
158
|
suggestionsAgent,
|
|
159
|
+
topicsAgent,
|
|
149
160
|
hydrator,
|
|
150
161
|
views,
|
|
151
162
|
signingKey,
|
package/src/lexicon/index.ts
CHANGED
|
@@ -140,6 +140,7 @@ import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig
|
|
|
140
140
|
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
|
|
141
141
|
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
|
|
142
142
|
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
|
|
143
|
+
import * as AppBskyUnspeccedGetTrendingTopics from './types/app/bsky/unspecced/getTrendingTopics'
|
|
143
144
|
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
|
|
144
145
|
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
|
|
145
146
|
import * as AppBskyUnspeccedSearchStarterPacksSkeleton from './types/app/bsky/unspecced/searchStarterPacksSkeleton'
|
|
@@ -1853,6 +1854,17 @@ export class AppBskyUnspeccedNS {
|
|
|
1853
1854
|
return this._server.xrpc.method(nsid, cfg)
|
|
1854
1855
|
}
|
|
1855
1856
|
|
|
1857
|
+
getTrendingTopics<AV extends AuthVerifier>(
|
|
1858
|
+
cfg: ConfigOf<
|
|
1859
|
+
AV,
|
|
1860
|
+
AppBskyUnspeccedGetTrendingTopics.Handler<ExtractAuth<AV>>,
|
|
1861
|
+
AppBskyUnspeccedGetTrendingTopics.HandlerReqCtx<ExtractAuth<AV>>
|
|
1862
|
+
>,
|
|
1863
|
+
) {
|
|
1864
|
+
const nsid = 'app.bsky.unspecced.getTrendingTopics' // @ts-ignore
|
|
1865
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1856
1868
|
searchActorsSkeleton<AV extends AuthVerifier>(
|
|
1857
1869
|
cfg: ConfigOf<
|
|
1858
1870
|
AV,
|