@atproto/ozone 0.1.55 → 0.1.57

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 (64) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/moderation/emitEvent.d.ts.map +1 -1
  3. package/dist/api/moderation/emitEvent.js +66 -11
  4. package/dist/api/moderation/emitEvent.js.map +1 -1
  5. package/dist/api/setting/upsertOption.d.ts.map +1 -1
  6. package/dist/api/setting/upsertOption.js +7 -2
  7. package/dist/api/setting/upsertOption.js.map +1 -1
  8. package/dist/lexicon/index.d.ts +6 -0
  9. package/dist/lexicon/index.d.ts.map +1 -1
  10. package/dist/lexicon/index.js +12 -0
  11. package/dist/lexicon/index.js.map +1 -1
  12. package/dist/lexicon/lexicons.d.ts +151 -0
  13. package/dist/lexicon/lexicons.d.ts.map +1 -1
  14. package/dist/lexicon/lexicons.js +160 -1
  15. package/dist/lexicon/lexicons.js.map +1 -1
  16. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +1 -1
  17. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  18. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  19. package/dist/lexicon/types/app/bsky/graph/searchStarterPacks.d.ts +40 -0
  20. package/dist/lexicon/types/app/bsky/graph/searchStarterPacks.d.ts.map +1 -0
  21. package/dist/lexicon/types/app/bsky/graph/searchStarterPacks.js +3 -0
  22. package/dist/lexicon/types/app/bsky/graph/searchStarterPacks.js.map +1 -0
  23. package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts +6 -0
  24. package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts.map +1 -1
  25. package/dist/lexicon/types/app/bsky/unspecced/defs.js +10 -0
  26. package/dist/lexicon/types/app/bsky/unspecced/defs.js.map +1 -1
  27. package/dist/lexicon/types/app/bsky/unspecced/searchStarterPacksSkeleton.d.ts +46 -0
  28. package/dist/lexicon/types/app/bsky/unspecced/searchStarterPacksSkeleton.d.ts.map +1 -0
  29. package/dist/lexicon/types/app/bsky/unspecced/searchStarterPacksSkeleton.js +3 -0
  30. package/dist/lexicon/types/app/bsky/unspecced/searchStarterPacksSkeleton.js.map +1 -0
  31. package/dist/lexicon/types/com/atproto/temp/addReservedHandle.d.ts +39 -0
  32. package/dist/lexicon/types/com/atproto/temp/addReservedHandle.d.ts.map +1 -0
  33. package/dist/lexicon/types/com/atproto/temp/addReservedHandle.js +3 -0
  34. package/dist/lexicon/types/com/atproto/temp/addReservedHandle.js.map +1 -0
  35. package/dist/setting/constants.d.ts +2 -0
  36. package/dist/setting/constants.d.ts.map +1 -0
  37. package/dist/setting/constants.js +5 -0
  38. package/dist/setting/constants.js.map +1 -0
  39. package/dist/setting/types.d.ts +7 -0
  40. package/dist/setting/types.d.ts.map +1 -0
  41. package/dist/setting/types.js +3 -0
  42. package/dist/setting/types.js.map +1 -0
  43. package/dist/setting/validators.d.ts +4 -0
  44. package/dist/setting/validators.d.ts.map +1 -0
  45. package/dist/setting/validators.js +43 -0
  46. package/dist/setting/validators.js.map +1 -0
  47. package/package.json +3 -3
  48. package/src/api/moderation/emitEvent.ts +114 -13
  49. package/src/api/setting/upsertOption.ts +10 -3
  50. package/src/lexicon/index.ts +36 -0
  51. package/src/lexicon/lexicons.ts +167 -1
  52. package/src/lexicon/types/app/bsky/actor/defs.ts +7 -1
  53. package/src/lexicon/types/app/bsky/graph/searchStarterPacks.ts +50 -0
  54. package/src/lexicon/types/app/bsky/unspecced/defs.ts +24 -0
  55. package/src/lexicon/types/app/bsky/unspecced/searchStarterPacksSkeleton.ts +56 -0
  56. package/src/lexicon/types/com/atproto/temp/addReservedHandle.ts +48 -0
  57. package/src/setting/constants.ts +1 -0
  58. package/src/setting/types.ts +3 -0
  59. package/src/setting/validators.ts +61 -0
  60. package/tests/3p-labeler.test.ts +2 -2
  61. package/tests/protected-tags.test.ts +201 -0
  62. package/tests/settings.test.ts +24 -26
  63. package/tsconfig.build.tsbuildinfo +1 -1
  64. package/tsconfig.tests.tsbuildinfo +1 -1
@@ -6,6 +6,7 @@ import { SettingService } from '../../setting/service'
6
6
  import { Member } from '../../db/schema/member'
7
7
  import { ToolsOzoneTeamDefs } from '@atproto/api'
8
8
  import assert from 'node:assert'
9
+ import { settingValidators } from '../../setting/validators'
9
10
 
10
11
  export default function (server: Server, ctx: AppContext) {
11
12
  server.tools.ozone.setting.upsertOption({
@@ -63,11 +64,17 @@ export default function (server: Server, ctx: AppContext) {
63
64
  ) {
64
65
  throw new AuthRequiredError(`Not permitted to update setting ${key}`)
65
66
  }
66
- await settingService.upsert({
67
+ const option = {
67
68
  ...baseOption,
68
- scope: 'instance',
69
+ scope: 'instance' as const,
69
70
  managerRole: getManagerRole(managerRole),
70
- })
71
+ }
72
+
73
+ if (settingValidators.has(key)) {
74
+ await settingValidators.get(key)?.(option)
75
+ }
76
+
77
+ await settingService.upsert(option)
71
78
  }
72
79
 
73
80
  const newOption = await getExistingSetting(
@@ -80,6 +80,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
80
80
  import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
81
81
  import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
82
82
  import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
83
+ import * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle'
83
84
  import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
84
85
  import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
85
86
  import * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification'
@@ -125,6 +126,7 @@ import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/
125
126
  import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor'
126
127
  import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList'
127
128
  import * as AppBskyGraphMuteThread from './types/app/bsky/graph/muteThread'
129
+ import * as AppBskyGraphSearchStarterPacks from './types/app/bsky/graph/searchStarterPacks'
128
130
  import * as AppBskyGraphUnmuteActor from './types/app/bsky/graph/unmuteActor'
129
131
  import * as AppBskyGraphUnmuteActorList from './types/app/bsky/graph/unmuteActorList'
130
132
  import * as AppBskyGraphUnmuteThread from './types/app/bsky/graph/unmuteThread'
@@ -140,6 +142,7 @@ import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspec
140
142
  import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
141
143
  import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
142
144
  import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
145
+ import * as AppBskyUnspeccedSearchStarterPacksSkeleton from './types/app/bsky/unspecced/searchStarterPacksSkeleton'
143
146
  import * as AppBskyVideoGetJobStatus from './types/app/bsky/video/getJobStatus'
144
147
  import * as AppBskyVideoGetUploadLimits from './types/app/bsky/video/getUploadLimits'
145
148
  import * as AppBskyVideoUploadVideo from './types/app/bsky/video/uploadVideo'
@@ -1133,6 +1136,17 @@ export class ComAtprotoTempNS {
1133
1136
  this._server = server
1134
1137
  }
1135
1138
 
1139
+ addReservedHandle<AV extends AuthVerifier>(
1140
+ cfg: ConfigOf<
1141
+ AV,
1142
+ ComAtprotoTempAddReservedHandle.Handler<ExtractAuth<AV>>,
1143
+ ComAtprotoTempAddReservedHandle.HandlerReqCtx<ExtractAuth<AV>>
1144
+ >,
1145
+ ) {
1146
+ const nsid = 'com.atproto.temp.addReservedHandle' // @ts-ignore
1147
+ return this._server.xrpc.method(nsid, cfg)
1148
+ }
1149
+
1136
1150
  checkSignupQueue<AV extends AuthVerifier>(
1137
1151
  cfg: ConfigOf<
1138
1152
  AV,
@@ -1696,6 +1710,17 @@ export class AppBskyGraphNS {
1696
1710
  return this._server.xrpc.method(nsid, cfg)
1697
1711
  }
1698
1712
 
1713
+ searchStarterPacks<AV extends AuthVerifier>(
1714
+ cfg: ConfigOf<
1715
+ AV,
1716
+ AppBskyGraphSearchStarterPacks.Handler<ExtractAuth<AV>>,
1717
+ AppBskyGraphSearchStarterPacks.HandlerReqCtx<ExtractAuth<AV>>
1718
+ >,
1719
+ ) {
1720
+ const nsid = 'app.bsky.graph.searchStarterPacks' // @ts-ignore
1721
+ return this._server.xrpc.method(nsid, cfg)
1722
+ }
1723
+
1699
1724
  unmuteActor<AV extends AuthVerifier>(
1700
1725
  cfg: ConfigOf<
1701
1726
  AV,
@@ -1892,6 +1917,17 @@ export class AppBskyUnspeccedNS {
1892
1917
  const nsid = 'app.bsky.unspecced.searchPostsSkeleton' // @ts-ignore
1893
1918
  return this._server.xrpc.method(nsid, cfg)
1894
1919
  }
1920
+
1921
+ searchStarterPacksSkeleton<AV extends AuthVerifier>(
1922
+ cfg: ConfigOf<
1923
+ AV,
1924
+ AppBskyUnspeccedSearchStarterPacksSkeleton.Handler<ExtractAuth<AV>>,
1925
+ AppBskyUnspeccedSearchStarterPacksSkeleton.HandlerReqCtx<ExtractAuth<AV>>
1926
+ >,
1927
+ ) {
1928
+ const nsid = 'app.bsky.unspecced.searchStarterPacksSkeleton' // @ts-ignore
1929
+ return this._server.xrpc.method(nsid, cfg)
1930
+ }
1895
1931
  }
1896
1932
 
1897
1933
  export class AppBskyVideoNS {
@@ -3959,6 +3959,35 @@ export const schemaDict = {
3959
3959
  },
3960
3960
  },
3961
3961
  },
3962
+ ComAtprotoTempAddReservedHandle: {
3963
+ lexicon: 1,
3964
+ id: 'com.atproto.temp.addReservedHandle',
3965
+ defs: {
3966
+ main: {
3967
+ type: 'procedure',
3968
+ description: 'Add a handle to the set of reserved handles.',
3969
+ input: {
3970
+ encoding: 'application/json',
3971
+ schema: {
3972
+ type: 'object',
3973
+ required: ['handle'],
3974
+ properties: {
3975
+ handle: {
3976
+ type: 'string',
3977
+ },
3978
+ },
3979
+ },
3980
+ },
3981
+ output: {
3982
+ encoding: 'application/json',
3983
+ schema: {
3984
+ type: 'object',
3985
+ properties: {},
3986
+ },
3987
+ },
3988
+ },
3989
+ },
3990
+ },
3962
3991
  ComAtprotoTempCheckSignupQueue: {
3963
3992
  lexicon: 1,
3964
3993
  id: 'com.atproto.temp.checkSignupQueue',
@@ -4461,7 +4490,13 @@ export const schemaDict = {
4461
4490
  sort: {
4462
4491
  type: 'string',
4463
4492
  description: 'Sorting mode for threads.',
4464
- knownValues: ['oldest', 'newest', 'most-likes', 'random'],
4493
+ knownValues: [
4494
+ 'oldest',
4495
+ 'newest',
4496
+ 'most-likes',
4497
+ 'random',
4498
+ 'hotness',
4499
+ ],
4465
4500
  },
4466
4501
  prioritizeFollowedUsers: {
4467
4502
  type: 'boolean',
@@ -8488,6 +8523,56 @@ export const schemaDict = {
8488
8523
  },
8489
8524
  },
8490
8525
  },
8526
+ AppBskyGraphSearchStarterPacks: {
8527
+ lexicon: 1,
8528
+ id: 'app.bsky.graph.searchStarterPacks',
8529
+ defs: {
8530
+ main: {
8531
+ type: 'query',
8532
+ description:
8533
+ 'Find starter packs matching search criteria. Does not require auth.',
8534
+ parameters: {
8535
+ type: 'params',
8536
+ required: ['q'],
8537
+ properties: {
8538
+ q: {
8539
+ type: 'string',
8540
+ description:
8541
+ 'Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended.',
8542
+ },
8543
+ limit: {
8544
+ type: 'integer',
8545
+ minimum: 1,
8546
+ maximum: 100,
8547
+ default: 25,
8548
+ },
8549
+ cursor: {
8550
+ type: 'string',
8551
+ },
8552
+ },
8553
+ },
8554
+ output: {
8555
+ encoding: 'application/json',
8556
+ schema: {
8557
+ type: 'object',
8558
+ required: ['starterPacks'],
8559
+ properties: {
8560
+ cursor: {
8561
+ type: 'string',
8562
+ },
8563
+ starterPacks: {
8564
+ type: 'array',
8565
+ items: {
8566
+ type: 'ref',
8567
+ ref: 'lex:app.bsky.graph.defs#starterPackViewBasic',
8568
+ },
8569
+ },
8570
+ },
8571
+ },
8572
+ },
8573
+ },
8574
+ },
8575
+ },
8491
8576
  AppBskyGraphStarterpack: {
8492
8577
  lexicon: 1,
8493
8578
  id: 'app.bsky.graph.starterpack',
@@ -9153,6 +9238,16 @@ export const schemaDict = {
9153
9238
  },
9154
9239
  },
9155
9240
  },
9241
+ skeletonSearchStarterPack: {
9242
+ type: 'object',
9243
+ required: ['uri'],
9244
+ properties: {
9245
+ uri: {
9246
+ type: 'string',
9247
+ format: 'at-uri',
9248
+ },
9249
+ },
9250
+ },
9156
9251
  },
9157
9252
  },
9158
9253
  AppBskyUnspeccedGetConfig: {
@@ -9526,6 +9621,73 @@ export const schemaDict = {
9526
9621
  },
9527
9622
  },
9528
9623
  },
9624
+ AppBskyUnspeccedSearchStarterPacksSkeleton: {
9625
+ lexicon: 1,
9626
+ id: 'app.bsky.unspecced.searchStarterPacksSkeleton',
9627
+ defs: {
9628
+ main: {
9629
+ type: 'query',
9630
+ description: 'Backend Starter Pack search, returns only skeleton.',
9631
+ parameters: {
9632
+ type: 'params',
9633
+ required: ['q'],
9634
+ properties: {
9635
+ q: {
9636
+ type: 'string',
9637
+ description:
9638
+ 'Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended.',
9639
+ },
9640
+ viewer: {
9641
+ type: 'string',
9642
+ format: 'did',
9643
+ description:
9644
+ 'DID of the account making the request (not included for public/unauthenticated queries).',
9645
+ },
9646
+ limit: {
9647
+ type: 'integer',
9648
+ minimum: 1,
9649
+ maximum: 100,
9650
+ default: 25,
9651
+ },
9652
+ cursor: {
9653
+ type: 'string',
9654
+ description:
9655
+ 'Optional pagination mechanism; may not necessarily allow scrolling through entire result set.',
9656
+ },
9657
+ },
9658
+ },
9659
+ output: {
9660
+ encoding: 'application/json',
9661
+ schema: {
9662
+ type: 'object',
9663
+ required: ['starterPacks'],
9664
+ properties: {
9665
+ cursor: {
9666
+ type: 'string',
9667
+ },
9668
+ hitsTotal: {
9669
+ type: 'integer',
9670
+ description:
9671
+ 'Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits.',
9672
+ },
9673
+ starterPacks: {
9674
+ type: 'array',
9675
+ items: {
9676
+ type: 'ref',
9677
+ ref: 'lex:app.bsky.unspecced.defs#skeletonSearchStarterPack',
9678
+ },
9679
+ },
9680
+ },
9681
+ },
9682
+ },
9683
+ errors: [
9684
+ {
9685
+ name: 'BadQueryString',
9686
+ },
9687
+ ],
9688
+ },
9689
+ },
9690
+ },
9529
9691
  AppBskyVideoDefs: {
9530
9692
  lexicon: 1,
9531
9693
  id: 'app.bsky.video.defs',
@@ -13417,6 +13579,7 @@ export const ids = {
13417
13579
  ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
13418
13580
  ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
13419
13581
  ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
13582
+ ComAtprotoTempAddReservedHandle: 'com.atproto.temp.addReservedHandle',
13420
13583
  ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
13421
13584
  ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
13422
13585
  ComAtprotoTempRequestPhoneVerification:
@@ -13485,6 +13648,7 @@ export const ids = {
13485
13648
  AppBskyGraphMuteActor: 'app.bsky.graph.muteActor',
13486
13649
  AppBskyGraphMuteActorList: 'app.bsky.graph.muteActorList',
13487
13650
  AppBskyGraphMuteThread: 'app.bsky.graph.muteThread',
13651
+ AppBskyGraphSearchStarterPacks: 'app.bsky.graph.searchStarterPacks',
13488
13652
  AppBskyGraphStarterpack: 'app.bsky.graph.starterpack',
13489
13653
  AppBskyGraphUnmuteActor: 'app.bsky.graph.unmuteActor',
13490
13654
  AppBskyGraphUnmuteActorList: 'app.bsky.graph.unmuteActorList',
@@ -13510,6 +13674,8 @@ export const ids = {
13510
13674
  AppBskyUnspeccedSearchActorsSkeleton:
13511
13675
  'app.bsky.unspecced.searchActorsSkeleton',
13512
13676
  AppBskyUnspeccedSearchPostsSkeleton: 'app.bsky.unspecced.searchPostsSkeleton',
13677
+ AppBskyUnspeccedSearchStarterPacksSkeleton:
13678
+ 'app.bsky.unspecced.searchStarterPacksSkeleton',
13513
13679
  AppBskyVideoDefs: 'app.bsky.video.defs',
13514
13680
  AppBskyVideoGetJobStatus: 'app.bsky.video.getJobStatus',
13515
13681
  AppBskyVideoGetUploadLimits: 'app.bsky.video.getUploadLimits',
@@ -332,7 +332,13 @@ export function validateFeedViewPref(v: unknown): ValidationResult {
332
332
 
333
333
  export interface ThreadViewPref {
334
334
  /** Sorting mode for threads. */
335
- sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {})
335
+ sort?:
336
+ | 'oldest'
337
+ | 'newest'
338
+ | 'most-likes'
339
+ | 'random'
340
+ | 'hotness'
341
+ | (string & {})
336
342
  /** Show followed users at the top of all replies. */
337
343
  prioritizeFollowedUsers?: boolean
338
344
  [k: string]: unknown
@@ -0,0 +1,50 @@
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 AppBskyGraphDefs from './defs'
11
+
12
+ export interface QueryParams {
13
+ /** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
14
+ q: string
15
+ limit: number
16
+ cursor?: string
17
+ }
18
+
19
+ export type InputSchema = undefined
20
+
21
+ export interface OutputSchema {
22
+ cursor?: string
23
+ starterPacks: AppBskyGraphDefs.StarterPackViewBasic[]
24
+ [k: string]: unknown
25
+ }
26
+
27
+ export type HandlerInput = undefined
28
+
29
+ export interface HandlerSuccess {
30
+ encoding: 'application/json'
31
+ body: OutputSchema
32
+ headers?: { [key: string]: string }
33
+ }
34
+
35
+ export interface HandlerError {
36
+ status: number
37
+ message?: string
38
+ }
39
+
40
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
41
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
42
+ auth: HA
43
+ params: QueryParams
44
+ input: HandlerInput
45
+ req: express.Request
46
+ res: express.Response
47
+ }
48
+ export type Handler<HA extends HandlerAuth = never> = (
49
+ ctx: HandlerReqCtx<HA>,
50
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -39,3 +39,27 @@ export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor {
39
39
  export function validateSkeletonSearchActor(v: unknown): ValidationResult {
40
40
  return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v)
41
41
  }
42
+
43
+ export interface SkeletonSearchStarterPack {
44
+ uri: string
45
+ [k: string]: unknown
46
+ }
47
+
48
+ export function isSkeletonSearchStarterPack(
49
+ v: unknown,
50
+ ): v is SkeletonSearchStarterPack {
51
+ return (
52
+ isObj(v) &&
53
+ hasProp(v, '$type') &&
54
+ v.$type === 'app.bsky.unspecced.defs#skeletonSearchStarterPack'
55
+ )
56
+ }
57
+
58
+ export function validateSkeletonSearchStarterPack(
59
+ v: unknown,
60
+ ): ValidationResult {
61
+ return lexicons.validate(
62
+ 'app.bsky.unspecced.defs#skeletonSearchStarterPack',
63
+ v,
64
+ )
65
+ }
@@ -0,0 +1,56 @@
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 AppBskyUnspeccedDefs from './defs'
11
+
12
+ export interface QueryParams {
13
+ /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
14
+ q: string
15
+ /** DID of the account making the request (not included for public/unauthenticated queries). */
16
+ viewer?: string
17
+ limit: number
18
+ /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
19
+ cursor?: string
20
+ }
21
+
22
+ export type InputSchema = undefined
23
+
24
+ export interface OutputSchema {
25
+ cursor?: string
26
+ /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
27
+ hitsTotal?: number
28
+ starterPacks: AppBskyUnspeccedDefs.SkeletonSearchStarterPack[]
29
+ [k: string]: unknown
30
+ }
31
+
32
+ export type HandlerInput = undefined
33
+
34
+ export interface HandlerSuccess {
35
+ encoding: 'application/json'
36
+ body: OutputSchema
37
+ headers?: { [key: string]: string }
38
+ }
39
+
40
+ export interface HandlerError {
41
+ status: number
42
+ message?: string
43
+ error?: 'BadQueryString'
44
+ }
45
+
46
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
47
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
48
+ auth: HA
49
+ params: QueryParams
50
+ input: HandlerInput
51
+ req: express.Request
52
+ res: express.Response
53
+ }
54
+ export type Handler<HA extends HandlerAuth = never> = (
55
+ ctx: HandlerReqCtx<HA>,
56
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -0,0 +1,48 @@
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
+
11
+ export interface QueryParams {}
12
+
13
+ export interface InputSchema {
14
+ handle: string
15
+ [k: string]: unknown
16
+ }
17
+
18
+ export interface OutputSchema {
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export interface HandlerInput {
23
+ encoding: 'application/json'
24
+ body: InputSchema
25
+ }
26
+
27
+ export interface HandlerSuccess {
28
+ encoding: 'application/json'
29
+ body: OutputSchema
30
+ headers?: { [key: string]: string }
31
+ }
32
+
33
+ export interface HandlerError {
34
+ status: number
35
+ message?: string
36
+ }
37
+
38
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
39
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
40
+ auth: HA
41
+ params: QueryParams
42
+ input: HandlerInput
43
+ req: express.Request
44
+ res: express.Response
45
+ }
46
+ export type Handler<HA extends HandlerAuth = never> = (
47
+ ctx: HandlerReqCtx<HA>,
48
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -0,0 +1 @@
1
+ export const ProtectedTagSettingKey = 'tools.ozone.setting.protectedTags'
@@ -0,0 +1,3 @@
1
+ export type ProtectedTagSetting = {
2
+ [key: string]: { roles?: string[]; moderators?: string[] }
3
+ }
@@ -0,0 +1,61 @@
1
+ import { Selectable } from 'kysely'
2
+ import { Setting } from '../db/schema/setting'
3
+ import { ProtectedTagSettingKey } from './constants'
4
+ import { InvalidRequestError } from '@atproto/xrpc-server'
5
+
6
+ export const settingValidators = new Map<
7
+ string,
8
+ (setting: Partial<Selectable<Setting>>) => Promise<void>
9
+ >([
10
+ [
11
+ ProtectedTagSettingKey,
12
+ async (setting: Partial<Selectable<Setting>>) => {
13
+ if (setting.managerRole !== 'tools.ozone.team.defs#roleAdmin') {
14
+ throw new InvalidRequestError(
15
+ 'Only admins should be able to configure protected tags',
16
+ )
17
+ }
18
+
19
+ if (typeof setting.value !== 'object') {
20
+ throw new InvalidRequestError('Invalid value')
21
+ }
22
+ for (const [key, val] of Object.entries(setting.value)) {
23
+ if (!val || typeof val !== 'object') {
24
+ throw new InvalidRequestError(`Invalid configuration for tag ${key}`)
25
+ }
26
+
27
+ if (!val['roles'] && !val['moderators']) {
28
+ throw new InvalidRequestError(
29
+ `Must define who a list of moderators or a role who can action subjects with ${key} tag`,
30
+ )
31
+ }
32
+
33
+ if (val['roles']) {
34
+ if (!Array.isArray(val['roles'])) {
35
+ throw new InvalidRequestError(
36
+ `Roles must be an array of moderator roles for tag ${key}`,
37
+ )
38
+ }
39
+ if (!val['roles']?.length) {
40
+ throw new InvalidRequestError(
41
+ `Must define at least one role for tag ${key}`,
42
+ )
43
+ }
44
+ }
45
+
46
+ if (val['moderators']) {
47
+ if (!Array.isArray(val['moderators'])) {
48
+ throw new InvalidRequestError(
49
+ `Moderators must be an array of moderator DIDs for tag ${key}`,
50
+ )
51
+ }
52
+ if (!val['moderators']?.length) {
53
+ throw new InvalidRequestError(
54
+ `Must define at least one moderator DID for tag ${key}`,
55
+ )
56
+ }
57
+ }
58
+ }
59
+ },
60
+ ],
61
+ ])
@@ -23,7 +23,7 @@ describe('labels from 3p labelers', () => {
23
23
 
24
24
  beforeAll(async () => {
25
25
  network = await TestNetwork.create({
26
- dbPostgresSchema: 'ozone_admin_third_party_labeler',
26
+ dbPostgresSchema: 'ozone_admin_third_party_labeler_main',
27
27
  })
28
28
  ozone = network.ozone
29
29
 
@@ -34,7 +34,7 @@ describe('labels from 3p labelers', () => {
34
34
  plcUrl: network.plc.url,
35
35
  signingKey: ozoneKey,
36
36
  serverDid: ozoneDid,
37
- dbPostgresSchema: `ozone_admin_third_party_labeler`,
37
+ dbPostgresSchema: `ozone_admin_third_party_labeler_third_party`,
38
38
  dbPostgresUrl: ozone.ctx.cfg.db.postgresUrl,
39
39
  appviewUrl: network.bsky.url,
40
40
  appviewDid: network.bsky.ctx.cfg.serverDid,