@atproto/bsky 0.0.25 → 0.0.26

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/buf.gen.yaml +12 -0
  3. package/dist/api/app/bsky/unspecced/getTaggedSuggestions.d.ts +3 -0
  4. package/dist/bsync.d.ts +8 -0
  5. package/dist/config.d.ts +20 -0
  6. package/dist/context.d.ts +6 -3
  7. package/dist/courier.d.ts +8 -0
  8. package/dist/db/database-schema.d.ts +2 -1
  9. package/dist/db/index.js +15 -1
  10. package/dist/db/index.js.map +3 -3
  11. package/dist/db/migrations/20240124T023719200Z-tagged-suggestions.d.ts +3 -0
  12. package/dist/db/migrations/index.d.ts +1 -0
  13. package/dist/db/tables/tagged-suggestion.d.ts +9 -0
  14. package/dist/index.js +47930 -16807
  15. package/dist/index.js.map +3 -3
  16. package/dist/indexer/config.d.ts +8 -0
  17. package/dist/indexer/context.d.ts +3 -0
  18. package/dist/ingester/config.d.ts +8 -0
  19. package/dist/ingester/context.d.ts +3 -0
  20. package/dist/ingester/mute-subscription.d.ts +22 -0
  21. package/dist/lexicon/index.d.ts +2 -0
  22. package/dist/lexicon/lexicons.d.ts +48 -0
  23. package/dist/lexicon/types/app/bsky/unspecced/getTaggedSuggestions.d.ts +39 -0
  24. package/dist/notifications.d.ts +27 -16
  25. package/dist/proto/bsync_connect.d.ts +25 -0
  26. package/dist/proto/bsync_pb.d.ts +90 -0
  27. package/dist/proto/courier_connect.d.ts +25 -0
  28. package/dist/proto/courier_pb.d.ts +91 -0
  29. package/dist/services/actor/index.d.ts +2 -2
  30. package/dist/services/indexing/index.d.ts +2 -2
  31. package/dist/services/util/post.d.ts +6 -6
  32. package/dist/util/retry.d.ts +2 -0
  33. package/package.json +15 -7
  34. package/proto/courier.proto +56 -0
  35. package/src/api/app/bsky/graph/muteActor.ts +32 -5
  36. package/src/api/app/bsky/graph/muteActorList.ts +32 -5
  37. package/src/api/app/bsky/graph/unmuteActor.ts +32 -5
  38. package/src/api/app/bsky/graph/unmuteActorList.ts +32 -5
  39. package/src/api/app/bsky/notification/registerPush.ts +42 -8
  40. package/src/api/app/bsky/unspecced/getTaggedSuggestions.ts +21 -0
  41. package/src/api/index.ts +2 -0
  42. package/src/bsync.ts +41 -0
  43. package/src/config.ts +79 -0
  44. package/src/context.ts +12 -6
  45. package/src/courier.ts +41 -0
  46. package/src/db/database-schema.ts +2 -0
  47. package/src/db/migrations/20240124T023719200Z-tagged-suggestions.ts +15 -0
  48. package/src/db/migrations/index.ts +1 -0
  49. package/src/db/tables/tagged-suggestion.ts +11 -0
  50. package/src/index.ts +26 -3
  51. package/src/indexer/config.ts +36 -0
  52. package/src/indexer/context.ts +6 -0
  53. package/src/indexer/index.ts +27 -3
  54. package/src/ingester/config.ts +34 -0
  55. package/src/ingester/context.ts +6 -0
  56. package/src/ingester/index.ts +18 -0
  57. package/src/ingester/mute-subscription.ts +213 -0
  58. package/src/lexicon/index.ts +12 -0
  59. package/src/lexicon/lexicons.ts +50 -0
  60. package/src/lexicon/types/app/bsky/unspecced/getTaggedSuggestions.ts +65 -0
  61. package/src/notifications.ts +165 -149
  62. package/src/proto/bsync_connect.ts +54 -0
  63. package/src/proto/bsync_pb.ts +459 -0
  64. package/src/proto/courier_connect.ts +50 -0
  65. package/src/proto/courier_pb.ts +473 -0
  66. package/src/services/actor/index.ts +17 -2
  67. package/src/services/indexing/processor.ts +1 -1
  68. package/src/util/retry.ts +12 -0
  69. package/tests/notification-server.test.ts +59 -19
  70. package/tests/subscription/mutes.test.ts +170 -0
  71. package/tests/views/suggestions.test.ts +22 -0
@@ -19,6 +19,10 @@ export interface IndexerConfigValues {
19
19
  fuzzyFalsePositiveB64?: string;
20
20
  labelerKeywords: Record<string, string>;
21
21
  moderationPushUrl: string;
22
+ courierUrl?: string;
23
+ courierApiKey?: string;
24
+ courierHttpVersion?: '1.1' | '2';
25
+ courierIgnoreBadTls?: boolean;
22
26
  indexerConcurrency?: number;
23
27
  indexerPartitionIds: number[];
24
28
  indexerPartitionBatchSize?: number;
@@ -45,6 +49,10 @@ export declare class IndexerConfig {
45
49
  get didCacheMaxTTL(): number;
46
50
  get handleResolveNameservers(): string[] | undefined;
47
51
  get moderationPushUrl(): string;
52
+ get courierUrl(): string | undefined;
53
+ get courierApiKey(): string | undefined;
54
+ get courierHttpVersion(): "2" | "1.1" | undefined;
55
+ get courierIgnoreBadTls(): boolean | undefined;
48
56
  get hiveApiKey(): string | undefined;
49
57
  get abyssEndpoint(): string | undefined;
50
58
  get abyssPassword(): string | undefined;
@@ -6,6 +6,7 @@ import { BackgroundQueue } from '../background';
6
6
  import DidSqlCache from '../did-cache';
7
7
  import { Redis } from '../redis';
8
8
  import { AutoModerator } from '../auto-moderator';
9
+ import { NotificationServer } from '../notifications';
9
10
  export declare class IndexerContext {
10
11
  private opts;
11
12
  constructor(opts: {
@@ -18,6 +19,7 @@ export declare class IndexerContext {
18
19
  didCache: DidSqlCache;
19
20
  backgroundQueue: BackgroundQueue;
20
21
  autoMod: AutoModerator;
22
+ notifServer?: NotificationServer;
21
23
  });
22
24
  get db(): PrimaryDatabase;
23
25
  get redis(): Redis;
@@ -28,5 +30,6 @@ export declare class IndexerContext {
28
30
  get didCache(): DidSqlCache;
29
31
  get backgroundQueue(): BackgroundQueue;
30
32
  get autoMod(): AutoModerator;
33
+ get notifServer(): NotificationServer | undefined;
31
34
  }
32
35
  export default IndexerContext;
@@ -8,6 +8,10 @@ export interface IngesterConfigValues {
8
8
  redisPassword?: string;
9
9
  repoProvider: string;
10
10
  labelProvider?: string;
11
+ bsyncUrl?: string;
12
+ bsyncApiKey?: string;
13
+ bsyncHttpVersion?: '1.1' | '2';
14
+ bsyncIgnoreBadTls?: boolean;
11
15
  ingesterPartitionCount: number;
12
16
  ingesterNamespace?: string;
13
17
  ingesterSubLockId?: number;
@@ -28,6 +32,10 @@ export declare class IngesterConfig {
28
32
  get redisPassword(): string | undefined;
29
33
  get repoProvider(): string;
30
34
  get labelProvider(): string | undefined;
35
+ get bsyncUrl(): string | undefined;
36
+ get bsyncApiKey(): string | undefined;
37
+ get bsyncHttpVersion(): "2" | "1.1" | undefined;
38
+ get bsyncIgnoreBadTls(): boolean | undefined;
31
39
  get ingesterPartitionCount(): number;
32
40
  get ingesterMaxItems(): number | undefined;
33
41
  get ingesterCheckItemsEveryN(): number | undefined;
@@ -2,6 +2,7 @@ import { PrimaryDatabase } from '../db';
2
2
  import { Redis } from '../redis';
3
3
  import { IngesterConfig } from './config';
4
4
  import { LabelSubscription } from './label-subscription';
5
+ import { MuteSubscription } from './mute-subscription';
5
6
  export declare class IngesterContext {
6
7
  private opts;
7
8
  constructor(opts: {
@@ -9,10 +10,12 @@ export declare class IngesterContext {
9
10
  redis: Redis;
10
11
  cfg: IngesterConfig;
11
12
  labelSubscription?: LabelSubscription;
13
+ muteSubscription?: MuteSubscription;
12
14
  });
13
15
  get db(): PrimaryDatabase;
14
16
  get redis(): Redis;
15
17
  get cfg(): IngesterConfig;
16
18
  get labelSubscription(): LabelSubscription | undefined;
19
+ get muteSubscription(): MuteSubscription | undefined;
17
20
  }
18
21
  export default IngesterContext;
@@ -0,0 +1,22 @@
1
+ import { PrimaryDatabase } from '../db';
2
+ import { Redis } from '../redis';
3
+ import { BsyncClient } from '../bsync';
4
+ import { MuteOperation } from '../proto/bsync_pb';
5
+ export declare class MuteSubscription {
6
+ db: PrimaryDatabase;
7
+ redis: Redis;
8
+ bsyncClient: BsyncClient;
9
+ ac: AbortController;
10
+ running: Promise<void> | undefined;
11
+ cursor: string | null;
12
+ constructor(db: PrimaryDatabase, redis: Redis, bsyncClient: BsyncClient);
13
+ start(): Promise<void>;
14
+ private run;
15
+ handleAddOp(op: MuteOperation, createdAt: Date): Promise<void>;
16
+ handleRemoveOp(op: MuteOperation): Promise<void>;
17
+ handleClearOp(op: MuteOperation): Promise<void>;
18
+ getCursor(): Promise<string | null>;
19
+ setCursor(cursor: string): Promise<void>;
20
+ destroy(): Promise<void>;
21
+ get destroyed(): boolean;
22
+ }
@@ -114,6 +114,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
114
114
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush';
115
115
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen';
116
116
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators';
117
+ import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions';
117
118
  import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton';
118
119
  import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton';
119
120
  import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton';
@@ -349,6 +350,7 @@ export declare class AppBskyUnspeccedNS {
349
350
  _server: Server;
350
351
  constructor(server: Server);
351
352
  getPopularFeedGenerators<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetPopularFeedGenerators.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetPopularFeedGenerators.HandlerReqCtx<ExtractAuth<AV>>>): void;
353
+ getTaggedSuggestions<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTaggedSuggestions.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTaggedSuggestions.HandlerReqCtx<ExtractAuth<AV>>>): void;
352
354
  getTimelineSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTimelineSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTimelineSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
353
355
  searchActorsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchActorsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchActorsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
354
356
  searchPostsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchPostsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchPostsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
@@ -7423,6 +7423,53 @@ export declare const schemaDict: {
7423
7423
  };
7424
7424
  };
7425
7425
  };
7426
+ AppBskyUnspeccedGetTaggedSuggestions: {
7427
+ lexicon: number;
7428
+ id: string;
7429
+ defs: {
7430
+ main: {
7431
+ type: string;
7432
+ description: string;
7433
+ parameters: {
7434
+ type: string;
7435
+ properties: {};
7436
+ };
7437
+ output: {
7438
+ encoding: string;
7439
+ schema: {
7440
+ type: string;
7441
+ required: string[];
7442
+ properties: {
7443
+ suggestions: {
7444
+ type: string;
7445
+ items: {
7446
+ type: string;
7447
+ ref: string;
7448
+ };
7449
+ };
7450
+ };
7451
+ };
7452
+ };
7453
+ };
7454
+ suggestion: {
7455
+ type: string;
7456
+ required: string[];
7457
+ properties: {
7458
+ tag: {
7459
+ type: string;
7460
+ };
7461
+ subjectType: {
7462
+ type: string;
7463
+ knownValues: string[];
7464
+ };
7465
+ subject: {
7466
+ type: string;
7467
+ format: string;
7468
+ };
7469
+ };
7470
+ };
7471
+ };
7472
+ };
7426
7473
  AppBskyUnspeccedGetTimelineSkeleton: {
7427
7474
  lexicon: number;
7428
7475
  id: string;
@@ -7729,6 +7776,7 @@ export declare const ids: {
7729
7776
  AppBskyRichtextFacet: string;
7730
7777
  AppBskyUnspeccedDefs: string;
7731
7778
  AppBskyUnspeccedGetPopularFeedGenerators: string;
7779
+ AppBskyUnspeccedGetTaggedSuggestions: string;
7732
7780
  AppBskyUnspeccedGetTimelineSkeleton: string;
7733
7781
  AppBskyUnspeccedSearchActorsSkeleton: string;
7734
7782
  AppBskyUnspeccedSearchPostsSkeleton: string;
@@ -0,0 +1,39 @@
1
+ import express from 'express';
2
+ import { ValidationResult } from '@atproto/lexicon';
3
+ import { HandlerAuth } from '@atproto/xrpc-server';
4
+ export interface QueryParams {
5
+ }
6
+ export type InputSchema = undefined;
7
+ export interface OutputSchema {
8
+ suggestions: Suggestion[];
9
+ [k: string]: unknown;
10
+ }
11
+ export type HandlerInput = undefined;
12
+ export interface HandlerSuccess {
13
+ encoding: 'application/json';
14
+ body: OutputSchema;
15
+ headers?: {
16
+ [key: string]: string;
17
+ };
18
+ }
19
+ export interface HandlerError {
20
+ status: number;
21
+ message?: string;
22
+ }
23
+ export type HandlerOutput = HandlerError | HandlerSuccess;
24
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
25
+ auth: HA;
26
+ params: QueryParams;
27
+ input: HandlerInput;
28
+ req: express.Request;
29
+ res: express.Response;
30
+ };
31
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
32
+ export interface Suggestion {
33
+ tag: string;
34
+ subjectType: 'actor' | 'feed' | (string & {});
35
+ subject: string;
36
+ [k: string]: unknown;
37
+ }
38
+ export declare function isSuggestion(v: unknown): v is Suggestion;
39
+ export declare function validateSuggestion(v: unknown): ValidationResult;
@@ -2,8 +2,10 @@ import { Insertable } from 'kysely';
2
2
  import Database from './db/primary';
3
3
  import { Notification } from './db/tables/notification';
4
4
  import { NotificationPushToken as PushToken } from './db/tables/notification-push-token';
5
+ import { Notification as CourierNotification } from './proto/courier_pb';
6
+ import { CourierClient } from './courier';
5
7
  export type Platform = 'ios' | 'android' | 'web';
6
- type PushNotification = {
8
+ type GorushNotification = {
7
9
  tokens: string[];
8
10
  platform: 1 | 2;
9
11
  title: string;
@@ -15,28 +17,37 @@ type PushNotification = {
15
17
  collapse_id?: string;
16
18
  collapse_key?: string;
17
19
  };
18
- type InsertableNotif = Insertable<Notification>;
19
- type NotifDisplay = {
20
+ type NotifRow = Insertable<Notification>;
21
+ type NotifView = {
20
22
  key: string;
21
23
  rateLimit: boolean;
22
24
  title: string;
23
25
  body: string;
24
- notif: InsertableNotif;
26
+ notif: NotifRow;
25
27
  };
26
- export declare class NotificationServer {
28
+ export declare abstract class NotificationServer<N = unknown> {
27
29
  db: Database;
28
- pushEndpoint?: string | undefined;
30
+ constructor(db: Database);
31
+ abstract prepareNotifications(notifs: NotifRow[]): Promise<N[]>;
32
+ abstract processNotifications(prepared: N[]): Promise<void>;
33
+ getNotificationViews(notifs: NotifRow[]): Promise<NotifView[]>;
34
+ private findBlocksAndMutes;
35
+ }
36
+ export declare class GorushNotificationServer extends NotificationServer<GorushNotification> {
37
+ db: Database;
38
+ pushEndpoint: string;
29
39
  private rateLimiter;
30
- constructor(db: Database, pushEndpoint?: string | undefined);
40
+ constructor(db: Database, pushEndpoint: string);
41
+ prepareNotifications(notifs: NotifRow[]): Promise<GorushNotification[]>;
31
42
  getTokensByDid(dids: string[]): Promise<Record<string, PushToken[]>>;
32
- prepareNotifsToSend(notifications: InsertableNotif[]): Promise<PushNotification[]>;
33
- processNotifications(notifs: PushNotification[]): Promise<void>;
34
- private sendPushNotifications;
35
- registerDeviceForPushNotifications(did: string, token: string, platform: Platform, appId: string): Promise<void>;
36
- getNotificationDisplayAttributes(notifs: InsertableNotif[]): Promise<NotifDisplay[]>;
37
- findBlocksAndMutes(notifs: InsertableNotif[]): Promise<{
38
- author: string;
39
- receiver: string;
40
- }[]>;
43
+ processNotifications(prepared: GorushNotification[]): Promise<void>;
44
+ private sendToGorush;
45
+ }
46
+ export declare class CourierNotificationServer extends NotificationServer<CourierNotification> {
47
+ db: Database;
48
+ courierClient: CourierClient;
49
+ constructor(db: Database, courierClient: CourierClient);
50
+ prepareNotifications(notifs: NotifRow[]): Promise<CourierNotification[]>;
51
+ processNotifications(prepared: CourierNotification[]): Promise<void>;
41
52
  }
42
53
  export {};
@@ -0,0 +1,25 @@
1
+ import { AddMuteOperationRequest, AddMuteOperationResponse, PingRequest, PingResponse, ScanMuteOperationsRequest, ScanMuteOperationsResponse } from './bsync_pb.ts';
2
+ import { MethodKind } from '@bufbuild/protobuf';
3
+ export declare const Service: {
4
+ readonly typeName: "bsync.Service";
5
+ readonly methods: {
6
+ readonly addMuteOperation: {
7
+ readonly name: "AddMuteOperation";
8
+ readonly I: typeof AddMuteOperationRequest;
9
+ readonly O: typeof AddMuteOperationResponse;
10
+ readonly kind: MethodKind.Unary;
11
+ };
12
+ readonly scanMuteOperations: {
13
+ readonly name: "ScanMuteOperations";
14
+ readonly I: typeof ScanMuteOperationsRequest;
15
+ readonly O: typeof ScanMuteOperationsResponse;
16
+ readonly kind: MethodKind.Unary;
17
+ };
18
+ readonly ping: {
19
+ readonly name: "Ping";
20
+ readonly I: typeof PingRequest;
21
+ readonly O: typeof PingResponse;
22
+ readonly kind: MethodKind.Unary;
23
+ };
24
+ };
25
+ };
@@ -0,0 +1,90 @@
1
+ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from '@bufbuild/protobuf';
2
+ import { Message, proto3 } from '@bufbuild/protobuf';
3
+ export declare class MuteOperation extends Message<MuteOperation> {
4
+ id: string;
5
+ type: MuteOperation_Type;
6
+ actorDid: string;
7
+ subject: string;
8
+ constructor(data?: PartialMessage<MuteOperation>);
9
+ static readonly runtime: typeof proto3;
10
+ static readonly typeName = "bsync.MuteOperation";
11
+ static readonly fields: FieldList;
12
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MuteOperation;
13
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MuteOperation;
14
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MuteOperation;
15
+ static equals(a: MuteOperation | PlainMessage<MuteOperation> | undefined, b: MuteOperation | PlainMessage<MuteOperation> | undefined): boolean;
16
+ }
17
+ export declare enum MuteOperation_Type {
18
+ UNSPECIFIED = 0,
19
+ ADD = 1,
20
+ REMOVE = 2,
21
+ CLEAR = 3
22
+ }
23
+ export declare class AddMuteOperationRequest extends Message<AddMuteOperationRequest> {
24
+ type: MuteOperation_Type;
25
+ actorDid: string;
26
+ subject: string;
27
+ constructor(data?: PartialMessage<AddMuteOperationRequest>);
28
+ static readonly runtime: typeof proto3;
29
+ static readonly typeName = "bsync.AddMuteOperationRequest";
30
+ static readonly fields: FieldList;
31
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AddMuteOperationRequest;
32
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AddMuteOperationRequest;
33
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AddMuteOperationRequest;
34
+ static equals(a: AddMuteOperationRequest | PlainMessage<AddMuteOperationRequest> | undefined, b: AddMuteOperationRequest | PlainMessage<AddMuteOperationRequest> | undefined): boolean;
35
+ }
36
+ export declare class AddMuteOperationResponse extends Message<AddMuteOperationResponse> {
37
+ operation?: MuteOperation;
38
+ constructor(data?: PartialMessage<AddMuteOperationResponse>);
39
+ static readonly runtime: typeof proto3;
40
+ static readonly typeName = "bsync.AddMuteOperationResponse";
41
+ static readonly fields: FieldList;
42
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AddMuteOperationResponse;
43
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AddMuteOperationResponse;
44
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AddMuteOperationResponse;
45
+ static equals(a: AddMuteOperationResponse | PlainMessage<AddMuteOperationResponse> | undefined, b: AddMuteOperationResponse | PlainMessage<AddMuteOperationResponse> | undefined): boolean;
46
+ }
47
+ export declare class ScanMuteOperationsRequest extends Message<ScanMuteOperationsRequest> {
48
+ cursor: string;
49
+ limit: number;
50
+ constructor(data?: PartialMessage<ScanMuteOperationsRequest>);
51
+ static readonly runtime: typeof proto3;
52
+ static readonly typeName = "bsync.ScanMuteOperationsRequest";
53
+ static readonly fields: FieldList;
54
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ScanMuteOperationsRequest;
55
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ScanMuteOperationsRequest;
56
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ScanMuteOperationsRequest;
57
+ static equals(a: ScanMuteOperationsRequest | PlainMessage<ScanMuteOperationsRequest> | undefined, b: ScanMuteOperationsRequest | PlainMessage<ScanMuteOperationsRequest> | undefined): boolean;
58
+ }
59
+ export declare class ScanMuteOperationsResponse extends Message<ScanMuteOperationsResponse> {
60
+ operations: MuteOperation[];
61
+ cursor: string;
62
+ constructor(data?: PartialMessage<ScanMuteOperationsResponse>);
63
+ static readonly runtime: typeof proto3;
64
+ static readonly typeName = "bsync.ScanMuteOperationsResponse";
65
+ static readonly fields: FieldList;
66
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ScanMuteOperationsResponse;
67
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ScanMuteOperationsResponse;
68
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ScanMuteOperationsResponse;
69
+ static equals(a: ScanMuteOperationsResponse | PlainMessage<ScanMuteOperationsResponse> | undefined, b: ScanMuteOperationsResponse | PlainMessage<ScanMuteOperationsResponse> | undefined): boolean;
70
+ }
71
+ export declare class PingRequest extends Message<PingRequest> {
72
+ constructor(data?: PartialMessage<PingRequest>);
73
+ static readonly runtime: typeof proto3;
74
+ static readonly typeName = "bsync.PingRequest";
75
+ static readonly fields: FieldList;
76
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingRequest;
77
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingRequest;
78
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingRequest;
79
+ static equals(a: PingRequest | PlainMessage<PingRequest> | undefined, b: PingRequest | PlainMessage<PingRequest> | undefined): boolean;
80
+ }
81
+ export declare class PingResponse extends Message<PingResponse> {
82
+ constructor(data?: PartialMessage<PingResponse>);
83
+ static readonly runtime: typeof proto3;
84
+ static readonly typeName = "bsync.PingResponse";
85
+ static readonly fields: FieldList;
86
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingResponse;
87
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingResponse;
88
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingResponse;
89
+ static equals(a: PingResponse | PlainMessage<PingResponse> | undefined, b: PingResponse | PlainMessage<PingResponse> | undefined): boolean;
90
+ }
@@ -0,0 +1,25 @@
1
+ import { PingRequest, PingResponse, PushNotificationsRequest, PushNotificationsResponse, RegisterDeviceTokenRequest, RegisterDeviceTokenResponse } from './courier_pb.ts';
2
+ import { MethodKind } from '@bufbuild/protobuf';
3
+ export declare const Service: {
4
+ readonly typeName: "courier.Service";
5
+ readonly methods: {
6
+ readonly ping: {
7
+ readonly name: "Ping";
8
+ readonly I: typeof PingRequest;
9
+ readonly O: typeof PingResponse;
10
+ readonly kind: MethodKind.Unary;
11
+ };
12
+ readonly pushNotifications: {
13
+ readonly name: "PushNotifications";
14
+ readonly I: typeof PushNotificationsRequest;
15
+ readonly O: typeof PushNotificationsResponse;
16
+ readonly kind: MethodKind.Unary;
17
+ };
18
+ readonly registerDeviceToken: {
19
+ readonly name: "RegisterDeviceToken";
20
+ readonly I: typeof RegisterDeviceTokenRequest;
21
+ readonly O: typeof RegisterDeviceTokenResponse;
22
+ readonly kind: MethodKind.Unary;
23
+ };
24
+ };
25
+ };
@@ -0,0 +1,91 @@
1
+ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from '@bufbuild/protobuf';
2
+ import { Message, proto3, Struct, Timestamp } from '@bufbuild/protobuf';
3
+ export declare enum AppPlatform {
4
+ UNSPECIFIED = 0,
5
+ IOS = 1,
6
+ ANDROID = 2,
7
+ WEB = 3
8
+ }
9
+ export declare class PingRequest extends Message<PingRequest> {
10
+ constructor(data?: PartialMessage<PingRequest>);
11
+ static readonly runtime: typeof proto3;
12
+ static readonly typeName = "courier.PingRequest";
13
+ static readonly fields: FieldList;
14
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingRequest;
15
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingRequest;
16
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingRequest;
17
+ static equals(a: PingRequest | PlainMessage<PingRequest> | undefined, b: PingRequest | PlainMessage<PingRequest> | undefined): boolean;
18
+ }
19
+ export declare class PingResponse extends Message<PingResponse> {
20
+ constructor(data?: PartialMessage<PingResponse>);
21
+ static readonly runtime: typeof proto3;
22
+ static readonly typeName = "courier.PingResponse";
23
+ static readonly fields: FieldList;
24
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PingResponse;
25
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PingResponse;
26
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PingResponse;
27
+ static equals(a: PingResponse | PlainMessage<PingResponse> | undefined, b: PingResponse | PlainMessage<PingResponse> | undefined): boolean;
28
+ }
29
+ export declare class Notification extends Message<Notification> {
30
+ id: string;
31
+ recipientDid: string;
32
+ title: string;
33
+ message: string;
34
+ collapseKey: string;
35
+ alwaysDeliver: boolean;
36
+ timestamp?: Timestamp;
37
+ additional?: Struct;
38
+ constructor(data?: PartialMessage<Notification>);
39
+ static readonly runtime: typeof proto3;
40
+ static readonly typeName = "courier.Notification";
41
+ static readonly fields: FieldList;
42
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Notification;
43
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Notification;
44
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Notification;
45
+ static equals(a: Notification | PlainMessage<Notification> | undefined, b: Notification | PlainMessage<Notification> | undefined): boolean;
46
+ }
47
+ export declare class PushNotificationsRequest extends Message<PushNotificationsRequest> {
48
+ notifications: Notification[];
49
+ constructor(data?: PartialMessage<PushNotificationsRequest>);
50
+ static readonly runtime: typeof proto3;
51
+ static readonly typeName = "courier.PushNotificationsRequest";
52
+ static readonly fields: FieldList;
53
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushNotificationsRequest;
54
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushNotificationsRequest;
55
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushNotificationsRequest;
56
+ static equals(a: PushNotificationsRequest | PlainMessage<PushNotificationsRequest> | undefined, b: PushNotificationsRequest | PlainMessage<PushNotificationsRequest> | undefined): boolean;
57
+ }
58
+ export declare class PushNotificationsResponse extends Message<PushNotificationsResponse> {
59
+ constructor(data?: PartialMessage<PushNotificationsResponse>);
60
+ static readonly runtime: typeof proto3;
61
+ static readonly typeName = "courier.PushNotificationsResponse";
62
+ static readonly fields: FieldList;
63
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushNotificationsResponse;
64
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushNotificationsResponse;
65
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushNotificationsResponse;
66
+ static equals(a: PushNotificationsResponse | PlainMessage<PushNotificationsResponse> | undefined, b: PushNotificationsResponse | PlainMessage<PushNotificationsResponse> | undefined): boolean;
67
+ }
68
+ export declare class RegisterDeviceTokenRequest extends Message<RegisterDeviceTokenRequest> {
69
+ did: string;
70
+ token: string;
71
+ appId: string;
72
+ platform: AppPlatform;
73
+ constructor(data?: PartialMessage<RegisterDeviceTokenRequest>);
74
+ static readonly runtime: typeof proto3;
75
+ static readonly typeName = "courier.RegisterDeviceTokenRequest";
76
+ static readonly fields: FieldList;
77
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RegisterDeviceTokenRequest;
78
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RegisterDeviceTokenRequest;
79
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RegisterDeviceTokenRequest;
80
+ static equals(a: RegisterDeviceTokenRequest | PlainMessage<RegisterDeviceTokenRequest> | undefined, b: RegisterDeviceTokenRequest | PlainMessage<RegisterDeviceTokenRequest> | undefined): boolean;
81
+ }
82
+ export declare class RegisterDeviceTokenResponse extends Message<RegisterDeviceTokenResponse> {
83
+ constructor(data?: PartialMessage<RegisterDeviceTokenResponse>);
84
+ static readonly runtime: typeof proto3;
85
+ static readonly typeName = "courier.RegisterDeviceTokenResponse";
86
+ static readonly fields: FieldList;
87
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RegisterDeviceTokenResponse;
88
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RegisterDeviceTokenResponse;
89
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RegisterDeviceTokenResponse;
90
+ static equals(a: RegisterDeviceTokenResponse | PlainMessage<RegisterDeviceTokenResponse> | undefined, b: RegisterDeviceTokenResponse | PlainMessage<RegisterDeviceTokenResponse> | undefined): boolean;
91
+ }
@@ -6,12 +6,11 @@ import { TimeCidKeyset } from '../../db/pagination';
6
6
  import { FromDb } from '../types';
7
7
  import { GraphService } from '../graph';
8
8
  import { LabelService } from '../label';
9
+ import { Platform } from '../../notifications';
9
10
  export * from './types';
10
11
  export declare class ActorService {
11
12
  db: Database;
12
13
  imgUriBuilder: ImageUriBuilder;
13
- private graph;
14
- private label;
15
14
  views: ActorViews;
16
15
  constructor(db: Database, imgUriBuilder: ImageUriBuilder, graph: FromDb<GraphService>, label: FromDb<LabelService>);
17
16
  static creator(imgUriBuilder: ImageUriBuilder, graph: FromDb<GraphService>, label: FromDb<LabelService>): (db: Database) => ActorService;
@@ -40,6 +39,7 @@ export declare class ActorService {
40
39
  indexedAt: string;
41
40
  takedownRef: string | null;
42
41
  }, void, unknown>;
42
+ registerPushDeviceToken(did: string, token: string, platform: Platform, appId: string): Promise<void>;
43
43
  }
44
44
  type ActorResult = Actor;
45
45
  export declare class ListKeyset extends TimeCidKeyset<{
@@ -23,7 +23,7 @@ export declare class IndexingService {
23
23
  idResolver: IdResolver;
24
24
  autoMod: AutoModerator;
25
25
  backgroundQueue: BackgroundQueue;
26
- notifServer?: NotificationServer | undefined;
26
+ notifServer?: NotificationServer<unknown> | undefined;
27
27
  records: {
28
28
  post: Post.PluginType;
29
29
  threadGate: Threadgate.PluginType;
@@ -37,7 +37,7 @@ export declare class IndexingService {
37
37
  block: Block.PluginType;
38
38
  feedGenerator: FeedGenerator.PluginType;
39
39
  };
40
- constructor(db: PrimaryDatabase, idResolver: IdResolver, autoMod: AutoModerator, backgroundQueue: BackgroundQueue, notifServer?: NotificationServer | undefined);
40
+ constructor(db: PrimaryDatabase, idResolver: IdResolver, autoMod: AutoModerator, backgroundQueue: BackgroundQueue, notifServer?: NotificationServer<unknown> | undefined);
41
41
  transact(txn: PrimaryDatabase): IndexingService;
42
42
  static creator(idResolver: IdResolver, autoMod: AutoModerator, backgroundQueue: BackgroundQueue, notifServer?: NotificationServer): (db: PrimaryDatabase) => IndexingService;
43
43
  indexRecord(uri: AtUri, cid: CID, obj: unknown, action: WriteOpAction.Create | WriteOpAction.Update, timestamp: string, opts?: {