@atproto/bsky 0.0.11 → 0.0.13

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 (158) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE.txt +7 -0
  3. package/README.md +6 -1
  4. package/dist/api/com/atproto/admin/util.d.ts +5 -0
  5. package/dist/context.d.ts +6 -1
  6. package/dist/db/index.js +51 -2
  7. package/dist/db/index.js.map +3 -3
  8. package/dist/db/migrations/20230929T192920807Z-record-cursor-indexes.d.ts +3 -0
  9. package/dist/db/migrations/index.d.ts +1 -0
  10. package/dist/did-cache.d.ts +2 -2
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +1630 -755
  13. package/dist/index.js.map +3 -3
  14. package/dist/lexicon/index.d.ts +8 -0
  15. package/dist/lexicon/lexicons.d.ts +243 -3
  16. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +1 -0
  17. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +28 -0
  18. package/dist/lexicon/types/com/atproto/admin/getAccountInfo.d.ts +29 -0
  19. package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +39 -0
  20. package/dist/lexicon/types/com/atproto/admin/searchRepos.d.ts +0 -1
  21. package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts +46 -0
  22. package/dist/lexicon/types/com/atproto/server/createAccount.d.ts +4 -2
  23. package/dist/lexicon/types/com/atproto/server/createSession.d.ts +1 -0
  24. package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +1 -0
  25. package/dist/lexicon/types/com/atproto/server/reserveSigningKey.d.ts +36 -0
  26. package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +1 -0
  27. package/dist/services/actor/types.d.ts +1 -0
  28. package/dist/services/graph/index.d.ts +2 -0
  29. package/dist/services/moderation/index.d.ts +13 -3
  30. package/package.json +14 -15
  31. package/src/api/app/bsky/feed/getAuthorFeed.ts +2 -2
  32. package/src/api/app/bsky/feed/getPostThread.ts +2 -2
  33. package/src/api/app/bsky/notification/listNotifications.ts +33 -22
  34. package/src/api/com/atproto/admin/getModerationAction.ts +28 -2
  35. package/src/api/com/atproto/admin/getModerationReport.ts +27 -2
  36. package/src/api/com/atproto/admin/getRecord.ts +14 -2
  37. package/src/api/com/atproto/admin/getRepo.ts +13 -2
  38. package/src/api/com/atproto/admin/reverseModerationAction.ts +31 -5
  39. package/src/api/com/atproto/admin/searchRepos.ts +2 -5
  40. package/src/api/com/atproto/admin/takeModerationAction.ts +41 -7
  41. package/src/api/com/atproto/admin/util.ts +50 -0
  42. package/src/api/well-known.ts +8 -0
  43. package/src/auth.ts +12 -5
  44. package/src/auto-moderator/index.ts +1 -0
  45. package/src/context.ts +25 -1
  46. package/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts +40 -0
  47. package/src/db/migrations/index.ts +1 -0
  48. package/src/did-cache.ts +29 -14
  49. package/src/feed-gen/with-friends.ts +2 -2
  50. package/src/index.ts +4 -1
  51. package/src/indexer/subscription.ts +1 -21
  52. package/src/lexicon/index.ts +48 -0
  53. package/src/lexicon/lexicons.ts +259 -5
  54. package/src/lexicon/types/app/bsky/actor/defs.ts +1 -0
  55. package/src/lexicon/types/com/atproto/admin/defs.ts +61 -0
  56. package/src/lexicon/types/com/atproto/admin/getAccountInfo.ts +41 -0
  57. package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +54 -0
  58. package/src/lexicon/types/com/atproto/admin/searchRepos.ts +0 -1
  59. package/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts +61 -0
  60. package/src/lexicon/types/com/atproto/server/createAccount.ts +4 -2
  61. package/src/lexicon/types/com/atproto/server/createSession.ts +1 -0
  62. package/src/lexicon/types/com/atproto/server/refreshSession.ts +1 -0
  63. package/src/lexicon/types/com/atproto/server/reserveSigningKey.ts +51 -0
  64. package/src/lexicon/types/com/atproto/sync/listRepos.ts +1 -0
  65. package/src/logger.ts +8 -0
  66. package/src/services/actor/index.ts +7 -1
  67. package/src/services/actor/types.ts +1 -0
  68. package/src/services/actor/views.ts +26 -8
  69. package/src/services/graph/index.ts +26 -7
  70. package/src/services/indexing/index.ts +15 -17
  71. package/src/services/moderation/index.ts +94 -14
  72. package/src/services/moderation/views.ts +1 -0
  73. package/tests/__snapshots__/feed-generation.test.ts.snap +12 -12
  74. package/tests/__snapshots__/indexing.test.ts.snap +4 -4
  75. package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +172 -0
  76. package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +178 -0
  77. package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +177 -0
  78. package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +307 -0
  79. package/tests/admin/__snapshots__/get-record.test.ts.snap +275 -0
  80. package/tests/admin/__snapshots__/get-repo.test.ts.snap +103 -0
  81. package/tests/admin/get-moderation-action.test.ts +100 -0
  82. package/tests/admin/get-moderation-actions.test.ts +164 -0
  83. package/tests/admin/get-moderation-report.test.ts +100 -0
  84. package/tests/admin/get-moderation-reports.test.ts +332 -0
  85. package/tests/admin/get-record.test.ts +115 -0
  86. package/tests/admin/get-repo.test.ts +101 -0
  87. package/tests/{moderation.test.ts → admin/moderation.test.ts} +107 -9
  88. package/tests/admin/repo-search.test.ts +124 -0
  89. package/tests/algos/hot-classic.test.ts +3 -5
  90. package/tests/algos/whats-hot.test.ts +3 -5
  91. package/tests/algos/with-friends.test.ts +2 -4
  92. package/tests/auth.test.ts +64 -0
  93. package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -3
  94. package/tests/auto-moderator/labeler.test.ts +5 -7
  95. package/tests/auto-moderator/takedowns.test.ts +11 -12
  96. package/tests/blob-resolver.test.ts +1 -3
  97. package/tests/did-cache.test.ts +2 -5
  98. package/tests/feed-generation.test.ts +8 -6
  99. package/tests/handle-invalidation.test.ts +2 -3
  100. package/tests/image/server.test.ts +1 -4
  101. package/tests/image/sharp.test.ts +1 -1
  102. package/tests/indexing.test.ts +4 -4
  103. package/tests/notification-server.test.ts +2 -3
  104. package/tests/pipeline/backpressure.test.ts +2 -3
  105. package/tests/pipeline/reingest.test.ts +7 -4
  106. package/tests/pipeline/repartition.test.ts +2 -3
  107. package/tests/reprocessing.test.ts +2 -6
  108. package/tests/seeds/basic.ts +4 -4
  109. package/tests/seeds/follows.ts +1 -1
  110. package/tests/seeds/likes.ts +1 -1
  111. package/tests/seeds/reposts.ts +1 -1
  112. package/tests/seeds/users-bulk.ts +1 -1
  113. package/tests/seeds/users.ts +1 -1
  114. package/tests/server.test.ts +1 -3
  115. package/tests/subscription/repo.test.ts +2 -4
  116. package/tests/views/__snapshots__/author-feed.test.ts.snap +24 -24
  117. package/tests/views/__snapshots__/block-lists.test.ts.snap +42 -7
  118. package/tests/views/__snapshots__/blocks.test.ts.snap +2 -2
  119. package/tests/views/__snapshots__/list-feed.test.ts.snap +6 -6
  120. package/tests/views/__snapshots__/mute-lists.test.ts.snap +15 -4
  121. package/tests/views/__snapshots__/mutes.test.ts.snap +2 -2
  122. package/tests/views/__snapshots__/notifications.test.ts.snap +2 -2
  123. package/tests/views/__snapshots__/posts.test.ts.snap +8 -8
  124. package/tests/views/__snapshots__/thread.test.ts.snap +10 -10
  125. package/tests/views/__snapshots__/timeline.test.ts.snap +58 -58
  126. package/tests/views/actor-likes.test.ts +2 -3
  127. package/tests/views/actor-search.test.ts +5 -5
  128. package/tests/views/admin/repo-search.test.ts +2 -4
  129. package/tests/views/author-feed.test.ts +2 -4
  130. package/tests/views/block-lists.test.ts +34 -7
  131. package/tests/views/blocks.test.ts +6 -3
  132. package/tests/views/follows.test.ts +2 -4
  133. package/tests/views/likes.test.ts +2 -5
  134. package/tests/views/list-feed.test.ts +2 -4
  135. package/tests/views/mute-lists.test.ts +23 -5
  136. package/tests/views/mutes.test.ts +2 -5
  137. package/tests/views/notifications.test.ts +2 -4
  138. package/tests/views/posts.test.ts +2 -5
  139. package/tests/views/profile.test.ts +4 -5
  140. package/tests/views/reposts.test.ts +2 -4
  141. package/tests/views/suggested-follows.test.ts +2 -3
  142. package/tests/views/suggestions.test.ts +2 -4
  143. package/tests/views/thread.test.ts +2 -4
  144. package/tests/views/threadgating.test.ts +2 -3
  145. package/tests/views/timeline.test.ts +2 -4
  146. package/LICENSE +0 -21
  147. package/dist/env.d.ts +0 -1
  148. package/example.dev.env +0 -5
  149. package/src/env.ts +0 -9
  150. package/tests/seeds/client.ts +0 -466
  151. /package/tests/{__snapshots__ → admin/__snapshots__}/moderation.test.ts.snap +0 -0
  152. /package/tests/{image/fixtures → sample-img}/at.png +0 -0
  153. /package/tests/{image/fixtures → sample-img}/hd-key.jpg +0 -0
  154. /package/tests/{image/fixtures → sample-img}/key-alt.jpg +0 -0
  155. /package/tests/{image/fixtures → sample-img}/key-landscape-large.jpg +0 -0
  156. /package/tests/{image/fixtures → sample-img}/key-landscape-small.jpg +0 -0
  157. /package/tests/{image/fixtures → sample-img}/key-portrait-large.jpg +0 -0
  158. /package/tests/{image/fixtures → sample-img}/key-portrait-small.jpg +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atproto/bsky
2
2
 
3
+ ## 0.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2"
8
+
9
+ - Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]:
10
+ - @atproto/lexicon@0.3.0
11
+ - @atproto/xrpc-server@0.4.0
12
+ - @atproto/identity@0.3.1
13
+ - @atproto/common@0.3.3
14
+ - @atproto/crypto@0.2.3
15
+ - @atproto/syntax@0.1.4
16
+ - @atproto/repo@0.3.4
17
+ - @atproto/api@0.6.22
18
+
19
+ ## 0.0.12
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`9c98a5ba`](https://github.com/bluesky-social/atproto/commit/9c98a5baaf503b02238a6afe4f6e2b79c5181693), [`bb039d8e`](https://github.com/bluesky-social/atproto/commit/bb039d8e4ce5b7f70c4f3e86d1327e210ef24dc3), [`35d108ce`](https://github.com/bluesky-social/atproto/commit/35d108ce94866ce1b3d147cd0620a0ba1c4ebcd7)]:
24
+ - @atproto/api@0.6.21
25
+ - @atproto/identity@0.3.0
26
+ - @atproto/repo@0.3.3
27
+ - @atproto/common@0.3.2
28
+ - @atproto/lexicon@0.2.3
29
+ - @atproto/syntax@0.1.3
30
+ - @atproto/xrpc-server@0.3.3
31
+
3
32
  ## 0.0.11
4
33
 
5
34
  ### Patch Changes
package/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Dual MIT/Apache-2.0 License
2
+
3
+ Copyright (c) 2022-2023 Bluesky PBC, and Contributors
4
+
5
+ Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
+
7
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
package/README.md CHANGED
@@ -7,4 +7,9 @@ TypeScript implementation of the `app.bsky` Lexicons backing the https://bsky.ap
7
7
 
8
8
  ## License
9
9
 
10
- MIT License
10
+ This project is dual-licensed under MIT and Apache 2.0 terms:
11
+
12
+ - MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
13
+ - Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)
14
+
15
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
@@ -0,0 +1,5 @@
1
+ import AppContext from '../../../../context';
2
+ import { RepoView, RepoViewDetail, AccountView } from '../../../../lexicon/types/com/atproto/admin/defs';
3
+ export declare const getPdsAccountInfo: (ctx: AppContext, did: string) => Promise<AccountView | null>;
4
+ export declare const addAccountInfoToRepoViewDetail: (repoView: RepoViewDetail, accountInfo: AccountView | null, includeEmail?: boolean) => RepoViewDetail;
5
+ export declare const addAccountInfoToRepoView: (repoView: RepoView, accountInfo: AccountView | null, includeEmail?: boolean) => RepoView;
package/dist/context.d.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  /// <reference types="express" />
3
3
  import * as plc from '@did-plc/lib';
4
4
  import { IdResolver } from '@atproto/identity';
5
+ import { AtpAgent } from '@atproto/api';
6
+ import { Keypair } from '@atproto/crypto';
5
7
  import { DatabaseCoordinator } from './db';
6
8
  import { ServerConfig } from './config';
7
9
  import { ImageUriBuilder } from './image/uri';
@@ -11,7 +13,6 @@ import { BackgroundQueue } from './background';
11
13
  import { MountedAlgos } from './feed-gen/types';
12
14
  import { LabelCache } from './label-cache';
13
15
  import { NotificationServer } from './notifications';
14
- import { AtpAgent } from '@atproto/api';
15
16
  export declare class AppContext {
16
17
  private opts;
17
18
  constructor(opts: {
@@ -19,6 +20,7 @@ export declare class AppContext {
19
20
  imgUriBuilder: ImageUriBuilder;
20
21
  cfg: ServerConfig;
21
22
  services: Services;
23
+ signingKey: Keypair;
22
24
  idResolver: IdResolver;
23
25
  didCache: DidSqlCache;
24
26
  labelCache: LabelCache;
@@ -31,6 +33,7 @@ export declare class AppContext {
31
33
  get imgUriBuilder(): ImageUriBuilder;
32
34
  get cfg(): ServerConfig;
33
35
  get services(): Services;
36
+ get signingKey(): Keypair;
34
37
  get plcClient(): plc.Client;
35
38
  get idResolver(): IdResolver;
36
39
  get didCache(): DidSqlCache;
@@ -110,6 +113,8 @@ export declare class AppContext {
110
113
  triage: boolean;
111
114
  };
112
115
  }>;
116
+ serviceAuthJwt(aud: string): Promise<string>;
117
+ pdsAdminAgent(did: string): Promise<AtpAgent>;
113
118
  get backgroundQueue(): BackgroundQueue;
114
119
  get algos(): MountedAlgos;
115
120
  }
package/dist/db/index.js CHANGED
@@ -29909,6 +29909,25 @@ var DAY = HOUR * 24;
29909
29909
  // ../common-web/src/strings.ts
29910
29910
  var import_graphemer = __toESM(require_lib());
29911
29911
 
29912
+ // ../common-web/src/did-doc.ts
29913
+ var verificationMethod = z.object({
29914
+ id: z.string(),
29915
+ type: z.string(),
29916
+ controller: z.string(),
29917
+ publicKeyMultibase: z.string().optional()
29918
+ });
29919
+ var service = z.object({
29920
+ id: z.string(),
29921
+ type: z.string(),
29922
+ serviceEndpoint: z.union([z.string(), z.record(z.unknown())])
29923
+ });
29924
+ var didDocument = z.object({
29925
+ id: z.string(),
29926
+ alsoKnownAs: z.array(z.string()).optional(),
29927
+ verificationMethod: z.array(verificationMethod).optional(),
29928
+ service: z.array(service).optional()
29929
+ });
29930
+
29912
29931
  // ../common/src/dates.ts
29913
29932
  var import_iso_datestring_validator = __toESM(require_dist());
29914
29933
 
@@ -33482,7 +33501,8 @@ __export(migrations_exports, {
33482
33501
  _20230830T205507322Z: () => T205507322Z_suggested_feeds_exports,
33483
33502
  _20230904T211011773Z: () => T211011773Z_block_lists_exports,
33484
33503
  _20230906T222220386Z: () => T222220386Z_thread_gating_exports,
33485
- _20230920T213858047Z: () => T213858047Z_add_tags_to_post_exports
33504
+ _20230920T213858047Z: () => T213858047Z_add_tags_to_post_exports,
33505
+ _20230929T192920807Z: () => T192920807Z_record_cursor_indexes_exports
33486
33506
  });
33487
33507
 
33488
33508
  // src/db/migrations/20230309T045948368Z-init.ts
@@ -33960,6 +33980,27 @@ async function down27(db) {
33960
33980
  await db.schema.alterTable("post").dropColumn("tags").execute();
33961
33981
  }
33962
33982
 
33983
+ // src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts
33984
+ var T192920807Z_record_cursor_indexes_exports = {};
33985
+ __export(T192920807Z_record_cursor_indexes_exports, {
33986
+ down: () => down28,
33987
+ up: () => up28
33988
+ });
33989
+ async function up28(db) {
33990
+ await db.schema.createIndex("like_creator_cursor_idx").on("like").columns(["creator", "sortAt", "cid"]).execute();
33991
+ await db.schema.createIndex("follow_creator_cursor_idx").on("follow").columns(["creator", "sortAt", "cid"]).execute();
33992
+ await db.schema.createIndex("follow_subject_cursor_idx").on("follow").columns(["subjectDid", "sortAt", "cid"]).execute();
33993
+ await db.schema.dropIndex("like_creator_idx").execute();
33994
+ await db.schema.dropIndex("follow_subjectdid_idx").execute();
33995
+ }
33996
+ async function down28(db) {
33997
+ await db.schema.createIndex("like_creator_idx").on("like").column("creator").execute();
33998
+ await db.schema.createIndex("follow_subjectdid_idx").on("follow").column("subjectDid").execute();
33999
+ await db.schema.dropIndex("like_creator_cursor_idx").execute();
34000
+ await db.schema.dropIndex("follow_creator_cursor_idx").execute();
34001
+ await db.schema.dropIndex("follow_subject_cursor_idx").execute();
34002
+ }
34003
+
33963
34004
  // src/db/migrations/provider.ts
33964
34005
  var CtxMigrationProvider = class {
33965
34006
  constructor(migrations, ctx) {
@@ -33985,7 +34026,15 @@ var subLogger = subsystemLogger("bsky:sub");
33985
34026
  var labelerLogger = subsystemLogger("bsky:labeler");
33986
34027
  var httpLogger = subsystemLogger("bsky");
33987
34028
  var loggerMiddleware = (0, import_pino_http.default)({
33988
- logger: httpLogger
34029
+ logger: httpLogger,
34030
+ serializers: {
34031
+ err: (err) => {
34032
+ return {
34033
+ code: err?.code,
34034
+ message: err?.message
34035
+ };
34036
+ }
34037
+ }
33989
34038
  });
33990
34039
 
33991
34040
  // src/db/db.ts