@atproto/ozone 0.1.37 → 0.1.39

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 (105) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/chat/getActorMetadata.d.ts.map +1 -1
  3. package/dist/api/chat/getActorMetadata.js +2 -1
  4. package/dist/api/chat/getActorMetadata.js.map +1 -1
  5. package/dist/api/chat/getMessageContext.d.ts.map +1 -1
  6. package/dist/api/chat/getMessageContext.js +2 -1
  7. package/dist/api/chat/getMessageContext.js.map +1 -1
  8. package/dist/api/moderation/searchRepos.d.ts.map +1 -1
  9. package/dist/api/moderation/searchRepos.js +2 -1
  10. package/dist/api/moderation/searchRepos.js.map +1 -1
  11. package/dist/api/proxied.d.ts.map +1 -1
  12. package/dist/api/proxied.js +18 -17
  13. package/dist/api/proxied.js.map +1 -1
  14. package/dist/api/util.d.ts.map +1 -1
  15. package/dist/api/util.js +2 -1
  16. package/dist/api/util.js.map +1 -1
  17. package/dist/auth-verifier.d.ts.map +1 -1
  18. package/dist/auth-verifier.js +2 -1
  19. package/dist/auth-verifier.js.map +1 -1
  20. package/dist/context.d.ts +4 -4
  21. package/dist/context.d.ts.map +1 -1
  22. package/dist/context.js +10 -10
  23. package/dist/context.js.map +1 -1
  24. package/dist/daemon/context.js +2 -2
  25. package/dist/daemon/context.js.map +1 -1
  26. package/dist/daemon/event-pusher.d.ts +2 -2
  27. package/dist/daemon/event-pusher.d.ts.map +1 -1
  28. package/dist/daemon/event-pusher.js +2 -1
  29. package/dist/daemon/event-pusher.js.map +1 -1
  30. package/dist/db/migrations/20240814T003647759Z-event-created-at-index.d.ts +4 -0
  31. package/dist/db/migrations/20240814T003647759Z-event-created-at-index.d.ts.map +1 -0
  32. package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js +16 -0
  33. package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js.map +1 -0
  34. package/dist/db/migrations/index.d.ts +1 -0
  35. package/dist/db/migrations/index.d.ts.map +1 -1
  36. package/dist/db/migrations/index.js +2 -1
  37. package/dist/db/migrations/index.js.map +1 -1
  38. package/dist/lexicon/index.d.ts +2 -0
  39. package/dist/lexicon/index.d.ts.map +1 -1
  40. package/dist/lexicon/index.js +4 -0
  41. package/dist/lexicon/index.js.map +1 -1
  42. package/dist/lexicon/lexicons.d.ts +141 -0
  43. package/dist/lexicon/lexicons.d.ts.map +1 -1
  44. package/dist/lexicon/lexicons.js +142 -0
  45. package/dist/lexicon/lexicons.js.map +1 -1
  46. package/dist/lexicon/types/app/bsky/embed/record.d.ts +8 -1
  47. package/dist/lexicon/types/app/bsky/embed/record.d.ts.map +1 -1
  48. package/dist/lexicon/types/app/bsky/embed/record.js +11 -1
  49. package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
  50. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +2 -0
  51. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  52. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  53. package/dist/lexicon/types/app/bsky/feed/getQuotes.d.ts +44 -0
  54. package/dist/lexicon/types/app/bsky/feed/getQuotes.d.ts.map +1 -0
  55. package/dist/lexicon/types/app/bsky/feed/getQuotes.js +3 -0
  56. package/dist/lexicon/types/app/bsky/feed/getQuotes.js.map +1 -0
  57. package/dist/lexicon/types/app/bsky/feed/postgate.d.ts +25 -0
  58. package/dist/lexicon/types/app/bsky/feed/postgate.d.ts.map +1 -0
  59. package/dist/lexicon/types/app/bsky/feed/postgate.js +27 -0
  60. package/dist/lexicon/types/app/bsky/feed/postgate.js.map +1 -0
  61. package/dist/lexicon/types/app/bsky/feed/threadgate.d.ts +2 -0
  62. package/dist/lexicon/types/app/bsky/feed/threadgate.d.ts.map +1 -1
  63. package/dist/lexicon/types/app/bsky/feed/threadgate.js.map +1 -1
  64. package/dist/mod-service/index.d.ts +2 -2
  65. package/dist/mod-service/index.d.ts.map +1 -1
  66. package/dist/mod-service/index.js +4 -3
  67. package/dist/mod-service/index.js.map +1 -1
  68. package/dist/mod-service/views.d.ts +1 -1
  69. package/dist/mod-service/views.d.ts.map +1 -1
  70. package/dist/mod-service/views.js +4 -3
  71. package/dist/mod-service/views.js.map +1 -1
  72. package/dist/team/index.d.ts.map +1 -1
  73. package/dist/team/index.js +2 -1
  74. package/dist/team/index.js.map +1 -1
  75. package/package.json +4 -4
  76. package/src/api/chat/getActorMetadata.ts +2 -1
  77. package/src/api/chat/getMessageContext.ts +2 -1
  78. package/src/api/moderation/searchRepos.ts +2 -1
  79. package/src/api/proxied.ts +18 -17
  80. package/src/api/util.ts +2 -1
  81. package/src/auth-verifier.ts +7 -2
  82. package/src/context.ts +10 -10
  83. package/src/daemon/context.ts +2 -2
  84. package/src/daemon/event-pusher.ts +9 -2
  85. package/src/db/migrations/20240814T003647759Z-event-created-at-index.ts +13 -0
  86. package/src/db/migrations/index.ts +1 -0
  87. package/src/lexicon/index.ts +12 -0
  88. package/src/lexicon/lexicons.ts +145 -0
  89. package/src/lexicon/types/app/bsky/embed/record.ts +19 -0
  90. package/src/lexicon/types/app/bsky/feed/defs.ts +2 -0
  91. package/src/lexicon/types/app/bsky/feed/getQuotes.ts +54 -0
  92. package/src/lexicon/types/app/bsky/feed/postgate.ts +47 -0
  93. package/src/lexicon/types/app/bsky/feed/threadgate.ts +2 -0
  94. package/src/mod-service/index.ts +15 -5
  95. package/src/mod-service/views.ts +5 -4
  96. package/src/team/index.ts +2 -1
  97. package/tests/3p-labeler.test.ts +23 -6
  98. package/tests/communication-templates.test.ts +29 -7
  99. package/tests/get-config.test.ts +5 -1
  100. package/tests/get-lists.test.ts +2 -1
  101. package/tests/get-record.test.ts +5 -4
  102. package/tests/get-repo.test.ts +19 -8
  103. package/tests/get-starter-pack.test.ts +15 -4
  104. package/tests/moderation.test.ts +11 -2
  105. package/tests/repo-search.test.ts +4 -1
@@ -4989,6 +4989,7 @@ export const schemaDict = {
4989
4989
  'lex:app.bsky.embed.record#viewRecord',
4990
4990
  'lex:app.bsky.embed.record#viewNotFound',
4991
4991
  'lex:app.bsky.embed.record#viewBlocked',
4992
+ 'lex:app.bsky.embed.record#viewDetached',
4992
4993
  'lex:app.bsky.feed.defs#generatorView',
4993
4994
  'lex:app.bsky.graph.defs#listView',
4994
4995
  'lex:app.bsky.labeler.defs#labelerView',
@@ -5083,6 +5084,20 @@ export const schemaDict = {
5083
5084
  },
5084
5085
  },
5085
5086
  },
5087
+ viewDetached: {
5088
+ type: 'object',
5089
+ required: ['uri', 'detached'],
5090
+ properties: {
5091
+ uri: {
5092
+ type: 'string',
5093
+ format: 'at-uri',
5094
+ },
5095
+ detached: {
5096
+ type: 'boolean',
5097
+ const: true,
5098
+ },
5099
+ },
5100
+ },
5086
5101
  },
5087
5102
  },
5088
5103
  AppBskyEmbedRecordWithMedia: {
@@ -5165,6 +5180,9 @@ export const schemaDict = {
5165
5180
  likeCount: {
5166
5181
  type: 'integer',
5167
5182
  },
5183
+ quoteCount: {
5184
+ type: 'integer',
5185
+ },
5168
5186
  indexedAt: {
5169
5187
  type: 'string',
5170
5188
  format: 'datetime',
@@ -5205,6 +5223,9 @@ export const schemaDict = {
5205
5223
  replyDisabled: {
5206
5224
  type: 'boolean',
5207
5225
  },
5226
+ embeddingDisabled: {
5227
+ type: 'boolean',
5228
+ },
5208
5229
  },
5209
5230
  },
5210
5231
  feedViewPost: {
@@ -6280,6 +6301,69 @@ export const schemaDict = {
6280
6301
  },
6281
6302
  },
6282
6303
  },
6304
+ AppBskyFeedGetQuotes: {
6305
+ lexicon: 1,
6306
+ id: 'app.bsky.feed.getQuotes',
6307
+ defs: {
6308
+ main: {
6309
+ type: 'query',
6310
+ description: 'Get a list of quotes for a given post.',
6311
+ parameters: {
6312
+ type: 'params',
6313
+ required: ['uri'],
6314
+ properties: {
6315
+ uri: {
6316
+ type: 'string',
6317
+ format: 'at-uri',
6318
+ description: 'Reference (AT-URI) of post record',
6319
+ },
6320
+ cid: {
6321
+ type: 'string',
6322
+ format: 'cid',
6323
+ description:
6324
+ 'If supplied, filters to quotes of specific version (by CID) of the post record.',
6325
+ },
6326
+ limit: {
6327
+ type: 'integer',
6328
+ minimum: 1,
6329
+ maximum: 100,
6330
+ default: 50,
6331
+ },
6332
+ cursor: {
6333
+ type: 'string',
6334
+ },
6335
+ },
6336
+ },
6337
+ output: {
6338
+ encoding: 'application/json',
6339
+ schema: {
6340
+ type: 'object',
6341
+ required: ['uri', 'posts'],
6342
+ properties: {
6343
+ uri: {
6344
+ type: 'string',
6345
+ format: 'at-uri',
6346
+ },
6347
+ cid: {
6348
+ type: 'string',
6349
+ format: 'cid',
6350
+ },
6351
+ cursor: {
6352
+ type: 'string',
6353
+ },
6354
+ posts: {
6355
+ type: 'array',
6356
+ items: {
6357
+ type: 'ref',
6358
+ ref: 'lex:app.bsky.feed.defs#postView',
6359
+ },
6360
+ },
6361
+ },
6362
+ },
6363
+ },
6364
+ },
6365
+ },
6366
+ },
6283
6367
  AppBskyFeedGetRepostedBy: {
6284
6368
  lexicon: 1,
6285
6369
  id: 'app.bsky.feed.getRepostedBy',
@@ -6596,6 +6680,56 @@ export const schemaDict = {
6596
6680
  },
6597
6681
  },
6598
6682
  },
6683
+ AppBskyFeedPostgate: {
6684
+ lexicon: 1,
6685
+ id: 'app.bsky.feed.postgate',
6686
+ defs: {
6687
+ main: {
6688
+ type: 'record',
6689
+ key: 'tid',
6690
+ description:
6691
+ 'Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository.',
6692
+ record: {
6693
+ type: 'object',
6694
+ required: ['post', 'createdAt'],
6695
+ properties: {
6696
+ createdAt: {
6697
+ type: 'string',
6698
+ format: 'datetime',
6699
+ },
6700
+ post: {
6701
+ type: 'string',
6702
+ format: 'at-uri',
6703
+ description: 'Reference (AT-URI) to the post record.',
6704
+ },
6705
+ detachedEmbeddingUris: {
6706
+ type: 'array',
6707
+ maxLength: 50,
6708
+ items: {
6709
+ type: 'string',
6710
+ format: 'at-uri',
6711
+ },
6712
+ description:
6713
+ 'List of AT-URIs embedding this post that the author has detached from.',
6714
+ },
6715
+ embeddingRules: {
6716
+ type: 'array',
6717
+ maxLength: 5,
6718
+ items: {
6719
+ type: 'union',
6720
+ refs: ['lex:app.bsky.feed.postgate#disableRule'],
6721
+ },
6722
+ },
6723
+ },
6724
+ },
6725
+ },
6726
+ disableRule: {
6727
+ type: 'object',
6728
+ description: 'Disables embedding of this post.',
6729
+ properties: {},
6730
+ },
6731
+ },
6732
+ },
6599
6733
  AppBskyFeedRepost: {
6600
6734
  lexicon: 1,
6601
6735
  id: 'app.bsky.feed.repost',
@@ -6807,6 +6941,15 @@ export const schemaDict = {
6807
6941
  type: 'string',
6808
6942
  format: 'datetime',
6809
6943
  },
6944
+ hiddenReplies: {
6945
+ type: 'array',
6946
+ maxLength: 50,
6947
+ items: {
6948
+ type: 'string',
6949
+ format: 'at-uri',
6950
+ },
6951
+ description: 'List of hidden reply URIs.',
6952
+ },
6810
6953
  },
6811
6954
  },
6812
6955
  },
@@ -11792,11 +11935,13 @@ export const ids = {
11792
11935
  AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
11793
11936
  AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
11794
11937
  AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
11938
+ AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
11795
11939
  AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
11796
11940
  AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
11797
11941
  AppBskyFeedGetTimeline: 'app.bsky.feed.getTimeline',
11798
11942
  AppBskyFeedLike: 'app.bsky.feed.like',
11799
11943
  AppBskyFeedPost: 'app.bsky.feed.post',
11944
+ AppBskyFeedPostgate: 'app.bsky.feed.postgate',
11800
11945
  AppBskyFeedRepost: 'app.bsky.feed.repost',
11801
11946
  AppBskyFeedSearchPosts: 'app.bsky.feed.searchPosts',
11802
11947
  AppBskyFeedSendInteractions: 'app.bsky.feed.sendInteractions',
@@ -38,6 +38,7 @@ export interface View {
38
38
  | ViewRecord
39
39
  | ViewNotFound
40
40
  | ViewBlocked
41
+ | ViewDetached
41
42
  | AppBskyFeedDefs.GeneratorView
42
43
  | AppBskyGraphDefs.ListView
43
44
  | AppBskyLabelerDefs.LabelerView
@@ -125,3 +126,21 @@ export function isViewBlocked(v: unknown): v is ViewBlocked {
125
126
  export function validateViewBlocked(v: unknown): ValidationResult {
126
127
  return lexicons.validate('app.bsky.embed.record#viewBlocked', v)
127
128
  }
129
+
130
+ export interface ViewDetached {
131
+ uri: string
132
+ detached: true
133
+ [k: string]: unknown
134
+ }
135
+
136
+ export function isViewDetached(v: unknown): v is ViewDetached {
137
+ return (
138
+ isObj(v) &&
139
+ hasProp(v, '$type') &&
140
+ v.$type === 'app.bsky.embed.record#viewDetached'
141
+ )
142
+ }
143
+
144
+ export function validateViewDetached(v: unknown): ValidationResult {
145
+ return lexicons.validate('app.bsky.embed.record#viewDetached', v)
146
+ }
@@ -28,6 +28,7 @@ export interface PostView {
28
28
  replyCount?: number
29
29
  repostCount?: number
30
30
  likeCount?: number
31
+ quoteCount?: number
31
32
  indexedAt: string
32
33
  viewer?: ViewerState
33
34
  labels?: ComAtprotoLabelDefs.Label[]
@@ -51,6 +52,7 @@ export interface ViewerState {
51
52
  like?: string
52
53
  threadMuted?: boolean
53
54
  replyDisabled?: boolean
55
+ embeddingDisabled?: boolean
54
56
  [k: string]: unknown
55
57
  }
56
58
 
@@ -0,0 +1,54 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import { isObj, hasProp } from '../../../../util'
8
+ import { CID } from 'multiformats/cid'
9
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+ import * as AppBskyFeedDefs from './defs'
11
+
12
+ export interface QueryParams {
13
+ /** Reference (AT-URI) of post record */
14
+ uri: string
15
+ /** If supplied, filters to quotes of specific version (by CID) of the post record. */
16
+ cid?: string
17
+ limit: number
18
+ cursor?: string
19
+ }
20
+
21
+ export type InputSchema = undefined
22
+
23
+ export interface OutputSchema {
24
+ uri: string
25
+ cid?: string
26
+ cursor?: string
27
+ posts: AppBskyFeedDefs.PostView[]
28
+ [k: string]: unknown
29
+ }
30
+
31
+ export type HandlerInput = undefined
32
+
33
+ export interface HandlerSuccess {
34
+ encoding: 'application/json'
35
+ body: OutputSchema
36
+ headers?: { [key: string]: string }
37
+ }
38
+
39
+ export interface HandlerError {
40
+ status: number
41
+ message?: string
42
+ }
43
+
44
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
45
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
46
+ auth: HA
47
+ params: QueryParams
48
+ input: HandlerInput
49
+ req: express.Request
50
+ res: express.Response
51
+ }
52
+ export type Handler<HA extends HandlerAuth = never> = (
53
+ ctx: HandlerReqCtx<HA>,
54
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -0,0 +1,47 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { lexicons } from '../../../../lexicons'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { CID } from 'multiformats/cid'
8
+
9
+ export interface Record {
10
+ createdAt: string
11
+ /** Reference (AT-URI) to the post record. */
12
+ post: string
13
+ /** List of AT-URIs embedding this post that the author has detached from. */
14
+ detachedEmbeddingUris?: string[]
15
+ embeddingRules?: (DisableRule | { $type: string; [k: string]: unknown })[]
16
+ [k: string]: unknown
17
+ }
18
+
19
+ export function isRecord(v: unknown): v is Record {
20
+ return (
21
+ isObj(v) &&
22
+ hasProp(v, '$type') &&
23
+ (v.$type === 'app.bsky.feed.postgate#main' ||
24
+ v.$type === 'app.bsky.feed.postgate')
25
+ )
26
+ }
27
+
28
+ export function validateRecord(v: unknown): ValidationResult {
29
+ return lexicons.validate('app.bsky.feed.postgate#main', v)
30
+ }
31
+
32
+ /** Disables embedding of this post. */
33
+ export interface DisableRule {
34
+ [k: string]: unknown
35
+ }
36
+
37
+ export function isDisableRule(v: unknown): v is DisableRule {
38
+ return (
39
+ isObj(v) &&
40
+ hasProp(v, '$type') &&
41
+ v.$type === 'app.bsky.feed.postgate#disableRule'
42
+ )
43
+ }
44
+
45
+ export function validateDisableRule(v: unknown): ValidationResult {
46
+ return lexicons.validate('app.bsky.feed.postgate#disableRule', v)
47
+ }
@@ -16,6 +16,8 @@ export interface Record {
16
16
  | { $type: string; [k: string]: unknown }
17
17
  )[]
18
18
  createdAt: string
19
+ /** List of hidden reply URIs. */
20
+ hiddenReplies?: string[]
19
21
  [k: string]: unknown
20
22
  }
21
23
 
@@ -49,6 +49,7 @@ import { ImageInvalidator } from '../image-invalidator'
49
49
  import { httpLogger as log } from '../logger'
50
50
  import { OzoneConfig } from '../config'
51
51
  import { LABELER_HEADER_NAME, ParsedLabelers } from '../util'
52
+ import { ids } from '../lexicon/lexicons'
52
53
 
53
54
  export type ModerationServiceCreator = (db: Database) => ModerationService
54
55
 
@@ -62,7 +63,10 @@ export class ModerationService {
62
63
  public idResolver: IdResolver,
63
64
  public eventPusher: EventPusher,
64
65
  public appviewAgent: AtpAgent,
65
- private createAuthHeaders: (aud: string) => Promise<AuthHeaders>,
66
+ private createAuthHeaders: (
67
+ aud: string,
68
+ method: string,
69
+ ) => Promise<AuthHeaders>,
66
70
  public imgInvalidator?: ImageInvalidator,
67
71
  ) {}
68
72
 
@@ -74,7 +78,7 @@ export class ModerationService {
74
78
  idResolver: IdResolver,
75
79
  eventPusher: EventPusher,
76
80
  appviewAgent: AtpAgent,
77
- createAuthHeaders: (aud: string) => Promise<AuthHeaders>,
81
+ createAuthHeaders: (aud: string, method: string) => Promise<AuthHeaders>,
78
82
  imgInvalidator?: ImageInvalidator,
79
83
  ) {
80
84
  return (db: Database) =>
@@ -97,8 +101,11 @@ export class ModerationService {
97
101
  this.signingKey,
98
102
  this.signingKeyId,
99
103
  this.appviewAgent,
100
- async (labelers?: ParsedLabelers) => {
101
- const authHeaders = await this.createAuthHeaders(this.cfg.appview.did)
104
+ async (method: string, labelers?: ParsedLabelers) => {
105
+ const authHeaders = await this.createAuthHeaders(
106
+ this.cfg.appview.did,
107
+ method,
108
+ )
102
109
  if (labelers?.dids?.length) {
103
110
  authHeaders.headers[LABELER_HEADER_NAME] = labelers.dids.join(', ')
104
111
  }
@@ -936,7 +943,10 @@ export class ModerationService {
936
943
  },
937
944
  {
938
945
  encoding: 'application/json',
939
- ...(await this.createAuthHeaders(serverInfo.did)),
946
+ ...(await this.createAuthHeaders(
947
+ serverInfo.did,
948
+ ids.ComAtprotoAdminSendEmail,
949
+ )),
940
950
  },
941
951
  )
942
952
  if (!delivery.sent) {
@@ -29,6 +29,7 @@ import { LabelRow } from '../db/schema/label'
29
29
  import { dbLogger } from '../logger'
30
30
  import { httpLogger } from '../logger'
31
31
  import { ParsedLabelers } from '../util'
32
+ import { ids } from '../lexicon/lexicons'
32
33
 
33
34
  export type AuthHeaders = {
34
35
  headers: {
@@ -43,12 +44,12 @@ export class ModerationViews {
43
44
  private signingKey: Keypair,
44
45
  private signingKeyId: number,
45
46
  private appviewAgent: AtpAgent,
46
- private appviewAuth: () => Promise<AuthHeaders>,
47
+ private appviewAuth: (method: string) => Promise<AuthHeaders>,
47
48
  ) {}
48
49
 
49
50
  async getAccoutInfosByDid(dids: string[]): Promise<Map<string, AccountView>> {
50
51
  if (dids.length === 0) return new Map()
51
- const auth = await this.appviewAuth()
52
+ const auth = await this.appviewAuth(ids.ComAtprotoAdminGetAccountInfos)
52
53
  if (!auth) return new Map()
53
54
  try {
54
55
  const res = await this.appviewAgent.api.com.atproto.admin.getAccountInfos(
@@ -236,7 +237,7 @@ export class ModerationViews {
236
237
  async fetchRecords(
237
238
  subjects: RecordSubject[],
238
239
  ): Promise<Map<string, RecordInfo>> {
239
- const auth = await this.appviewAuth()
240
+ const auth = await this.appviewAuth(ids.ComAtprotoRepoGetRecord)
240
241
  if (!auth) return new Map()
241
242
  const fetched = await Promise.all(
242
243
  subjects.map(async (subject) => {
@@ -547,7 +548,7 @@ export class ModerationViews {
547
548
  async fetchAuthorFeed(
548
549
  actor: string,
549
550
  ): Promise<AppBskyFeedDefs.FeedViewPost[]> {
550
- const auth = await this.appviewAuth()
551
+ const auth = await this.appviewAuth(ids.AppBskyFeedGetAuthorFeed)
551
552
  if (!auth) return []
552
553
  const {
553
554
  data: { feed },
package/src/team/index.ts CHANGED
@@ -7,6 +7,7 @@ import { InvalidRequestError } from '@atproto/xrpc-server'
7
7
  import { chunkArray } from '@atproto/common'
8
8
  import AppContext from '../context'
9
9
  import { httpLogger } from '../logger'
10
+ import { ids } from '../lexicon/lexicons'
10
11
 
11
12
  export type TeamServiceCreator = (db: Database) => TeamService
12
13
 
@@ -168,7 +169,7 @@ export class TeamService {
168
169
  const profiles = new Map<string, ProfileViewDetailed>()
169
170
 
170
171
  try {
171
- const headers = await ctx.appviewAuth()
172
+ const headers = await ctx.appviewAuth(ids.AppBskyActorGetProfiles)
172
173
 
173
174
  for (const actors of chunkArray(dids, 25)) {
174
175
  const { data } = await ctx.appviewAgent.api.app.bsky.actor.getProfiles(
@@ -9,6 +9,7 @@ import {
9
9
  import { AtpAgent } from '@atproto/api'
10
10
  import { Secp256k1Keypair } from '@atproto/crypto'
11
11
  import { LABELER_HEADER_NAME } from '../src/util'
12
+ import { ids } from '../src/lexicon/lexicons'
12
13
 
13
14
  describe('labels from 3p labelers', () => {
14
15
  let network: TestNetwork
@@ -170,11 +171,17 @@ describe('labels from 3p labelers', () => {
170
171
  ] = await Promise.all([
171
172
  agent.api.tools.ozone.moderation.getRecord(
172
173
  { uri: sc.posts[sc.dids.alice][0].ref.uriStr },
173
- { headers: await ozone.modHeaders() },
174
+ {
175
+ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecord),
176
+ },
174
177
  ),
175
178
  thirdPartyAgent.api.tools.ozone.moderation.getRecord(
176
179
  { uri: sc.posts[sc.dids.alice][0].ref.uriStr },
177
- { headers: await thirdPartyLabeler.modHeaders() },
180
+ {
181
+ headers: await thirdPartyLabeler.modHeaders(
182
+ ids.ToolsOzoneModerationGetRecord,
183
+ ),
184
+ },
178
185
  ),
179
186
  ])
180
187
 
@@ -189,7 +196,9 @@ describe('labels from 3p labelers', () => {
189
196
  })
190
197
 
191
198
  it('includes labels from all authorities requested via header', async () => {
192
- const authHeaders = await ozone.modHeaders()
199
+ const authHeaders = await ozone.modHeaders(
200
+ ids.ToolsOzoneModerationGetRecord,
201
+ )
193
202
  const { data: recordIncludingExternalLabels } =
194
203
  await agent.api.tools.ozone.moderation.getRecord(
195
204
  { uri: sc.posts[sc.dids.alice][0].ref.uriStr },
@@ -225,11 +234,17 @@ describe('labels from 3p labelers', () => {
225
234
  await Promise.all([
226
235
  agent.api.tools.ozone.moderation.getRepo(
227
236
  { did: sc.dids.alice },
228
- { headers: await ozone.modHeaders() },
237
+ {
238
+ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo),
239
+ },
229
240
  ),
230
241
  thirdPartyAgent.api.tools.ozone.moderation.getRepo(
231
242
  { did: sc.dids.alice },
232
- { headers: await thirdPartyLabeler.modHeaders() },
243
+ {
244
+ headers: await thirdPartyLabeler.modHeaders(
245
+ ids.ToolsOzoneModerationGetRepo,
246
+ ),
247
+ },
233
248
  ),
234
249
  ])
235
250
 
@@ -244,7 +259,9 @@ describe('labels from 3p labelers', () => {
244
259
  })
245
260
 
246
261
  it('includes labels from all authorities requested via header', async () => {
247
- const authHeaders = await ozone.modHeaders()
262
+ const authHeaders = await ozone.modHeaders(
263
+ ids.ToolsOzoneModerationGetRepo,
264
+ )
248
265
  const { data: recordIncludingExternalLabels } =
249
266
  await agent.api.tools.ozone.moderation.getRepo(
250
267
  { did: sc.dids.alice },
@@ -1,5 +1,6 @@
1
1
  import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
2
2
  import { AtpAgent } from '@atproto/api'
3
+ import { ids } from '../src/lexicon/lexicons'
3
4
 
4
5
  describe('communication-templates', () => {
5
6
  let network: TestNetwork
@@ -30,7 +31,10 @@ describe('communication-templates', () => {
30
31
  const { data } = await agent.api.tools.ozone.communication.listTemplates(
31
32
  {},
32
33
  {
33
- headers: await network.ozone.modHeaders('moderator'),
34
+ headers: await network.ozone.modHeaders(
35
+ ids.ToolsOzoneCommunicationListTemplates,
36
+ 'moderator',
37
+ ),
34
38
  },
35
39
  )
36
40
  return data.communicationTemplates
@@ -42,7 +46,10 @@ describe('communication-templates', () => {
42
46
  { ...templateOne, createdBy: sc.dids.bob },
43
47
  {
44
48
  encoding: 'application/json',
45
- headers: await network.ozone.modHeaders('triage'),
49
+ headers: await network.ozone.modHeaders(
50
+ ids.ToolsOzoneCommunicationCreateTemplate,
51
+ 'triage',
52
+ ),
46
53
  },
47
54
  )
48
55
  await expect(moderatorReq).rejects.toThrow(
@@ -52,7 +59,10 @@ describe('communication-templates', () => {
52
59
  { ...templateOne, createdBy: sc.dids.bob },
53
60
  {
54
61
  encoding: 'application/json',
55
- headers: await network.ozone.modHeaders('admin'),
62
+ headers: await network.ozone.modHeaders(
63
+ ids.ToolsOzoneCommunicationCreateTemplate,
64
+ 'admin',
65
+ ),
56
66
  },
57
67
  )
58
68
 
@@ -76,7 +86,10 @@ describe('communication-templates', () => {
76
86
  { ...templateTwo, createdBy: sc.dids.bob },
77
87
  {
78
88
  encoding: 'application/json',
79
- headers: await network.ozone.modHeaders('admin'),
89
+ headers: await network.ozone.modHeaders(
90
+ ids.ToolsOzoneCommunicationCreateTemplate,
91
+ 'admin',
92
+ ),
80
93
  },
81
94
  )
82
95
 
@@ -91,7 +104,10 @@ describe('communication-templates', () => {
91
104
  { id: '1', updatedBy: sc.dids.bob, name: '1 Test template' },
92
105
  {
93
106
  encoding: 'application/json',
94
- headers: await network.ozone.modHeaders('admin'),
107
+ headers: await network.ozone.modHeaders(
108
+ ids.ToolsOzoneCommunicationUpdateTemplate,
109
+ 'admin',
110
+ ),
95
111
  },
96
112
  )
97
113
 
@@ -105,7 +121,10 @@ describe('communication-templates', () => {
105
121
  { id: '1' },
106
122
  {
107
123
  encoding: 'application/json',
108
- headers: await network.ozone.modHeaders('triage'),
124
+ headers: await network.ozone.modHeaders(
125
+ ids.ToolsOzoneCommunicationDeleteTemplate,
126
+ 'triage',
127
+ ),
109
128
  },
110
129
  )
111
130
 
@@ -117,7 +136,10 @@ describe('communication-templates', () => {
117
136
  { id: '1' },
118
137
  {
119
138
  encoding: 'application/json',
120
- headers: await network.ozone.modHeaders('moderator'),
139
+ headers: await network.ozone.modHeaders(
140
+ ids.ToolsOzoneCommunicationDeleteTemplate,
141
+ 'moderator',
142
+ ),
121
143
  },
122
144
  )
123
145
  const list = await listTemplates()
@@ -1,6 +1,7 @@
1
1
  import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
2
2
  import { AtpAgent } from '@atproto/api'
3
3
  import { TOOLS_OZONE_TEAM } from '../src/lexicon'
4
+ import { ids } from '../src/lexicon/lexicons'
4
5
 
5
6
  describe('get-config', () => {
6
7
  let network: TestNetwork
@@ -25,7 +26,10 @@ describe('get-config', () => {
25
26
  const { data } = await agent.api.tools.ozone.server.getConfig(
26
27
  {},
27
28
  {
28
- headers: await network.ozone.modHeaders(role),
29
+ headers: await network.ozone.modHeaders(
30
+ ids.ToolsOzoneServerGetConfig,
31
+ role,
32
+ ),
29
33
  },
30
34
  )
31
35
  return data
@@ -8,6 +8,7 @@ import {
8
8
  } from '@atproto/dev-env'
9
9
  import { AtpAgent, BSKY_LABELER_DID } from '@atproto/api'
10
10
  import { TAKEDOWN_LABEL } from '../src/mod-service'
11
+ import { ids } from '../src/lexicon/lexicons'
11
12
 
12
13
  describe('admin get lists', () => {
13
14
  let network: TestNetwork
@@ -42,7 +43,7 @@ describe('admin get lists', () => {
42
43
  const [{ data: fromOzone }, { data: fromAppview }] = await Promise.all([
43
44
  agent.api.app.bsky.graph.getLists(
44
45
  { actor: sc.dids.alice },
45
- { headers: await ozone.modHeaders() },
46
+ { headers: await ozone.modHeaders(ids.AppBskyGraphGetLists) },
46
47
  ),
47
48
  appviewAgent.api.app.bsky.graph.getLists({ actor: sc.dids.alice }),
48
49
  ])