@atproto/pds 0.4.55 → 0.4.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
  3. package/dist/api/com/atproto/repo/applyWrites.js +43 -7
  4. package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
  5. package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
  6. package/dist/api/com/atproto/repo/createRecord.js +10 -2
  7. package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
  8. package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  9. package/dist/api/com/atproto/repo/deleteRecord.js +11 -0
  10. package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
  11. package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
  12. package/dist/api/com/atproto/repo/putRecord.js +7 -0
  13. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  14. package/dist/lexicon/index.d.ts +11 -0
  15. package/dist/lexicon/index.d.ts.map +1 -1
  16. package/dist/lexicon/index.js +32 -1
  17. package/dist/lexicon/index.js.map +1 -1
  18. package/dist/lexicon/lexicons.d.ts +367 -18
  19. package/dist/lexicon/lexicons.d.ts.map +1 -1
  20. package/dist/lexicon/lexicons.js +390 -24
  21. package/dist/lexicon/lexicons.js.map +1 -1
  22. package/dist/lexicon/types/app/bsky/embed/defs.d.ts +13 -0
  23. package/dist/lexicon/types/app/bsky/embed/defs.d.ts.map +1 -0
  24. package/dist/lexicon/types/app/bsky/embed/defs.js +16 -0
  25. package/dist/lexicon/types/app/bsky/embed/defs.js.map +1 -0
  26. package/dist/lexicon/types/app/bsky/embed/images.d.ts +3 -10
  27. package/dist/lexicon/types/app/bsky/embed/images.d.ts.map +1 -1
  28. package/dist/lexicon/types/app/bsky/embed/images.js +1 -11
  29. package/dist/lexicon/types/app/bsky/embed/images.js.map +1 -1
  30. package/dist/lexicon/types/app/bsky/embed/record.d.ts +2 -1
  31. package/dist/lexicon/types/app/bsky/embed/record.d.ts.map +1 -1
  32. package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
  33. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts +3 -2
  34. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts.map +1 -1
  35. package/dist/lexicon/types/app/bsky/embed/recordWithMedia.js.map +1 -1
  36. package/dist/lexicon/types/app/bsky/embed/video.d.ts +33 -0
  37. package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -0
  38. package/dist/lexicon/types/app/bsky/embed/video.js +35 -0
  39. package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -0
  40. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +2 -1
  41. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  42. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  43. package/dist/lexicon/types/app/bsky/feed/post.d.ts +2 -1
  44. package/dist/lexicon/types/app/bsky/feed/post.d.ts.map +1 -1
  45. package/dist/lexicon/types/app/bsky/feed/post.js.map +1 -1
  46. package/dist/lexicon/types/app/bsky/video/defs.d.ts +19 -0
  47. package/dist/lexicon/types/app/bsky/video/defs.d.ts.map +1 -0
  48. package/dist/lexicon/types/app/bsky/video/defs.js +16 -0
  49. package/dist/lexicon/types/app/bsky/video/defs.js.map +1 -0
  50. package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts +36 -0
  51. package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts.map +1 -0
  52. package/dist/lexicon/types/app/bsky/video/getJobStatus.js +3 -0
  53. package/dist/lexicon/types/app/bsky/video/getJobStatus.js.map +1 -0
  54. package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts +38 -0
  55. package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts.map +1 -0
  56. package/dist/lexicon/types/app/bsky/video/getUploadLimits.js +3 -0
  57. package/dist/lexicon/types/app/bsky/video/getUploadLimits.js.map +1 -0
  58. package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts +41 -0
  59. package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts.map +1 -0
  60. package/dist/lexicon/types/app/bsky/video/uploadVideo.js +3 -0
  61. package/dist/lexicon/types/app/bsky/video/uploadVideo.js.map +1 -0
  62. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +38 -4
  63. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts.map +1 -1
  64. package/dist/lexicon/types/com/atproto/repo/applyWrites.js +31 -1
  65. package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
  66. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +5 -2
  67. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts.map +1 -1
  68. package/dist/lexicon/types/com/atproto/repo/defs.d.ts +12 -0
  69. package/dist/lexicon/types/com/atproto/repo/defs.d.ts.map +1 -0
  70. package/dist/lexicon/types/com/atproto/repo/defs.js +16 -0
  71. package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -0
  72. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +14 -2
  73. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  74. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +5 -2
  75. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts.map +1 -1
  76. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts +3 -0
  77. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts.map +1 -1
  78. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts +2 -0
  79. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts.map +1 -1
  80. package/dist/lexicon/types/tools/ozone/communication/defs.js.map +1 -1
  81. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts +3 -0
  82. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts.map +1 -1
  83. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts +1 -1
  84. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
  85. package/dist/read-after-write/viewer.d.ts +4 -4
  86. package/dist/repo/prepare.d.ts +4 -2
  87. package/dist/repo/prepare.d.ts.map +1 -1
  88. package/dist/repo/prepare.js +30 -14
  89. package/dist/repo/prepare.js.map +1 -1
  90. package/dist/repo/types.d.ts +3 -0
  91. package/dist/repo/types.d.ts.map +1 -1
  92. package/dist/repo/types.js.map +1 -1
  93. package/dist/sequencer/events.d.ts +2 -2
  94. package/package.json +4 -4
  95. package/src/api/com/atproto/repo/applyWrites.ts +41 -0
  96. package/src/api/com/atproto/repo/createRecord.ts +16 -7
  97. package/src/api/com/atproto/repo/deleteRecord.ts +11 -0
  98. package/src/api/com/atproto/repo/putRecord.ts +7 -0
  99. package/src/lexicon/index.ts +46 -0
  100. package/src/lexicon/lexicons.ts +393 -25
  101. package/src/lexicon/types/app/bsky/embed/defs.ts +26 -0
  102. package/src/lexicon/types/app/bsky/embed/images.ts +3 -21
  103. package/src/lexicon/types/app/bsky/embed/record.ts +2 -0
  104. package/src/lexicon/types/app/bsky/embed/recordWithMedia.ts +3 -0
  105. package/src/lexicon/types/app/bsky/embed/video.ts +67 -0
  106. package/src/lexicon/types/app/bsky/feed/defs.ts +2 -0
  107. package/src/lexicon/types/app/bsky/feed/post.ts +2 -0
  108. package/src/lexicon/types/app/bsky/video/defs.ts +32 -0
  109. package/src/lexicon/types/app/bsky/video/getJobStatus.ts +46 -0
  110. package/src/lexicon/types/app/bsky/video/getUploadLimits.ts +47 -0
  111. package/src/lexicon/types/app/bsky/video/uploadVideo.ts +48 -0
  112. package/src/lexicon/types/com/atproto/repo/applyWrites.ts +70 -3
  113. package/src/lexicon/types/com/atproto/repo/createRecord.ts +5 -2
  114. package/src/lexicon/types/com/atproto/repo/defs.ts +25 -0
  115. package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +13 -1
  116. package/src/lexicon/types/com/atproto/repo/putRecord.ts +5 -2
  117. package/src/lexicon/types/tools/ozone/communication/createTemplate.ts +3 -0
  118. package/src/lexicon/types/tools/ozone/communication/defs.ts +2 -0
  119. package/src/lexicon/types/tools/ozone/communication/updateTemplate.ts +3 -0
  120. package/src/lexicon/types/tools/ozone/moderation/emitEvent.ts +1 -0
  121. package/src/repo/prepare.ts +31 -13
  122. package/src/repo/types.ts +4 -0
  123. package/tests/crud.test.ts +131 -14
@@ -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 }
@@ -29,6 +29,7 @@ import {
29
29
  InvalidRecordError,
30
30
  PreparedWrite,
31
31
  PreparedBlobRef,
32
+ ValidationStatus,
32
33
  } from './types'
33
34
  import * as lex from '../lexicon/lexicons'
34
35
  import { isRecord as isFeedGenerator } from '../lexicon/types/app/bsky/feed/generator'
@@ -39,7 +40,10 @@ import { isRecord as isList } from '../lexicon/types/app/bsky/graph/list'
39
40
  import { isRecord as isProfile } from '../lexicon/types/app/bsky/actor/profile'
40
41
  import { hasExplicitSlur } from '../handle/explicit-slurs'
41
42
 
42
- export const assertValidRecord = (record: Record<string, unknown>) => {
43
+ export const assertValidRecordWithStatus = (
44
+ record: Record<string, unknown>,
45
+ opts: { requireLexicon: boolean },
46
+ ): ValidationStatus => {
43
47
  if (typeof record.$type !== 'string') {
44
48
  throw new InvalidRecordError('No $type provided')
45
49
  }
@@ -48,7 +52,11 @@ export const assertValidRecord = (record: Record<string, unknown>) => {
48
52
  assertValidCreatedAt(record)
49
53
  } catch (e) {
50
54
  if (e instanceof LexiconDefNotFoundError) {
51
- throw new InvalidRecordError(e.message)
55
+ if (opts.requireLexicon) {
56
+ throw new InvalidRecordError(e.message)
57
+ } else {
58
+ return 'unknown'
59
+ }
52
60
  }
53
61
  throw new InvalidRecordError(
54
62
  `Invalid ${record.$type} record: ${
@@ -56,6 +64,7 @@ export const assertValidRecord = (record: Record<string, unknown>) => {
56
64
  }`,
57
65
  )
58
66
  }
67
+ return 'valid'
59
68
  }
60
69
 
61
70
  // additional more rigorous check on datetimes
@@ -98,12 +107,15 @@ export const prepareCreate = async (opts: {
98
107
  record: RepoRecord
99
108
  validate?: boolean
100
109
  }): Promise<PreparedCreate> => {
101
- const { did, collection, swapCid, validate = true } = opts
102
- const record = setCollectionName(collection, opts.record, validate)
103
- if (validate) {
104
- assertValidRecord(record)
110
+ const { did, collection, swapCid, validate } = opts
111
+ const maybeValidate = validate !== false
112
+ const record = setCollectionName(collection, opts.record, maybeValidate)
113
+ let validationStatus: ValidationStatus
114
+ if (maybeValidate) {
115
+ validationStatus = assertValidRecordWithStatus(record, {
116
+ requireLexicon: validate === true,
117
+ })
105
118
  }
106
-
107
119
  const nextRkey = TID.next()
108
120
  const rkey = opts.rkey || nextRkey.toString()
109
121
  // @TODO: validate against Lexicon record 'key' type, not just overall recordkey syntax
@@ -115,7 +127,8 @@ export const prepareCreate = async (opts: {
115
127
  cid: await cidForSafeRecord(record),
116
128
  swapCid,
117
129
  record,
118
- blobs: blobsForWrite(record, validate),
130
+ blobs: blobsForWrite(record, maybeValidate),
131
+ validationStatus,
119
132
  }
120
133
  }
121
134
 
@@ -127,10 +140,14 @@ export const prepareUpdate = async (opts: {
127
140
  record: RepoRecord
128
141
  validate?: boolean
129
142
  }): Promise<PreparedUpdate> => {
130
- const { did, collection, rkey, swapCid, validate = true } = opts
131
- const record = setCollectionName(collection, opts.record, validate)
132
- if (validate) {
133
- assertValidRecord(record)
143
+ const { did, collection, rkey, swapCid, validate } = opts
144
+ const maybeValidate = validate !== false
145
+ const record = setCollectionName(collection, opts.record, maybeValidate)
146
+ let validationStatus: ValidationStatus
147
+ if (maybeValidate) {
148
+ validationStatus = assertValidRecordWithStatus(record, {
149
+ requireLexicon: validate === true,
150
+ })
134
151
  }
135
152
  assertNoExplicitSlurs(rkey, record)
136
153
  return {
@@ -139,7 +156,8 @@ export const prepareUpdate = async (opts: {
139
156
  cid: await cidForSafeRecord(record),
140
157
  swapCid,
141
158
  record,
142
- blobs: blobsForWrite(record, validate),
159
+ blobs: blobsForWrite(record, maybeValidate),
160
+ validationStatus,
143
161
  }
144
162
  }
145
163