@atproto/ozone 0.1.42 → 0.1.44

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 (120) hide show
  1. package/CHANGELOG.md +17 -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/20240904T205730722Z-add-subject-did-index.d.ts +4 -0
  27. package/dist/db/migrations/20240904T205730722Z-add-subject-did-index.d.ts.map +1 -0
  28. package/dist/db/migrations/20240904T205730722Z-add-subject-did-index.js +16 -0
  29. package/dist/db/migrations/20240904T205730722Z-add-subject-did-index.js.map +1 -0
  30. package/dist/db/migrations/index.d.ts +2 -0
  31. package/dist/db/migrations/index.d.ts.map +1 -1
  32. package/dist/db/migrations/index.js +3 -1
  33. package/dist/db/migrations/index.js.map +1 -1
  34. package/dist/db/schema/communication_template.d.ts +1 -0
  35. package/dist/db/schema/communication_template.d.ts.map +1 -1
  36. package/dist/lexicon/lexicons.d.ts +131 -3
  37. package/dist/lexicon/lexicons.d.ts.map +1 -1
  38. package/dist/lexicon/lexicons.js +143 -6
  39. package/dist/lexicon/lexicons.js.map +1 -1
  40. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +38 -4
  41. package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts.map +1 -1
  42. package/dist/lexicon/types/com/atproto/repo/applyWrites.js +31 -1
  43. package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
  44. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +5 -2
  45. package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts.map +1 -1
  46. package/dist/lexicon/types/com/atproto/repo/defs.d.ts +12 -0
  47. package/dist/lexicon/types/com/atproto/repo/defs.d.ts.map +1 -0
  48. package/dist/lexicon/types/com/atproto/repo/defs.js +16 -0
  49. package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -0
  50. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +14 -2
  51. package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  52. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +5 -2
  53. package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts.map +1 -1
  54. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts +3 -0
  55. package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts.map +1 -1
  56. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts +2 -0
  57. package/dist/lexicon/types/tools/ozone/communication/defs.d.ts.map +1 -1
  58. package/dist/lexicon/types/tools/ozone/communication/defs.js.map +1 -1
  59. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts +3 -0
  60. package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts.map +1 -1
  61. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts +1 -1
  62. package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
  63. package/dist/mod-service/index.d.ts +1 -1
  64. package/dist/mod-service/index.d.ts.map +1 -1
  65. package/dist/mod-service/index.js +12 -17
  66. package/dist/mod-service/index.js.map +1 -1
  67. package/dist/tag-service/content-tagger.d.ts +15 -0
  68. package/dist/tag-service/content-tagger.d.ts.map +1 -0
  69. package/dist/tag-service/content-tagger.js +36 -0
  70. package/dist/tag-service/content-tagger.js.map +1 -0
  71. package/dist/tag-service/embed-tagger.d.ts +8 -0
  72. package/dist/tag-service/embed-tagger.d.ts.map +1 -0
  73. package/dist/tag-service/embed-tagger.js +64 -0
  74. package/dist/tag-service/embed-tagger.js.map +1 -0
  75. package/dist/tag-service/index.d.ts +13 -0
  76. package/dist/tag-service/index.d.ts.map +1 -0
  77. package/dist/tag-service/index.js +77 -0
  78. package/dist/tag-service/index.js.map +1 -0
  79. package/dist/{mod-service/lang-data.d.ts → tag-service/language-data.d.ts} +1 -1
  80. package/dist/tag-service/language-data.d.ts.map +1 -0
  81. package/dist/{mod-service/lang-data.js → tag-service/language-data.js} +1 -1
  82. package/dist/tag-service/language-data.js.map +1 -0
  83. package/dist/tag-service/language-tagger.d.ts +9 -0
  84. package/dist/tag-service/language-tagger.d.ts.map +1 -0
  85. package/dist/{mod-service/lang.js → tag-service/language-tagger.js} +32 -39
  86. package/dist/tag-service/language-tagger.js.map +1 -0
  87. package/package.json +3 -3
  88. package/src/api/communication/createTemplate.ts +23 -9
  89. package/src/api/communication/updateTemplate.ts +18 -7
  90. package/src/api/moderation/emitEvent.ts +7 -6
  91. package/src/api/report/createReport.ts +6 -5
  92. package/src/communication-service/template.ts +5 -0
  93. package/src/communication-service/util.ts +8 -0
  94. package/src/db/migrations/20240903T205730722Z-add-template-lang.ts +12 -0
  95. package/src/db/migrations/20240904T205730722Z-add-subject-did-index.ts +13 -0
  96. package/src/db/migrations/index.ts +2 -0
  97. package/src/db/schema/communication_template.ts +1 -0
  98. package/src/lexicon/lexicons.ts +143 -6
  99. package/src/lexicon/types/com/atproto/repo/applyWrites.ts +70 -3
  100. package/src/lexicon/types/com/atproto/repo/createRecord.ts +5 -2
  101. package/src/lexicon/types/com/atproto/repo/defs.ts +25 -0
  102. package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +13 -1
  103. package/src/lexicon/types/com/atproto/repo/putRecord.ts +5 -2
  104. package/src/lexicon/types/tools/ozone/communication/createTemplate.ts +3 -0
  105. package/src/lexicon/types/tools/ozone/communication/defs.ts +2 -0
  106. package/src/lexicon/types/tools/ozone/communication/updateTemplate.ts +3 -0
  107. package/src/lexicon/types/tools/ozone/moderation/emitEvent.ts +1 -0
  108. package/src/mod-service/index.ts +16 -20
  109. package/src/tag-service/content-tagger.ts +30 -0
  110. package/src/tag-service/embed-tagger.ts +68 -0
  111. package/src/tag-service/index.ts +59 -0
  112. package/src/{mod-service/lang.ts → tag-service/language-tagger.ts} +25 -49
  113. package/tests/content-tagger.test.ts +141 -0
  114. package/dist/mod-service/lang-data.d.ts.map +0 -1
  115. package/dist/mod-service/lang-data.js.map +0 -1
  116. package/dist/mod-service/lang.d.ts +0 -17
  117. package/dist/mod-service/lang.d.ts.map +0 -1
  118. package/dist/mod-service/lang.js.map +0 -1
  119. package/tests/lang.test.ts +0 -106
  120. /package/src/{mod-service/lang-data.ts → tag-service/language-data.ts} +0 -0
@@ -4,7 +4,7 @@ import { getReasonType } from '../util'
4
4
  import { subjectFromInput } from '../../mod-service/subject'
5
5
  import { REASONAPPEAL } from '../../lexicon/types/com/atproto/moderation/defs'
6
6
  import { ForbiddenError } from '@atproto/xrpc-server'
7
- import { ModerationLangService } from '../../mod-service/lang'
7
+ import { TagService } from '../../tag-service'
8
8
 
9
9
  export default function (server: Server, ctx: AppContext) {
10
10
  server.com.atproto.moderation.createReport({
@@ -31,12 +31,13 @@ export default function (server: Server, ctx: AppContext) {
31
31
  reportedBy: requester || ctx.cfg.service.did,
32
32
  })
33
33
 
34
- const moderationLangService = new ModerationLangService(moderationTxn)
35
- await moderationLangService.tagSubjectWithLang({
34
+ const tagService = new TagService(
36
35
  subject,
37
36
  subjectStatus,
38
- createdBy: ctx.cfg.service.did,
39
- })
37
+ ctx.cfg.service.did,
38
+ moderationTxn,
39
+ )
40
+ await tagService.evaluateForSubject()
40
41
 
41
42
  return reportEvent
42
43
  })
@@ -27,6 +27,7 @@ export class CommunicationTemplateService {
27
27
  name,
28
28
  contentMarkdown,
29
29
  subject,
30
+ lang,
30
31
  disabled,
31
32
  updatedAt,
32
33
  createdAt,
@@ -44,6 +45,7 @@ export class CommunicationTemplateService {
44
45
  name,
45
46
  contentMarkdown,
46
47
  subject,
48
+ lang,
47
49
  disabled,
48
50
  lastUpdatedBy,
49
51
  updatedAt: updatedAt || new Date(),
@@ -62,6 +64,7 @@ export class CommunicationTemplateService {
62
64
  contentMarkdown,
63
65
  subject,
64
66
  disabled,
67
+ lang,
65
68
  updatedAt,
66
69
  lastUpdatedBy,
67
70
  }: Partial<Omit<Selectable<CommunicationTemplate>, 'id' | 'createdAt'>>,
@@ -73,6 +76,7 @@ export class CommunicationTemplateService {
73
76
  name,
74
77
  contentMarkdown,
75
78
  subject,
79
+ lang,
76
80
  disabled,
77
81
  lastUpdatedBy,
78
82
  updatedAt: updatedAt || new Date(),
@@ -96,6 +100,7 @@ export class CommunicationTemplateService {
96
100
  name: template.name,
97
101
  contentMarkdown: template.contentMarkdown,
98
102
  disabled: template.disabled,
103
+ lang: template.lang || undefined,
99
104
  subject: template.subject || undefined,
100
105
  createdAt: template.createdAt.toISOString(),
101
106
  updatedAt: template.updatedAt.toISOString(),
@@ -0,0 +1,8 @@
1
+ // Postgresql will throw a specific error code with the constraint when trying to create a template with duplicate name
2
+ // see https://www.postgresql.org/docs/current/errcodes-appendix.html
3
+ export const isDuplicateTemplateNameError = (err: any) => {
4
+ return (
5
+ err?.['code'] === '23505' &&
6
+ err?.['constraint'] === 'communication_template_unique_name'
7
+ )
8
+ }
@@ -0,0 +1,12 @@
1
+ import { Kysely } from 'kysely'
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await db.schema
5
+ .alterTable('communication_template')
6
+ .addColumn('lang', 'varchar')
7
+ .execute()
8
+ }
9
+
10
+ export async function down(db: Kysely<unknown>): Promise<void> {
11
+ await db.schema.alterTable('moderation_event').dropColumn('lang').execute()
12
+ }
@@ -0,0 +1,13 @@
1
+ import { Kysely } from 'kysely'
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await db.schema
5
+ .createIndex('moderation_event_subject_did_idx')
6
+ .on('moderation_event')
7
+ .column('subjectDid')
8
+ .execute()
9
+ }
10
+
11
+ export async function down(db: Kysely<unknown>): Promise<void> {
12
+ await db.schema.dropIndex('moderation_event_subject_did_idx').execute()
13
+ }
@@ -11,3 +11,5 @@ export * as _20240408T192432676Z from './20240408T192432676Z-mute-reporting'
11
11
  export * as _20240506T225055595Z from './20240506T225055595Z-message-subject'
12
12
  export * as _20240430T211332580Z from './20240521T211332580Z-member'
13
13
  export * as _20240814T003647759Z from './20240814T003647759Z-event-created-at-index'
14
+ export * as _20240903T205730722Z from './20240903T205730722Z-add-template-lang'
15
+ export * as _20240904T205730722Z from './20240904T205730722Z-add-subject-did-index'
@@ -7,6 +7,7 @@ export interface CommunicationTemplate {
7
7
  name: string
8
8
  contentMarkdown: string
9
9
  subject: string | null
10
+ lang: string | null
10
11
  disabled: Generated<boolean>
11
12
  createdAt: Date
12
13
  updatedAt: Date
@@ -1254,9 +1254,8 @@ export const schemaDict = {
1254
1254
  },
1255
1255
  validate: {
1256
1256
  type: 'boolean',
1257
- default: true,
1258
1257
  description:
1259
- "Can be set to 'false' to skip Lexicon schema validation of record data, for all operations.",
1258
+ "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.",
1260
1259
  },
1261
1260
  writes: {
1262
1261
  type: 'array',
@@ -1279,6 +1278,31 @@ export const schemaDict = {
1279
1278
  },
1280
1279
  },
1281
1280
  },
1281
+ output: {
1282
+ encoding: 'application/json',
1283
+ schema: {
1284
+ type: 'object',
1285
+ required: [],
1286
+ properties: {
1287
+ commit: {
1288
+ type: 'ref',
1289
+ ref: 'lex:com.atproto.repo.defs#commitMeta',
1290
+ },
1291
+ results: {
1292
+ type: 'array',
1293
+ items: {
1294
+ type: 'union',
1295
+ refs: [
1296
+ 'lex:com.atproto.repo.applyWrites#createResult',
1297
+ 'lex:com.atproto.repo.applyWrites#updateResult',
1298
+ 'lex:com.atproto.repo.applyWrites#deleteResult',
1299
+ ],
1300
+ closed: true,
1301
+ },
1302
+ },
1303
+ },
1304
+ },
1305
+ },
1282
1306
  errors: [
1283
1307
  {
1284
1308
  name: 'InvalidSwap',
@@ -1336,6 +1360,47 @@ export const schemaDict = {
1336
1360
  },
1337
1361
  },
1338
1362
  },
1363
+ createResult: {
1364
+ type: 'object',
1365
+ required: ['uri', 'cid'],
1366
+ properties: {
1367
+ uri: {
1368
+ type: 'string',
1369
+ format: 'at-uri',
1370
+ },
1371
+ cid: {
1372
+ type: 'string',
1373
+ format: 'cid',
1374
+ },
1375
+ validationStatus: {
1376
+ type: 'string',
1377
+ knownValues: ['valid', 'unknown'],
1378
+ },
1379
+ },
1380
+ },
1381
+ updateResult: {
1382
+ type: 'object',
1383
+ required: ['uri', 'cid'],
1384
+ properties: {
1385
+ uri: {
1386
+ type: 'string',
1387
+ format: 'at-uri',
1388
+ },
1389
+ cid: {
1390
+ type: 'string',
1391
+ format: 'cid',
1392
+ },
1393
+ validationStatus: {
1394
+ type: 'string',
1395
+ knownValues: ['valid', 'unknown'],
1396
+ },
1397
+ },
1398
+ },
1399
+ deleteResult: {
1400
+ type: 'object',
1401
+ required: [],
1402
+ properties: {},
1403
+ },
1339
1404
  },
1340
1405
  },
1341
1406
  ComAtprotoRepoCreateRecord: {
@@ -1370,9 +1435,8 @@ export const schemaDict = {
1370
1435
  },
1371
1436
  validate: {
1372
1437
  type: 'boolean',
1373
- default: true,
1374
1438
  description:
1375
- "Can be set to 'false' to skip Lexicon schema validation of record data.",
1439
+ "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.",
1376
1440
  },
1377
1441
  record: {
1378
1442
  type: 'unknown',
@@ -1401,6 +1465,14 @@ export const schemaDict = {
1401
1465
  type: 'string',
1402
1466
  format: 'cid',
1403
1467
  },
1468
+ commit: {
1469
+ type: 'ref',
1470
+ ref: 'lex:com.atproto.repo.defs#commitMeta',
1471
+ },
1472
+ validationStatus: {
1473
+ type: 'string',
1474
+ knownValues: ['valid', 'unknown'],
1475
+ },
1404
1476
  },
1405
1477
  },
1406
1478
  },
@@ -1414,6 +1486,25 @@ export const schemaDict = {
1414
1486
  },
1415
1487
  },
1416
1488
  },
1489
+ ComAtprotoRepoDefs: {
1490
+ lexicon: 1,
1491
+ id: 'com.atproto.repo.defs',
1492
+ defs: {
1493
+ commitMeta: {
1494
+ type: 'object',
1495
+ required: ['cid', 'rev'],
1496
+ properties: {
1497
+ cid: {
1498
+ type: 'string',
1499
+ format: 'cid',
1500
+ },
1501
+ rev: {
1502
+ type: 'string',
1503
+ },
1504
+ },
1505
+ },
1506
+ },
1507
+ },
1417
1508
  ComAtprotoRepoDeleteRecord: {
1418
1509
  lexicon: 1,
1419
1510
  id: 'com.atproto.repo.deleteRecord',
@@ -1458,6 +1549,18 @@ export const schemaDict = {
1458
1549
  },
1459
1550
  },
1460
1551
  },
1552
+ output: {
1553
+ encoding: 'application/json',
1554
+ schema: {
1555
+ type: 'object',
1556
+ properties: {
1557
+ commit: {
1558
+ type: 'ref',
1559
+ ref: 'lex:com.atproto.repo.defs#commitMeta',
1560
+ },
1561
+ },
1562
+ },
1563
+ },
1461
1564
  errors: [
1462
1565
  {
1463
1566
  name: 'InvalidSwap',
@@ -1778,9 +1881,8 @@ export const schemaDict = {
1778
1881
  },
1779
1882
  validate: {
1780
1883
  type: 'boolean',
1781
- default: true,
1782
1884
  description:
1783
- "Can be set to 'false' to skip Lexicon schema validation of record data.",
1885
+ "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.",
1784
1886
  },
1785
1887
  record: {
1786
1888
  type: 'unknown',
@@ -1815,6 +1917,14 @@ export const schemaDict = {
1815
1917
  type: 'string',
1816
1918
  format: 'cid',
1817
1919
  },
1920
+ commit: {
1921
+ type: 'ref',
1922
+ ref: 'lex:com.atproto.repo.defs#commitMeta',
1923
+ },
1924
+ validationStatus: {
1925
+ type: 'string',
1926
+ knownValues: ['valid', 'unknown'],
1927
+ },
1818
1928
  },
1819
1929
  },
1820
1930
  },
@@ -10356,6 +10466,11 @@ export const schemaDict = {
10356
10466
  type: 'string',
10357
10467
  description: 'Subject of the message, used in emails.',
10358
10468
  },
10469
+ lang: {
10470
+ type: 'string',
10471
+ format: 'language',
10472
+ description: 'Message language.',
10473
+ },
10359
10474
  createdBy: {
10360
10475
  type: 'string',
10361
10476
  format: 'did',
@@ -10371,6 +10486,11 @@ export const schemaDict = {
10371
10486
  ref: 'lex:tools.ozone.communication.defs#templateView',
10372
10487
  },
10373
10488
  },
10489
+ errors: [
10490
+ {
10491
+ name: 'DuplicateTemplateName',
10492
+ },
10493
+ ],
10374
10494
  },
10375
10495
  },
10376
10496
  },
@@ -10409,6 +10529,11 @@ export const schemaDict = {
10409
10529
  disabled: {
10410
10530
  type: 'boolean',
10411
10531
  },
10532
+ lang: {
10533
+ type: 'string',
10534
+ format: 'language',
10535
+ description: 'Message language.',
10536
+ },
10412
10537
  lastUpdatedBy: {
10413
10538
  type: 'string',
10414
10539
  format: 'did',
@@ -10496,6 +10621,11 @@ export const schemaDict = {
10496
10621
  type: 'string',
10497
10622
  description: 'Name of the template.',
10498
10623
  },
10624
+ lang: {
10625
+ type: 'string',
10626
+ format: 'language',
10627
+ description: 'Message language.',
10628
+ },
10499
10629
  contentMarkdown: {
10500
10630
  type: 'string',
10501
10631
  description:
@@ -10523,6 +10653,11 @@ export const schemaDict = {
10523
10653
  ref: 'lex:tools.ozone.communication.defs#templateView',
10524
10654
  },
10525
10655
  },
10656
+ errors: [
10657
+ {
10658
+ name: 'DuplicateTemplateName',
10659
+ },
10660
+ ],
10526
10661
  },
10527
10662
  },
10528
10663
  },
@@ -11322,6 +11457,7 @@ export const schemaDict = {
11322
11457
  'lex:tools.ozone.moderation.defs#modEventMuteReporter',
11323
11458
  'lex:tools.ozone.moderation.defs#modEventUnmuteReporter',
11324
11459
  'lex:tools.ozone.moderation.defs#modEventReverseTakedown',
11460
+ 'lex:tools.ozone.moderation.defs#modEventResolveAppeal',
11325
11461
  'lex:tools.ozone.moderation.defs#modEventEmail',
11326
11462
  'lex:tools.ozone.moderation.defs#modEventTag',
11327
11463
  ],
@@ -12084,6 +12220,7 @@ export const ids = {
12084
12220
  ComAtprotoModerationDefs: 'com.atproto.moderation.defs',
12085
12221
  ComAtprotoRepoApplyWrites: 'com.atproto.repo.applyWrites',
12086
12222
  ComAtprotoRepoCreateRecord: 'com.atproto.repo.createRecord',
12223
+ ComAtprotoRepoDefs: 'com.atproto.repo.defs',
12087
12224
  ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
12088
12225
  ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo',
12089
12226
  ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
@@ -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 }