@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atproto/bsky
2
2
 
3
+ ## 0.0.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`5368245a`](https://github.com/bluesky-social/atproto/commit/5368245a6ef7095c86ad166fb04ff9bef27c3c3e)]:
8
+ - @atproto/api@0.9.3
9
+
3
10
  ## 0.0.25
4
11
 
5
12
  ### Patch Changes
package/buf.gen.yaml ADDED
@@ -0,0 +1,12 @@
1
+ version: v1
2
+ plugins:
3
+ - plugin: es
4
+ opt:
5
+ - target=ts
6
+ - import_extension=.ts
7
+ out: src/proto
8
+ - plugin: connect-es
9
+ opt:
10
+ - target=ts
11
+ - import_extension=.ts
12
+ out: src/proto
@@ -0,0 +1,3 @@
1
+ import { Server } from '../../../../lexicon';
2
+ import AppContext from '../../../../context';
3
+ export default function (server: Server, ctx: AppContext): void;
@@ -0,0 +1,8 @@
1
+ import { Service } from './proto/bsync_connect';
2
+ import { Code, ConnectError, PromiseClient, Interceptor } from '@connectrpc/connect';
3
+ import { ConnectTransportOptions } from '@connectrpc/connect-node';
4
+ export type BsyncClient = PromiseClient<typeof Service>;
5
+ export declare const createBsyncClient: (opts: ConnectTransportOptions) => BsyncClient;
6
+ export { Code };
7
+ export declare const isBsyncError: (err: unknown, code?: Code) => err is ConnectError;
8
+ export declare const authWithApiKey: (apiKey: string) => Interceptor;
package/dist/config.d.ts CHANGED
@@ -22,6 +22,16 @@ export interface ServerConfigValues {
22
22
  imgUriEndpoint?: string;
23
23
  blobCacheLocation?: string;
24
24
  searchEndpoint?: string;
25
+ bsyncUrl?: string;
26
+ bsyncApiKey?: string;
27
+ bsyncHttpVersion?: '1.1' | '2';
28
+ bsyncIgnoreBadTls?: boolean;
29
+ bsyncOnlyMutes?: boolean;
30
+ courierUrl?: string;
31
+ courierApiKey?: string;
32
+ courierHttpVersion?: '1.1' | '2';
33
+ courierIgnoreBadTls?: boolean;
34
+ courierOnlyRegistration?: boolean;
25
35
  adminPassword: string;
26
36
  moderatorPassword: string;
27
37
  triagePassword: string;
@@ -60,6 +70,16 @@ export declare class ServerConfig {
60
70
  get imgUriEndpoint(): string | undefined;
61
71
  get blobCacheLocation(): string | undefined;
62
72
  get searchEndpoint(): string | undefined;
73
+ get bsyncUrl(): string | undefined;
74
+ get bsyncApiKey(): string | undefined;
75
+ get bsyncOnlyMutes(): boolean | undefined;
76
+ get bsyncHttpVersion(): "2" | "1.1" | undefined;
77
+ get bsyncIgnoreBadTls(): boolean | undefined;
78
+ get courierUrl(): string | undefined;
79
+ get courierApiKey(): string | undefined;
80
+ get courierHttpVersion(): "2" | "1.1" | undefined;
81
+ get courierIgnoreBadTls(): boolean | undefined;
82
+ get courierOnlyRegistration(): boolean | undefined;
63
83
  get adminPassword(): string;
64
84
  get moderatorPassword(): string;
65
85
  get triagePassword(): string;
package/dist/context.d.ts CHANGED
@@ -9,9 +9,10 @@ import { Services } from './services';
9
9
  import DidRedisCache from './did-cache';
10
10
  import { BackgroundQueue } from './background';
11
11
  import { MountedAlgos } from './feed-gen/types';
12
- import { NotificationServer } from './notifications';
13
12
  import { Redis } from './redis';
14
13
  import { AuthVerifier } from './auth-verifier';
14
+ import { BsyncClient } from './bsync';
15
+ import { CourierClient } from './courier';
15
16
  export declare class AppContext {
16
17
  private opts;
17
18
  constructor(opts: {
@@ -25,8 +26,9 @@ export declare class AppContext {
25
26
  redis: Redis;
26
27
  backgroundQueue: BackgroundQueue;
27
28
  searchAgent?: AtpAgent;
29
+ bsyncClient?: BsyncClient;
30
+ courierClient?: CourierClient;
28
31
  algos: MountedAlgos;
29
- notifServer: NotificationServer;
30
32
  authVerifier: AuthVerifier;
31
33
  });
32
34
  get db(): DatabaseCoordinator;
@@ -38,8 +40,9 @@ export declare class AppContext {
38
40
  get idResolver(): IdResolver;
39
41
  get didCache(): DidRedisCache;
40
42
  get redis(): Redis;
41
- get notifServer(): NotificationServer;
42
43
  get searchAgent(): AtpAgent | undefined;
44
+ get bsyncClient(): BsyncClient | undefined;
45
+ get courierClient(): CourierClient | undefined;
43
46
  get authVerifier(): AuthVerifier;
44
47
  serviceAuthJwt(aud: string): Promise<string>;
45
48
  get backgroundQueue(): BackgroundQueue;
@@ -0,0 +1,8 @@
1
+ import { Service } from './proto/courier_connect';
2
+ import { Code, ConnectError, PromiseClient, Interceptor } from '@connectrpc/connect';
3
+ import { ConnectTransportOptions } from '@connectrpc/connect-node';
4
+ export type CourierClient = PromiseClient<typeof Service>;
5
+ export declare const createCourierClient: (opts: ConnectTransportOptions) => CourierClient;
6
+ export { Code };
7
+ export declare const isCourierError: (err: unknown, code?: Code) => err is ConnectError;
8
+ export declare const authWithApiKey: (apiKey: string) => Interceptor;
@@ -30,7 +30,8 @@ import * as algo from './tables/algo';
30
30
  import * as viewParam from './tables/view-param';
31
31
  import * as suggestedFollow from './tables/suggested-follow';
32
32
  import * as suggestedFeed from './tables/suggested-feed';
33
+ import * as taggedSuggestion from './tables/tagged-suggestion';
33
34
  import * as blobTakedown from './tables/blob-takedown';
34
- export type DatabaseSchemaType = duplicateRecord.PartialDB & profile.PartialDB & profileAgg.PartialDB & post.PartialDB & postEmbed.PartialDB & postAgg.PartialDB & repost.PartialDB & threadGate.PartialDB & feedItem.PartialDB & follow.PartialDB & like.PartialDB & list.PartialDB & listItem.PartialDB & listMute.PartialDB & listBlock.PartialDB & mute.PartialDB & actorBlock.PartialDB & feedGenerator.PartialDB & subscription.PartialDB & actor.PartialDB & actorState.PartialDB & actorSync.PartialDB & record.PartialDB & notification.PartialDB & notificationPushToken.PartialDB & moderation.PartialDB & label.PartialDB & algo.PartialDB & viewParam.PartialDB & suggestedFollow.PartialDB & suggestedFeed.PartialDB & blobTakedown.PartialDB;
35
+ export type DatabaseSchemaType = duplicateRecord.PartialDB & profile.PartialDB & profileAgg.PartialDB & post.PartialDB & postEmbed.PartialDB & postAgg.PartialDB & repost.PartialDB & threadGate.PartialDB & feedItem.PartialDB & follow.PartialDB & like.PartialDB & list.PartialDB & listItem.PartialDB & listMute.PartialDB & listBlock.PartialDB & mute.PartialDB & actorBlock.PartialDB & feedGenerator.PartialDB & subscription.PartialDB & actor.PartialDB & actorState.PartialDB & actorSync.PartialDB & record.PartialDB & notification.PartialDB & notificationPushToken.PartialDB & moderation.PartialDB & label.PartialDB & algo.PartialDB & viewParam.PartialDB & suggestedFollow.PartialDB & suggestedFeed.PartialDB & taggedSuggestion.PartialDB & blobTakedown.PartialDB;
35
36
  export type DatabaseSchema = Kysely<DatabaseSchemaType>;
36
37
  export default DatabaseSchema;
package/dist/db/index.js CHANGED
@@ -33505,7 +33505,8 @@ __export(migrations_exports, {
33505
33505
  _20230929T192920807Z: () => T192920807Z_record_cursor_indexes_exports,
33506
33506
  _20231003T202833377Z: () => T202833377Z_create_moderation_subject_status_exports,
33507
33507
  _20231205T000257238Z: () => T000257238Z_remove_did_cache_exports,
33508
- _20231220T225126090Z: () => T225126090Z_blob_takedowns_exports
33508
+ _20231220T225126090Z: () => T225126090Z_blob_takedowns_exports,
33509
+ _20240124T023719200Z: () => T023719200Z_tagged_suggestions_exports
33509
33510
  });
33510
33511
 
33511
33512
  // src/db/migrations/20230309T045948368Z-init.ts
@@ -34066,6 +34067,19 @@ async function down31(db) {
34066
34067
  await db.schema.alterTable("record").addForeignKeyConstraint("record_takedown_id_fkey", ["takedownId"], "moderation_event", ["id"]).execute();
34067
34068
  }
34068
34069
 
34070
+ // src/db/migrations/20240124T023719200Z-tagged-suggestions.ts
34071
+ var T023719200Z_tagged_suggestions_exports = {};
34072
+ __export(T023719200Z_tagged_suggestions_exports, {
34073
+ down: () => down32,
34074
+ up: () => up32
34075
+ });
34076
+ async function up32(db) {
34077
+ await db.schema.createTable("tagged_suggestion").addColumn("tag", "varchar", (col) => col.notNull()).addColumn("subject", "varchar", (col) => col.notNull()).addColumn("subjectType", "varchar", (col) => col.notNull()).addPrimaryKeyConstraint("tagged_suggestion_pkey", ["tag", "subject"]).execute();
34078
+ }
34079
+ async function down32(db) {
34080
+ await db.schema.dropTable("tagged_suggestion").execute();
34081
+ }
34082
+
34069
34083
  // src/db/migrations/provider.ts
34070
34084
  var CtxMigrationProvider = class {
34071
34085
  constructor(migrations, ctx) {