@atproto/ozone 0.1.41 → 0.1.43

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 (171) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/api/communication/createTemplate.d.ts.map +1 -1
  3. package/dist/api/communication/createTemplate.js +21 -10
  4. package/dist/api/communication/createTemplate.js.map +1 -1
  5. package/dist/api/communication/updateTemplate.d.ts.map +1 -1
  6. package/dist/api/communication/updateTemplate.js +17 -8
  7. package/dist/api/communication/updateTemplate.js.map +1 -1
  8. package/dist/api/moderation/emitEvent.d.ts.map +1 -1
  9. package/dist/api/moderation/emitEvent.js +3 -7
  10. package/dist/api/moderation/emitEvent.js.map +1 -1
  11. package/dist/api/report/createReport.d.ts.map +1 -1
  12. package/dist/api/report/createReport.js +3 -7
  13. package/dist/api/report/createReport.js.map +1 -1
  14. package/dist/communication-service/template.d.ts +2 -2
  15. package/dist/communication-service/template.d.ts.map +1 -1
  16. package/dist/communication-service/template.js +5 -2
  17. package/dist/communication-service/template.js.map +1 -1
  18. package/dist/communication-service/util.d.ts +2 -0
  19. package/dist/communication-service/util.d.ts.map +1 -0
  20. package/dist/communication-service/util.js +11 -0
  21. package/dist/communication-service/util.js.map +1 -0
  22. package/dist/db/migrations/20240903T205730722Z-add-template-lang.d.ts +4 -0
  23. package/dist/db/migrations/20240903T205730722Z-add-template-lang.d.ts.map +1 -0
  24. package/dist/db/migrations/20240903T205730722Z-add-template-lang.js +15 -0
  25. package/dist/db/migrations/20240903T205730722Z-add-template-lang.js.map +1 -0
  26. package/dist/db/migrations/index.d.ts +1 -0
  27. package/dist/db/migrations/index.d.ts.map +1 -1
  28. package/dist/db/migrations/index.js +2 -1
  29. package/dist/db/migrations/index.js.map +1 -1
  30. package/dist/db/schema/communication_template.d.ts +1 -0
  31. package/dist/db/schema/communication_template.d.ts.map +1 -1
  32. package/dist/lexicon/index.d.ts +11 -0
  33. package/dist/lexicon/index.d.ts.map +1 -1
  34. package/dist/lexicon/index.js +32 -1
  35. package/dist/lexicon/index.js.map +1 -1
  36. package/dist/lexicon/lexicons.d.ts +367 -18
  37. package/dist/lexicon/lexicons.d.ts.map +1 -1
  38. package/dist/lexicon/lexicons.js +390 -24
  39. package/dist/lexicon/lexicons.js.map +1 -1
  40. package/dist/lexicon/types/app/bsky/embed/defs.d.ts +13 -0
  41. package/dist/lexicon/types/app/bsky/embed/defs.d.ts.map +1 -0
  42. package/dist/lexicon/types/app/bsky/embed/defs.js +16 -0
  43. package/dist/lexicon/types/app/bsky/embed/defs.js.map +1 -0
  44. package/dist/lexicon/types/app/bsky/embed/images.d.ts +3 -10
  45. package/dist/lexicon/types/app/bsky/embed/images.d.ts.map +1 -1
  46. package/dist/lexicon/types/app/bsky/embed/images.js +1 -11
  47. package/dist/lexicon/types/app/bsky/embed/images.js.map +1 -1
  48. package/dist/lexicon/types/app/bsky/embed/record.d.ts +2 -1
  49. package/dist/lexicon/types/app/bsky/embed/record.d.ts.map +1 -1
  50. package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
  51. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts +3 -2
  52. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts.map +1 -1
  53. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.js.map +1 -1
  54. package/dist/lexicon/types/app/bsky/embed/video.d.ts +33 -0
  55. package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -0
  56. package/dist/lexicon/types/app/bsky/embed/video.js +35 -0
  57. package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -0
  58. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +2 -1
  59. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  60. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  61. package/dist/lexicon/types/app/bsky/feed/post.d.ts +2 -1
  62. package/dist/lexicon/types/app/bsky/feed/post.d.ts.map +1 -1
  63. package/dist/lexicon/types/app/bsky/feed/post.js.map +1 -1
  64. package/dist/lexicon/types/app/bsky/video/defs.d.ts +19 -0
  65. package/dist/lexicon/types/app/bsky/video/defs.d.ts.map +1 -0
  66. package/dist/lexicon/types/app/bsky/video/defs.js +16 -0
  67. package/dist/lexicon/types/app/bsky/video/defs.js.map +1 -0
  68. package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts +36 -0
  69. package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts.map +1 -0
  70. package/dist/lexicon/types/app/bsky/video/getJobStatus.js +3 -0
  71. package/dist/lexicon/types/app/bsky/video/getJobStatus.js.map +1 -0
  72. package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts +38 -0
  73. package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts.map +1 -0
  74. package/dist/lexicon/types/app/bsky/video/getUploadLimits.js +3 -0
  75. package/dist/lexicon/types/app/bsky/video/getUploadLimits.js.map +1 -0
  76. package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts +41 -0
  77. package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts.map +1 -0
  78. package/dist/lexicon/types/app/bsky/video/uploadVideo.js +3 -0
  79. package/dist/lexicon/types/app/bsky/video/uploadVideo.js.map +1 -0
  80. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +38 -4
  81. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts.map +1 -1
  82. package/dist/lexicon/types/com/atproto/repo/applyWrites.js +31 -1
  83. package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
  84. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +5 -2
  85. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts.map +1 -1
  86. package/dist/lexicon/types/com/atproto/repo/defs.d.ts +12 -0
  87. package/dist/lexicon/types/com/atproto/repo/defs.d.ts.map +1 -0
  88. package/dist/lexicon/types/com/atproto/repo/defs.js +16 -0
  89. package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -0
  90. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +14 -2
  91. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  92. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +5 -2
  93. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts.map +1 -1
  94. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts +3 -0
  95. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts.map +1 -1
  96. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts +2 -0
  97. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts.map +1 -1
  98. package/dist/lexicon/types/tools/ozone/communication/defs.js.map +1 -1
  99. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts +3 -0
  100. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts.map +1 -1
  101. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts +1 -1
  102. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
  103. package/dist/mod-service/index.d.ts +1 -1
  104. package/dist/mod-service/index.d.ts.map +1 -1
  105. package/dist/mod-service/index.js +1 -1
  106. package/dist/mod-service/index.js.map +1 -1
  107. package/dist/tag-service/content-tagger.d.ts +15 -0
  108. package/dist/tag-service/content-tagger.d.ts.map +1 -0
  109. package/dist/tag-service/content-tagger.js +36 -0
  110. package/dist/tag-service/content-tagger.js.map +1 -0
  111. package/dist/tag-service/embed-tagger.d.ts +8 -0
  112. package/dist/tag-service/embed-tagger.d.ts.map +1 -0
  113. package/dist/tag-service/embed-tagger.js +64 -0
  114. package/dist/tag-service/embed-tagger.js.map +1 -0
  115. package/dist/tag-service/index.d.ts +13 -0
  116. package/dist/tag-service/index.d.ts.map +1 -0
  117. package/dist/tag-service/index.js +77 -0
  118. package/dist/tag-service/index.js.map +1 -0
  119. package/dist/{mod-service/lang-data.d.ts → tag-service/language-data.d.ts} +1 -1
  120. package/dist/tag-service/language-data.d.ts.map +1 -0
  121. package/dist/{mod-service/lang-data.js → tag-service/language-data.js} +1 -1
  122. package/dist/tag-service/language-data.js.map +1 -0
  123. package/dist/tag-service/language-tagger.d.ts +9 -0
  124. package/dist/tag-service/language-tagger.d.ts.map +1 -0
  125. package/dist/{mod-service/lang.js → tag-service/language-tagger.js} +32 -39
  126. package/dist/tag-service/language-tagger.js.map +1 -0
  127. package/package.json +3 -3
  128. package/src/api/communication/createTemplate.ts +23 -9
  129. package/src/api/communication/updateTemplate.ts +18 -7
  130. package/src/api/moderation/emitEvent.ts +7 -6
  131. package/src/api/report/createReport.ts +6 -5
  132. package/src/communication-service/template.ts +5 -0
  133. package/src/communication-service/util.ts +8 -0
  134. package/src/db/migrations/20240903T205730722Z-add-template-lang.ts +12 -0
  135. package/src/db/migrations/index.ts +1 -0
  136. package/src/db/schema/communication_template.ts +1 -0
  137. package/src/lexicon/index.ts +46 -0
  138. package/src/lexicon/lexicons.ts +393 -25
  139. package/src/lexicon/types/app/bsky/embed/defs.ts +26 -0
  140. package/src/lexicon/types/app/bsky/embed/images.ts +3 -21
  141. package/src/lexicon/types/app/bsky/embed/record.ts +2 -0
  142. package/src/lexicon/types/app/bsky/embed/recordWithMedia.ts +3 -0
  143. package/src/lexicon/types/app/bsky/embed/video.ts +67 -0
  144. package/src/lexicon/types/app/bsky/feed/defs.ts +2 -0
  145. package/src/lexicon/types/app/bsky/feed/post.ts +2 -0
  146. package/src/lexicon/types/app/bsky/video/defs.ts +32 -0
  147. package/src/lexicon/types/app/bsky/video/getJobStatus.ts +46 -0
  148. package/src/lexicon/types/app/bsky/video/getUploadLimits.ts +47 -0
  149. package/src/lexicon/types/app/bsky/video/uploadVideo.ts +48 -0
  150. package/src/lexicon/types/com/atproto/repo/applyWrites.ts +70 -3
  151. package/src/lexicon/types/com/atproto/repo/createRecord.ts +5 -2
  152. package/src/lexicon/types/com/atproto/repo/defs.ts +25 -0
  153. package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +13 -1
  154. package/src/lexicon/types/com/atproto/repo/putRecord.ts +5 -2
  155. package/src/lexicon/types/tools/ozone/communication/createTemplate.ts +3 -0
  156. package/src/lexicon/types/tools/ozone/communication/defs.ts +2 -0
  157. package/src/lexicon/types/tools/ozone/communication/updateTemplate.ts +3 -0
  158. package/src/lexicon/types/tools/ozone/moderation/emitEvent.ts +1 -0
  159. package/src/mod-service/index.ts +2 -2
  160. package/src/tag-service/content-tagger.ts +30 -0
  161. package/src/tag-service/embed-tagger.ts +68 -0
  162. package/src/tag-service/index.ts +59 -0
  163. package/src/{mod-service/lang.ts → tag-service/language-tagger.ts} +25 -49
  164. package/tests/content-tagger.test.ts +141 -0
  165. package/dist/mod-service/lang-data.d.ts.map +0 -1
  166. package/dist/mod-service/lang-data.js.map +0 -1
  167. package/dist/mod-service/lang.d.ts +0 -17
  168. package/dist/mod-service/lang.d.ts.map +0 -1
  169. package/dist/mod-service/lang.js.map +0 -1
  170. package/tests/lang.test.ts +0 -106
  171. /package/src/{mod-service/lang-data.ts → tag-service/language-data.ts} +0 -0
@@ -7,12 +7,14 @@ import { isObj, hasProp } from '../../../../util'
7
7
  import { CID } from 'multiformats/cid'
8
8
  import * as AppBskyEmbedRecord from './record'
9
9
  import * as AppBskyEmbedImages from './images'
10
+ import * as AppBskyEmbedVideo from './video'
10
11
  import * as AppBskyEmbedExternal from './external'
11
12
 
12
13
  export interface Main {
13
14
  record: AppBskyEmbedRecord.Main
14
15
  media:
15
16
  | AppBskyEmbedImages.Main
17
+ | AppBskyEmbedVideo.Main
16
18
  | AppBskyEmbedExternal.Main
17
19
  | { $type: string; [k: string]: unknown }
18
20
  [k: string]: unknown
@@ -35,6 +37,7 @@ export interface View {
35
37
  record: AppBskyEmbedRecord.View
36
38
  media:
37
39
  | AppBskyEmbedImages.View
40
+ | AppBskyEmbedVideo.View
38
41
  | AppBskyEmbedExternal.View
39
42
  | { $type: string; [k: string]: unknown }
40
43
  [k: string]: unknown
@@ -0,0 +1,67 @@
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
+ import * as AppBskyEmbedDefs from './defs'
9
+
10
+ export interface Main {
11
+ video: BlobRef
12
+ captions?: Caption[]
13
+ /** Alt text description of the video, for accessibility. */
14
+ alt?: string
15
+ aspectRatio?: AppBskyEmbedDefs.AspectRatio
16
+ [k: string]: unknown
17
+ }
18
+
19
+ export function isMain(v: unknown): v is Main {
20
+ return (
21
+ isObj(v) &&
22
+ hasProp(v, '$type') &&
23
+ (v.$type === 'app.bsky.embed.video#main' ||
24
+ v.$type === 'app.bsky.embed.video')
25
+ )
26
+ }
27
+
28
+ export function validateMain(v: unknown): ValidationResult {
29
+ return lexicons.validate('app.bsky.embed.video#main', v)
30
+ }
31
+
32
+ export interface Caption {
33
+ lang: string
34
+ file: BlobRef
35
+ [k: string]: unknown
36
+ }
37
+
38
+ export function isCaption(v: unknown): v is Caption {
39
+ return (
40
+ isObj(v) &&
41
+ hasProp(v, '$type') &&
42
+ v.$type === 'app.bsky.embed.video#caption'
43
+ )
44
+ }
45
+
46
+ export function validateCaption(v: unknown): ValidationResult {
47
+ return lexicons.validate('app.bsky.embed.video#caption', v)
48
+ }
49
+
50
+ export interface View {
51
+ cid: string
52
+ playlist: string
53
+ thumbnail?: string
54
+ alt?: string
55
+ aspectRatio?: AppBskyEmbedDefs.AspectRatio
56
+ [k: string]: unknown
57
+ }
58
+
59
+ export function isView(v: unknown): v is View {
60
+ return (
61
+ isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.video#view'
62
+ )
63
+ }
64
+
65
+ export function validateView(v: unknown): ValidationResult {
66
+ return lexicons.validate('app.bsky.embed.video#view', v)
67
+ }
@@ -7,6 +7,7 @@ import { isObj, hasProp } from '../../../../util'
7
7
  import { CID } from 'multiformats/cid'
8
8
  import * as AppBskyActorDefs from '../actor/defs'
9
9
  import * as AppBskyEmbedImages from '../embed/images'
10
+ import * as AppBskyEmbedVideo from '../embed/video'
10
11
  import * as AppBskyEmbedExternal from '../embed/external'
11
12
  import * as AppBskyEmbedRecord from '../embed/record'
12
13
  import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
@@ -21,6 +22,7 @@ export interface PostView {
21
22
  record: {}
22
23
  embed?:
23
24
  | AppBskyEmbedImages.View
25
+ | AppBskyEmbedVideo.View
24
26
  | AppBskyEmbedExternal.View
25
27
  | AppBskyEmbedRecord.View
26
28
  | AppBskyEmbedRecordWithMedia.View
@@ -7,6 +7,7 @@ import { isObj, hasProp } from '../../../../util'
7
7
  import { CID } from 'multiformats/cid'
8
8
  import * as AppBskyRichtextFacet from '../richtext/facet'
9
9
  import * as AppBskyEmbedImages from '../embed/images'
10
+ import * as AppBskyEmbedVideo from '../embed/video'
10
11
  import * as AppBskyEmbedExternal from '../embed/external'
11
12
  import * as AppBskyEmbedRecord from '../embed/record'
12
13
  import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
@@ -23,6 +24,7 @@ export interface Record {
23
24
  reply?: ReplyRef
24
25
  embed?:
25
26
  | AppBskyEmbedImages.Main
27
+ | AppBskyEmbedVideo.Main
26
28
  | AppBskyEmbedExternal.Main
27
29
  | AppBskyEmbedRecord.Main
28
30
  | AppBskyEmbedRecordWithMedia.Main
@@ -0,0 +1,32 @@
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 JobStatus {
10
+ jobId: string
11
+ did: string
12
+ /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */
13
+ state: 'JOB_STATE_COMPLETED' | 'JOB_STATE_FAILED' | (string & {})
14
+ /** Progress within the current processing state. */
15
+ progress?: number
16
+ blob?: BlobRef
17
+ error?: string
18
+ message?: string
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export function isJobStatus(v: unknown): v is JobStatus {
23
+ return (
24
+ isObj(v) &&
25
+ hasProp(v, '$type') &&
26
+ v.$type === 'app.bsky.video.defs#jobStatus'
27
+ )
28
+ }
29
+
30
+ export function validateJobStatus(v: unknown): ValidationResult {
31
+ return lexicons.validate('app.bsky.video.defs#jobStatus', v)
32
+ }
@@ -0,0 +1,46 @@
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 AppBskyVideoDefs from './defs'
11
+
12
+ export interface QueryParams {
13
+ jobId: string
14
+ }
15
+
16
+ export type InputSchema = undefined
17
+
18
+ export interface OutputSchema {
19
+ jobStatus: AppBskyVideoDefs.JobStatus
20
+ [k: string]: unknown
21
+ }
22
+
23
+ export type HandlerInput = undefined
24
+
25
+ export interface HandlerSuccess {
26
+ encoding: 'application/json'
27
+ body: OutputSchema
28
+ headers?: { [key: string]: string }
29
+ }
30
+
31
+ export interface HandlerError {
32
+ status: number
33
+ message?: string
34
+ }
35
+
36
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
37
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
38
+ auth: HA
39
+ params: QueryParams
40
+ input: HandlerInput
41
+ req: express.Request
42
+ res: express.Response
43
+ }
44
+ export type Handler<HA extends HandlerAuth = never> = (
45
+ ctx: HandlerReqCtx<HA>,
46
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -0,0 +1,47 @@
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 type InputSchema = undefined
14
+
15
+ export interface OutputSchema {
16
+ canUpload: boolean
17
+ remainingDailyVideos?: number
18
+ remainingDailyBytes?: number
19
+ message?: string
20
+ error?: string
21
+ [k: string]: unknown
22
+ }
23
+
24
+ export type HandlerInput = undefined
25
+
26
+ export interface HandlerSuccess {
27
+ encoding: 'application/json'
28
+ body: OutputSchema
29
+ headers?: { [key: string]: string }
30
+ }
31
+
32
+ export interface HandlerError {
33
+ status: number
34
+ message?: string
35
+ }
36
+
37
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
38
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
39
+ auth: HA
40
+ params: QueryParams
41
+ input: HandlerInput
42
+ req: express.Request
43
+ res: express.Response
44
+ }
45
+ export type Handler<HA extends HandlerAuth = never> = (
46
+ ctx: HandlerReqCtx<HA>,
47
+ ) => Promise<HandlerOutput> | HandlerOutput
@@ -0,0 +1,48 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express'
5
+ import stream from 'stream'
6
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { isObj, hasProp } from '../../../../util'
9
+ import { CID } from 'multiformats/cid'
10
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
11
+ import * as AppBskyVideoDefs from './defs'
12
+
13
+ export interface QueryParams {}
14
+
15
+ export type InputSchema = string | Uint8Array | Blob
16
+
17
+ export interface OutputSchema {
18
+ jobStatus: AppBskyVideoDefs.JobStatus
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export interface HandlerInput {
23
+ encoding: 'video/mp4'
24
+ body: stream.Readable
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
@@ -7,32 +7,45 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+ import * as ComAtprotoRepoDefs from './defs'
10
11
 
11
12
  export interface QueryParams {}
12
13
 
13
14
  export interface InputSchema {
14
15
  /** The handle or DID of the repo (aka, current account). */
15
16
  repo: string
16
- /** Can be set to 'false' to skip Lexicon schema validation of record data, for all operations. */
17
- validate: boolean
17
+ /** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */
18
+ validate?: boolean
18
19
  writes: (Create | Update | Delete)[]
19
20
  /** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */
20
21
  swapCommit?: string
21
22
  [k: string]: unknown
22
23
  }
23
24
 
25
+ export interface OutputSchema {
26
+ commit?: ComAtprotoRepoDefs.CommitMeta
27
+ results?: (CreateResult | UpdateResult | DeleteResult)[]
28
+ [k: string]: unknown
29
+ }
30
+
24
31
  export interface HandlerInput {
25
32
  encoding: 'application/json'
26
33
  body: InputSchema
27
34
  }
28
35
 
36
+ export interface HandlerSuccess {
37
+ encoding: 'application/json'
38
+ body: OutputSchema
39
+ headers?: { [key: string]: string }
40
+ }
41
+
29
42
  export interface HandlerError {
30
43
  status: number
31
44
  message?: string
32
45
  error?: 'InvalidSwap'
33
46
  }
34
47
 
35
- export type HandlerOutput = HandlerError | void
48
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
36
49
  export type HandlerReqCtx<HA extends HandlerAuth = never> = {
37
50
  auth: HA
38
51
  params: QueryParams
@@ -102,3 +115,57 @@ export function isDelete(v: unknown): v is Delete {
102
115
  export function validateDelete(v: unknown): ValidationResult {
103
116
  return lexicons.validate('com.atproto.repo.applyWrites#delete', v)
104
117
  }
118
+
119
+ export interface CreateResult {
120
+ uri: string
121
+ cid: string
122
+ validationStatus?: 'valid' | 'unknown' | (string & {})
123
+ [k: string]: unknown
124
+ }
125
+
126
+ export function isCreateResult(v: unknown): v is CreateResult {
127
+ return (
128
+ isObj(v) &&
129
+ hasProp(v, '$type') &&
130
+ v.$type === 'com.atproto.repo.applyWrites#createResult'
131
+ )
132
+ }
133
+
134
+ export function validateCreateResult(v: unknown): ValidationResult {
135
+ return lexicons.validate('com.atproto.repo.applyWrites#createResult', v)
136
+ }
137
+
138
+ export interface UpdateResult {
139
+ uri: string
140
+ cid: string
141
+ validationStatus?: 'valid' | 'unknown' | (string & {})
142
+ [k: string]: unknown
143
+ }
144
+
145
+ export function isUpdateResult(v: unknown): v is UpdateResult {
146
+ return (
147
+ isObj(v) &&
148
+ hasProp(v, '$type') &&
149
+ v.$type === 'com.atproto.repo.applyWrites#updateResult'
150
+ )
151
+ }
152
+
153
+ export function validateUpdateResult(v: unknown): ValidationResult {
154
+ return lexicons.validate('com.atproto.repo.applyWrites#updateResult', v)
155
+ }
156
+
157
+ export interface DeleteResult {
158
+ [k: string]: unknown
159
+ }
160
+
161
+ export function isDeleteResult(v: unknown): v is DeleteResult {
162
+ return (
163
+ isObj(v) &&
164
+ hasProp(v, '$type') &&
165
+ v.$type === 'com.atproto.repo.applyWrites#deleteResult'
166
+ )
167
+ }
168
+
169
+ export function validateDeleteResult(v: unknown): ValidationResult {
170
+ return lexicons.validate('com.atproto.repo.applyWrites#deleteResult', v)
171
+ }
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+ import * as ComAtprotoRepoDefs from './defs'
10
11
 
11
12
  export interface QueryParams {}
12
13
 
@@ -17,8 +18,8 @@ export interface InputSchema {
17
18
  collection: string
18
19
  /** The Record Key. */
19
20
  rkey?: string
20
- /** Can be set to 'false' to skip Lexicon schema validation of record data. */
21
- validate: boolean
21
+ /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
22
+ validate?: boolean
22
23
  /** The record itself. Must contain a $type field. */
23
24
  record: {}
24
25
  /** Compare and swap with the previous commit by CID. */
@@ -29,6 +30,8 @@ export interface InputSchema {
29
30
  export interface OutputSchema {
30
31
  uri: string
31
32
  cid: string
33
+ commit?: ComAtprotoRepoDefs.CommitMeta
34
+ validationStatus?: 'valid' | 'unknown' | (string & {})
32
35
  [k: string]: unknown
33
36
  }
34
37
 
@@ -0,0 +1,25 @@
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 CommitMeta {
10
+ cid: string
11
+ rev: string
12
+ [k: string]: unknown
13
+ }
14
+
15
+ export function isCommitMeta(v: unknown): v is CommitMeta {
16
+ return (
17
+ isObj(v) &&
18
+ hasProp(v, '$type') &&
19
+ v.$type === 'com.atproto.repo.defs#commitMeta'
20
+ )
21
+ }
22
+
23
+ export function validateCommitMeta(v: unknown): ValidationResult {
24
+ return lexicons.validate('com.atproto.repo.defs#commitMeta', v)
25
+ }
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+ import * as ComAtprotoRepoDefs from './defs'
10
11
 
11
12
  export interface QueryParams {}
12
13
 
@@ -24,18 +25,29 @@ export interface InputSchema {
24
25
  [k: string]: unknown
25
26
  }
26
27
 
28
+ export interface OutputSchema {
29
+ commit?: ComAtprotoRepoDefs.CommitMeta
30
+ [k: string]: unknown
31
+ }
32
+
27
33
  export interface HandlerInput {
28
34
  encoding: 'application/json'
29
35
  body: InputSchema
30
36
  }
31
37
 
38
+ export interface HandlerSuccess {
39
+ encoding: 'application/json'
40
+ body: OutputSchema
41
+ headers?: { [key: string]: string }
42
+ }
43
+
32
44
  export interface HandlerError {
33
45
  status: number
34
46
  message?: string
35
47
  error?: 'InvalidSwap'
36
48
  }
37
49
 
38
- export type HandlerOutput = HandlerError | void
50
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
39
51
  export type HandlerReqCtx<HA extends HandlerAuth = never> = {
40
52
  auth: HA
41
53
  params: QueryParams
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
7
7
  import { isObj, hasProp } from '../../../../util'
8
8
  import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+ import * as ComAtprotoRepoDefs from './defs'
10
11
 
11
12
  export interface QueryParams {}
12
13
 
@@ -17,8 +18,8 @@ export interface InputSchema {
17
18
  collection: string
18
19
  /** The Record Key. */
19
20
  rkey: string
20
- /** Can be set to 'false' to skip Lexicon schema validation of record data. */
21
- validate: boolean
21
+ /** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
22
+ validate?: boolean
22
23
  /** The record to write. */
23
24
  record: {}
24
25
  /** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */
@@ -31,6 +32,8 @@ export interface InputSchema {
31
32
  export interface OutputSchema {
32
33
  uri: string
33
34
  cid: string
35
+ commit?: ComAtprotoRepoDefs.CommitMeta
36
+ validationStatus?: 'valid' | 'unknown' | (string & {})
34
37
  [k: string]: unknown
35
38
  }
36
39
 
@@ -18,6 +18,8 @@ export interface InputSchema {
18
18
  contentMarkdown: string
19
19
  /** Subject of the message, used in emails. */
20
20
  subject: string
21
+ /** Message language. */
22
+ lang?: string
21
23
  /** DID of the user who is creating the template. */
22
24
  createdBy?: string
23
25
  [k: string]: unknown
@@ -39,6 +41,7 @@ export interface HandlerSuccess {
39
41
  export interface HandlerError {
40
42
  status: number
41
43
  message?: string
44
+ error?: 'DuplicateTemplateName'
42
45
  }
43
46
 
44
47
  export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
@@ -15,6 +15,8 @@ export interface TemplateView {
15
15
  /** Subject of the message, used in emails. */
16
16
  contentMarkdown: string
17
17
  disabled: boolean
18
+ /** Message language. */
19
+ lang?: string
18
20
  /** DID of the user who last updated the template. */
19
21
  lastUpdatedBy: string
20
22
  createdAt: string
@@ -16,6 +16,8 @@ export interface InputSchema {
16
16
  id: string
17
17
  /** Name of the template. */
18
18
  name?: string
19
+ /** Message language. */
20
+ lang?: string
19
21
  /** Content of the template, markdown supported, can contain variable placeholders. */
20
22
  contentMarkdown?: string
21
23
  /** Subject of the message, used in emails. */
@@ -42,6 +44,7 @@ export interface HandlerSuccess {
42
44
  export interface HandlerError {
43
45
  status: number
44
46
  message?: string
47
+ error?: 'DuplicateTemplateName'
45
48
  }
46
49
 
47
50
  export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
@@ -26,6 +26,7 @@ export interface InputSchema {
26
26
  | ToolsOzoneModerationDefs.ModEventMuteReporter
27
27
  | ToolsOzoneModerationDefs.ModEventUnmuteReporter
28
28
  | ToolsOzoneModerationDefs.ModEventReverseTakedown
29
+ | ToolsOzoneModerationDefs.ModEventResolveAppeal
29
30
  | ToolsOzoneModerationDefs.ModEventEmail
30
31
  | ToolsOzoneModerationDefs.ModEventTag
31
32
  | { $type: string; [k: string]: unknown }
@@ -703,7 +703,7 @@ export class ModerationService {
703
703
  cursor?: string
704
704
  limit?: number
705
705
  takendown?: boolean
706
- appealed?: boolean | null
706
+ appealed?: boolean
707
707
  reviewedBefore?: string
708
708
  reviewState?: ModerationSubjectStatusRow['reviewState']
709
709
  reviewedAfter?: string
@@ -769,7 +769,7 @@ export class ModerationService {
769
769
 
770
770
  if (appealed !== undefined) {
771
771
  builder =
772
- appealed === null
772
+ appealed === false
773
773
  ? builder.where('appealed', 'is', null)
774
774
  : builder.where('appealed', '=', appealed)
775
775
  }
@@ -0,0 +1,30 @@
1
+ import { ModerationService } from '../mod-service'
2
+ import { ModSubject } from '../mod-service/subject'
3
+ import { ModerationSubjectStatusRow } from '../mod-service/types'
4
+
5
+ export abstract class ContentTagger {
6
+ constructor(
7
+ protected subject: ModSubject,
8
+ protected subjectStatus: ModerationSubjectStatusRow | null,
9
+ protected moderationService: ModerationService,
10
+ ) {}
11
+
12
+ protected abstract tagPrefix: string
13
+
14
+ protected abstract isApplicable(): boolean
15
+ protected abstract buildTags(): Promise<string[]>
16
+
17
+ async getTags(): Promise<string[]> {
18
+ if (!this.isApplicable()) {
19
+ return []
20
+ }
21
+
22
+ return this.buildTags()
23
+ }
24
+
25
+ protected tagAlreadyExists(): boolean {
26
+ return Boolean(
27
+ this.subjectStatus?.tags?.some((tag) => tag.startsWith(this.tagPrefix)),
28
+ )
29
+ }
30
+ }