@atproto/ozone 0.0.2 → 0.0.5

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 (75) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/api/admin/listCommunicationTemplates.d.ts +3 -0
  3. package/dist/api/admin/updateCommunicationTemplate.d.ts +3 -0
  4. package/dist/communication-service/template.d.ts +18 -0
  5. package/dist/context.d.ts +3 -0
  6. package/dist/db/index.js +18 -1
  7. package/dist/db/index.js.map +3 -3
  8. package/dist/db/migrations/20240116T085607200Z-communication-template.d.ts +3 -0
  9. package/dist/db/migrations/index.d.ts +1 -0
  10. package/dist/db/schema/communication_template.d.ts +15 -0
  11. package/dist/db/schema/index.d.ts +2 -1
  12. package/dist/index.js +971 -240
  13. package/dist/index.js.map +3 -3
  14. package/dist/lexicon/index.d.ts +10 -0
  15. package/dist/lexicon/lexicons.d.ts +230 -0
  16. package/dist/lexicon/types/app/bsky/unspecced/{getPopular.d.ts → getTaggedSuggestions.d.ts} +10 -6
  17. package/dist/lexicon/types/{app/bsky/moderation/getService.d.ts → com/atproto/admin/createCommunicationTemplate.d.ts} +13 -5
  18. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +13 -0
  19. package/dist/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.d.ts +25 -0
  20. package/dist/lexicon/types/{app/bsky/moderation/getServices.d.ts → com/atproto/admin/listCommunicationTemplates.d.ts} +2 -3
  21. package/dist/lexicon/types/com/atproto/admin/updateCommunicationTemplate.d.ts +39 -0
  22. package/package.json +8 -8
  23. package/src/api/admin/createCommunicationTemplate.ts +37 -0
  24. package/src/api/admin/deleteCommunicationTemplate.ts +23 -0
  25. package/src/api/admin/listCommunicationTemplates.ts +31 -0
  26. package/src/api/admin/updateCommunicationTemplate.ts +40 -0
  27. package/src/api/index.ts +8 -0
  28. package/src/communication-service/template.ts +105 -0
  29. package/src/context.ts +12 -0
  30. package/src/db/migrations/20240116T085607200Z-communication-template.ts +23 -0
  31. package/src/db/migrations/index.ts +1 -0
  32. package/src/db/schema/communication_template.ts +18 -0
  33. package/src/db/schema/index.ts +3 -1
  34. package/src/lexicon/index.ts +60 -0
  35. package/src/lexicon/lexicons.ts +249 -0
  36. package/src/lexicon/types/app/bsky/unspecced/getTaggedSuggestions.ts +65 -0
  37. package/src/lexicon/types/com/atproto/admin/createCommunicationTemplate.ts +54 -0
  38. package/src/lexicon/types/com/atproto/admin/defs.ts +35 -0
  39. package/src/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.ts +38 -0
  40. package/src/lexicon/types/com/atproto/admin/listCommunicationTemplates.ts +44 -0
  41. package/src/lexicon/types/com/atproto/admin/updateCommunicationTemplate.ts +57 -0
  42. package/tests/communication-templates.test.ts +131 -0
  43. package/dist/api/com/atproto/admin/emitModerationEvent.d.ts +0 -3
  44. package/dist/api/com/atproto/admin/getModerationEvent.d.ts +0 -3
  45. package/dist/api/com/atproto/admin/getRecord.d.ts +0 -3
  46. package/dist/api/com/atproto/admin/getRepo.d.ts +0 -3
  47. package/dist/api/com/atproto/admin/queryModerationEvents.d.ts +0 -3
  48. package/dist/api/com/atproto/admin/queryModerationStatuses.d.ts +0 -3
  49. package/dist/api/com/atproto/admin/searchRepos.d.ts +0 -3
  50. package/dist/api/com/atproto/admin/util.d.ts +0 -5
  51. package/dist/api/com/atproto/moderation/createReport.d.ts +0 -3
  52. package/dist/api/com/atproto/moderation/util.d.ts +0 -4
  53. package/dist/api/com/atproto/temp/fetchLabels.d.ts +0 -3
  54. package/dist/api/util.d.ts +0 -2
  55. package/dist/auth-verifier.d.ts +0 -47
  56. package/dist/config.d.ts +0 -42
  57. package/dist/daemon/config.d.ts +0 -23
  58. package/dist/lexicon/types/app/bsky/moderation/defs.d.ts +0 -49
  59. package/dist/lexicon/types/app/bsky/moderation/service.d.ts +0 -17
  60. package/dist/sequencer/index.d.ts +0 -2
  61. package/dist/sequencer/outbox.d.ts +0 -16
  62. package/dist/sequencer/sequencer.d.ts +0 -35
  63. package/dist/services/index.d.ts +0 -7
  64. package/dist/services/moderation/index.d.ts +0 -144
  65. package/dist/services/moderation/status.d.ts +0 -12
  66. package/dist/services/moderation/subject.d.ts +0 -60
  67. package/dist/services/moderation/types.d.ts +0 -19
  68. package/dist/services/moderation/views.d.ts +0 -42
  69. package/dist/services/types.d.ts +0 -2
  70. package/dist/util/date.d.ts +0 -1
  71. package/dist/util/debug.d.ts +0 -1
  72. package/dist/util/retry.d.ts +0 -3
  73. package/test.log +0 -0
  74. /package/dist/api/{label/queryLabels.d.ts → admin/createCommunicationTemplate.d.ts} +0 -0
  75. /package/dist/api/{label/subscribeLabels.d.ts → admin/deleteCommunicationTemplate.d.ts} +0 -0
@@ -1,5 +1,7 @@
1
1
  import { Server as XrpcServer, Options as XrpcOptions, AuthVerifier, StreamAuthVerifier } from '@atproto/xrpc-server';
2
+ import * as ComAtprotoAdminCreateCommunicationTemplate from './types/com/atproto/admin/createCommunicationTemplate';
2
3
  import * as ComAtprotoAdminDeleteAccount from './types/com/atproto/admin/deleteAccount';
4
+ import * as ComAtprotoAdminDeleteCommunicationTemplate from './types/com/atproto/admin/deleteCommunicationTemplate';
3
5
  import * as ComAtprotoAdminDisableAccountInvites from './types/com/atproto/admin/disableAccountInvites';
4
6
  import * as ComAtprotoAdminDisableInviteCodes from './types/com/atproto/admin/disableInviteCodes';
5
7
  import * as ComAtprotoAdminEmitModerationEvent from './types/com/atproto/admin/emitModerationEvent';
@@ -11,12 +13,14 @@ import * as ComAtprotoAdminGetModerationEvent from './types/com/atproto/admin/ge
11
13
  import * as ComAtprotoAdminGetRecord from './types/com/atproto/admin/getRecord';
12
14
  import * as ComAtprotoAdminGetRepo from './types/com/atproto/admin/getRepo';
13
15
  import * as ComAtprotoAdminGetSubjectStatus from './types/com/atproto/admin/getSubjectStatus';
16
+ import * as ComAtprotoAdminListCommunicationTemplates from './types/com/atproto/admin/listCommunicationTemplates';
14
17
  import * as ComAtprotoAdminQueryModerationEvents from './types/com/atproto/admin/queryModerationEvents';
15
18
  import * as ComAtprotoAdminQueryModerationStatuses from './types/com/atproto/admin/queryModerationStatuses';
16
19
  import * as ComAtprotoAdminSearchRepos from './types/com/atproto/admin/searchRepos';
17
20
  import * as ComAtprotoAdminSendEmail from './types/com/atproto/admin/sendEmail';
18
21
  import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/updateAccountEmail';
19
22
  import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle';
23
+ import * as ComAtprotoAdminUpdateCommunicationTemplate from './types/com/atproto/admin/updateCommunicationTemplate';
20
24
  import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus';
21
25
  import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle';
22
26
  import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle';
@@ -110,6 +114,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
110
114
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush';
111
115
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen';
112
116
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators';
117
+ import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions';
113
118
  import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton';
114
119
  import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton';
115
120
  import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton';
@@ -158,7 +163,9 @@ export declare class ComAtprotoNS {
158
163
  export declare class ComAtprotoAdminNS {
159
164
  _server: Server;
160
165
  constructor(server: Server);
166
+ createCommunicationTemplate<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminCreateCommunicationTemplate.Handler<ExtractAuth<AV>>, ComAtprotoAdminCreateCommunicationTemplate.HandlerReqCtx<ExtractAuth<AV>>>): void;
161
167
  deleteAccount<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminDeleteAccount.Handler<ExtractAuth<AV>>, ComAtprotoAdminDeleteAccount.HandlerReqCtx<ExtractAuth<AV>>>): void;
168
+ deleteCommunicationTemplate<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminDeleteCommunicationTemplate.Handler<ExtractAuth<AV>>, ComAtprotoAdminDeleteCommunicationTemplate.HandlerReqCtx<ExtractAuth<AV>>>): void;
162
169
  disableAccountInvites<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminDisableAccountInvites.Handler<ExtractAuth<AV>>, ComAtprotoAdminDisableAccountInvites.HandlerReqCtx<ExtractAuth<AV>>>): void;
163
170
  disableInviteCodes<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminDisableInviteCodes.Handler<ExtractAuth<AV>>, ComAtprotoAdminDisableInviteCodes.HandlerReqCtx<ExtractAuth<AV>>>): void;
164
171
  emitModerationEvent<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminEmitModerationEvent.Handler<ExtractAuth<AV>>, ComAtprotoAdminEmitModerationEvent.HandlerReqCtx<ExtractAuth<AV>>>): void;
@@ -170,12 +177,14 @@ export declare class ComAtprotoAdminNS {
170
177
  getRecord<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminGetRecord.Handler<ExtractAuth<AV>>, ComAtprotoAdminGetRecord.HandlerReqCtx<ExtractAuth<AV>>>): void;
171
178
  getRepo<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminGetRepo.Handler<ExtractAuth<AV>>, ComAtprotoAdminGetRepo.HandlerReqCtx<ExtractAuth<AV>>>): void;
172
179
  getSubjectStatus<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminGetSubjectStatus.Handler<ExtractAuth<AV>>, ComAtprotoAdminGetSubjectStatus.HandlerReqCtx<ExtractAuth<AV>>>): void;
180
+ listCommunicationTemplates<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminListCommunicationTemplates.Handler<ExtractAuth<AV>>, ComAtprotoAdminListCommunicationTemplates.HandlerReqCtx<ExtractAuth<AV>>>): void;
173
181
  queryModerationEvents<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminQueryModerationEvents.Handler<ExtractAuth<AV>>, ComAtprotoAdminQueryModerationEvents.HandlerReqCtx<ExtractAuth<AV>>>): void;
174
182
  queryModerationStatuses<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminQueryModerationStatuses.Handler<ExtractAuth<AV>>, ComAtprotoAdminQueryModerationStatuses.HandlerReqCtx<ExtractAuth<AV>>>): void;
175
183
  searchRepos<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminSearchRepos.Handler<ExtractAuth<AV>>, ComAtprotoAdminSearchRepos.HandlerReqCtx<ExtractAuth<AV>>>): void;
176
184
  sendEmail<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminSendEmail.Handler<ExtractAuth<AV>>, ComAtprotoAdminSendEmail.HandlerReqCtx<ExtractAuth<AV>>>): void;
177
185
  updateAccountEmail<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminUpdateAccountEmail.Handler<ExtractAuth<AV>>, ComAtprotoAdminUpdateAccountEmail.HandlerReqCtx<ExtractAuth<AV>>>): void;
178
186
  updateAccountHandle<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminUpdateAccountHandle.Handler<ExtractAuth<AV>>, ComAtprotoAdminUpdateAccountHandle.HandlerReqCtx<ExtractAuth<AV>>>): void;
187
+ updateCommunicationTemplate<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminUpdateCommunicationTemplate.Handler<ExtractAuth<AV>>, ComAtprotoAdminUpdateCommunicationTemplate.HandlerReqCtx<ExtractAuth<AV>>>): void;
179
188
  updateSubjectStatus<AV extends AuthVerifier>(cfg: ConfigOf<AV, ComAtprotoAdminUpdateSubjectStatus.Handler<ExtractAuth<AV>>, ComAtprotoAdminUpdateSubjectStatus.HandlerReqCtx<ExtractAuth<AV>>>): void;
180
189
  }
181
190
  export declare class ComAtprotoIdentityNS {
@@ -341,6 +350,7 @@ export declare class AppBskyUnspeccedNS {
341
350
  _server: Server;
342
351
  constructor(server: Server);
343
352
  getPopularFeedGenerators<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetPopularFeedGenerators.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetPopularFeedGenerators.HandlerReqCtx<ExtractAuth<AV>>>): void;
353
+ getTaggedSuggestions<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTaggedSuggestions.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTaggedSuggestions.HandlerReqCtx<ExtractAuth<AV>>>): void;
344
354
  getTimelineSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedGetTimelineSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedGetTimelineSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
345
355
  searchActorsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchActorsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchActorsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
346
356
  searchPostsSkeleton<AV extends AuthVerifier>(cfg: ConfigOf<AV, AppBskyUnspeccedSearchPostsSkeleton.Handler<ExtractAuth<AV>>, AppBskyUnspeccedSearchPostsSkeleton.HandlerReqCtx<ExtractAuth<AV>>>): void;
@@ -1,5 +1,48 @@
1
1
  import { LexiconDoc, Lexicons } from '@atproto/lexicon';
2
2
  export declare const schemaDict: {
3
+ ComAtprotoAdminCreateCommunicationTemplate: {
4
+ lexicon: number;
5
+ id: string;
6
+ defs: {
7
+ main: {
8
+ type: string;
9
+ description: string;
10
+ input: {
11
+ encoding: string;
12
+ schema: {
13
+ type: string;
14
+ required: string[];
15
+ properties: {
16
+ name: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ contentMarkdown: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ subject: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ createdBy: {
29
+ type: string;
30
+ format: string;
31
+ description: string;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ output: {
37
+ encoding: string;
38
+ schema: {
39
+ type: string;
40
+ ref: string;
41
+ };
42
+ };
43
+ };
44
+ };
45
+ };
3
46
  ComAtprotoAdminDefs: {
4
47
  lexicon: number;
5
48
  id: string;
@@ -736,6 +779,43 @@ export declare const schemaDict: {
736
779
  };
737
780
  };
738
781
  };
782
+ communicationTemplateView: {
783
+ type: string;
784
+ required: string[];
785
+ properties: {
786
+ id: {
787
+ type: string;
788
+ };
789
+ name: {
790
+ type: string;
791
+ description: string;
792
+ };
793
+ subject: {
794
+ type: string;
795
+ description: string;
796
+ };
797
+ contentMarkdown: {
798
+ type: string;
799
+ description: string;
800
+ };
801
+ disabled: {
802
+ type: string;
803
+ };
804
+ lastUpdatedBy: {
805
+ type: string;
806
+ format: string;
807
+ description: string;
808
+ };
809
+ createdAt: {
810
+ type: string;
811
+ format: string;
812
+ };
813
+ updatedAt: {
814
+ type: string;
815
+ format: string;
816
+ };
817
+ };
818
+ };
739
819
  };
740
820
  };
741
821
  ComAtprotoAdminDeleteAccount: {
@@ -761,6 +841,28 @@ export declare const schemaDict: {
761
841
  };
762
842
  };
763
843
  };
844
+ ComAtprotoAdminDeleteCommunicationTemplate: {
845
+ lexicon: number;
846
+ id: string;
847
+ defs: {
848
+ main: {
849
+ type: string;
850
+ description: string;
851
+ input: {
852
+ encoding: string;
853
+ schema: {
854
+ type: string;
855
+ required: string[];
856
+ properties: {
857
+ id: {
858
+ type: string;
859
+ };
860
+ };
861
+ };
862
+ };
863
+ };
864
+ };
865
+ };
764
866
  ComAtprotoAdminDisableAccountInvites: {
765
867
  lexicon: number;
766
868
  id: string;
@@ -1141,6 +1243,32 @@ export declare const schemaDict: {
1141
1243
  };
1142
1244
  };
1143
1245
  };
1246
+ ComAtprotoAdminListCommunicationTemplates: {
1247
+ lexicon: number;
1248
+ id: string;
1249
+ defs: {
1250
+ main: {
1251
+ type: string;
1252
+ description: string;
1253
+ output: {
1254
+ encoding: string;
1255
+ schema: {
1256
+ type: string;
1257
+ required: string[];
1258
+ properties: {
1259
+ communicationTemplates: {
1260
+ type: string;
1261
+ items: {
1262
+ type: string;
1263
+ ref: string;
1264
+ };
1265
+ };
1266
+ };
1267
+ };
1268
+ };
1269
+ };
1270
+ };
1271
+ };
1144
1272
  ComAtprotoAdminQueryModerationEvents: {
1145
1273
  lexicon: number;
1146
1274
  id: string;
@@ -1472,6 +1600,56 @@ export declare const schemaDict: {
1472
1600
  };
1473
1601
  };
1474
1602
  };
1603
+ ComAtprotoAdminUpdateCommunicationTemplate: {
1604
+ lexicon: number;
1605
+ id: string;
1606
+ defs: {
1607
+ main: {
1608
+ type: string;
1609
+ description: string;
1610
+ input: {
1611
+ encoding: string;
1612
+ schema: {
1613
+ type: string;
1614
+ required: string[];
1615
+ properties: {
1616
+ id: {
1617
+ type: string;
1618
+ description: string;
1619
+ };
1620
+ name: {
1621
+ type: string;
1622
+ description: string;
1623
+ };
1624
+ contentMarkdown: {
1625
+ type: string;
1626
+ description: string;
1627
+ };
1628
+ subject: {
1629
+ type: string;
1630
+ description: string;
1631
+ };
1632
+ updatedBy: {
1633
+ type: string;
1634
+ format: string;
1635
+ description: string;
1636
+ };
1637
+ disabled: {
1638
+ type: string;
1639
+ };
1640
+ };
1641
+ };
1642
+ };
1643
+ output: {
1644
+ encoding: string;
1645
+ schema: {
1646
+ type: string;
1647
+ ref: string;
1648
+ };
1649
+ };
1650
+ };
1651
+ };
1652
+ };
1475
1653
  ComAtprotoAdminUpdateSubjectStatus: {
1476
1654
  lexicon: number;
1477
1655
  id: string;
@@ -7245,6 +7423,53 @@ export declare const schemaDict: {
7245
7423
  };
7246
7424
  };
7247
7425
  };
7426
+ AppBskyUnspeccedGetTaggedSuggestions: {
7427
+ lexicon: number;
7428
+ id: string;
7429
+ defs: {
7430
+ main: {
7431
+ type: string;
7432
+ description: string;
7433
+ parameters: {
7434
+ type: string;
7435
+ properties: {};
7436
+ };
7437
+ output: {
7438
+ encoding: string;
7439
+ schema: {
7440
+ type: string;
7441
+ required: string[];
7442
+ properties: {
7443
+ suggestions: {
7444
+ type: string;
7445
+ items: {
7446
+ type: string;
7447
+ ref: string;
7448
+ };
7449
+ };
7450
+ };
7451
+ };
7452
+ };
7453
+ };
7454
+ suggestion: {
7455
+ type: string;
7456
+ required: string[];
7457
+ properties: {
7458
+ tag: {
7459
+ type: string;
7460
+ };
7461
+ subjectType: {
7462
+ type: string;
7463
+ knownValues: string[];
7464
+ };
7465
+ subject: {
7466
+ type: string;
7467
+ format: string;
7468
+ };
7469
+ };
7470
+ };
7471
+ };
7472
+ };
7248
7473
  AppBskyUnspeccedGetTimelineSkeleton: {
7249
7474
  lexicon: number;
7250
7475
  id: string;
@@ -7411,8 +7636,10 @@ export declare const schemaDict: {
7411
7636
  export declare const schemas: LexiconDoc[];
7412
7637
  export declare const lexicons: Lexicons;
7413
7638
  export declare const ids: {
7639
+ ComAtprotoAdminCreateCommunicationTemplate: string;
7414
7640
  ComAtprotoAdminDefs: string;
7415
7641
  ComAtprotoAdminDeleteAccount: string;
7642
+ ComAtprotoAdminDeleteCommunicationTemplate: string;
7416
7643
  ComAtprotoAdminDisableAccountInvites: string;
7417
7644
  ComAtprotoAdminDisableInviteCodes: string;
7418
7645
  ComAtprotoAdminEmitModerationEvent: string;
@@ -7424,12 +7651,14 @@ export declare const ids: {
7424
7651
  ComAtprotoAdminGetRecord: string;
7425
7652
  ComAtprotoAdminGetRepo: string;
7426
7653
  ComAtprotoAdminGetSubjectStatus: string;
7654
+ ComAtprotoAdminListCommunicationTemplates: string;
7427
7655
  ComAtprotoAdminQueryModerationEvents: string;
7428
7656
  ComAtprotoAdminQueryModerationStatuses: string;
7429
7657
  ComAtprotoAdminSearchRepos: string;
7430
7658
  ComAtprotoAdminSendEmail: string;
7431
7659
  ComAtprotoAdminUpdateAccountEmail: string;
7432
7660
  ComAtprotoAdminUpdateAccountHandle: string;
7661
+ ComAtprotoAdminUpdateCommunicationTemplate: string;
7433
7662
  ComAtprotoAdminUpdateSubjectStatus: string;
7434
7663
  ComAtprotoIdentityResolveHandle: string;
7435
7664
  ComAtprotoIdentityUpdateHandle: string;
@@ -7547,6 +7776,7 @@ export declare const ids: {
7547
7776
  AppBskyRichtextFacet: string;
7548
7777
  AppBskyUnspeccedDefs: string;
7549
7778
  AppBskyUnspeccedGetPopularFeedGenerators: string;
7779
+ AppBskyUnspeccedGetTaggedSuggestions: string;
7550
7780
  AppBskyUnspeccedGetTimelineSkeleton: string;
7551
7781
  AppBskyUnspeccedSearchActorsSkeleton: string;
7552
7782
  AppBskyUnspeccedSearchPostsSkeleton: string;
@@ -1,15 +1,11 @@
1
1
  import express from 'express';
2
+ import { ValidationResult } from '@atproto/lexicon';
2
3
  import { HandlerAuth } from '@atproto/xrpc-server';
3
- import * as AppBskyFeedDefs from '../feed/defs';
4
4
  export interface QueryParams {
5
- includeNsfw: boolean;
6
- limit: number;
7
- cursor?: string;
8
5
  }
9
6
  export type InputSchema = undefined;
10
7
  export interface OutputSchema {
11
- cursor?: string;
12
- feed: AppBskyFeedDefs.FeedViewPost[];
8
+ suggestions: Suggestion[];
13
9
  [k: string]: unknown;
14
10
  }
15
11
  export type HandlerInput = undefined;
@@ -33,3 +29,11 @@ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
33
29
  res: express.Response;
34
30
  };
35
31
  export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
32
+ export interface Suggestion {
33
+ tag: string;
34
+ subjectType: 'actor' | 'feed' | (string & {});
35
+ subject: string;
36
+ [k: string]: unknown;
37
+ }
38
+ export declare function isSuggestion(v: unknown): v is Suggestion;
39
+ export declare function validateSuggestion(v: unknown): ValidationResult;
@@ -1,12 +1,20 @@
1
1
  import express from 'express';
2
2
  import { HandlerAuth } from '@atproto/xrpc-server';
3
- import * as AppBskyModerationDefs from './defs';
3
+ import * as ComAtprotoAdminDefs from './defs';
4
4
  export interface QueryParams {
5
- did: string;
6
5
  }
7
- export type InputSchema = undefined;
8
- export type OutputSchema = AppBskyModerationDefs.ModServiceViewDetailed;
9
- export type HandlerInput = undefined;
6
+ export interface InputSchema {
7
+ name: string;
8
+ contentMarkdown: string;
9
+ subject: string;
10
+ createdBy?: string;
11
+ [k: string]: unknown;
12
+ }
13
+ export type OutputSchema = ComAtprotoAdminDefs.CommunicationTemplateView;
14
+ export interface HandlerInput {
15
+ encoding: 'application/json';
16
+ body: InputSchema;
17
+ }
10
18
  export interface HandlerSuccess {
11
19
  encoding: 'application/json';
12
20
  body: OutputSchema;
@@ -317,3 +317,16 @@ export interface ModEventEmail {
317
317
  }
318
318
  export declare function isModEventEmail(v: unknown): v is ModEventEmail;
319
319
  export declare function validateModEventEmail(v: unknown): ValidationResult;
320
+ export interface CommunicationTemplateView {
321
+ id: string;
322
+ name: string;
323
+ subject?: string;
324
+ contentMarkdown: string;
325
+ disabled: boolean;
326
+ lastUpdatedBy: string;
327
+ createdAt: string;
328
+ updatedAt: string;
329
+ [k: string]: unknown;
330
+ }
331
+ export declare function isCommunicationTemplateView(v: unknown): v is CommunicationTemplateView;
332
+ export declare function validateCommunicationTemplateView(v: unknown): ValidationResult;
@@ -0,0 +1,25 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ export interface QueryParams {
4
+ }
5
+ export interface InputSchema {
6
+ id: string;
7
+ [k: string]: unknown;
8
+ }
9
+ export interface HandlerInput {
10
+ encoding: 'application/json';
11
+ body: InputSchema;
12
+ }
13
+ export interface HandlerError {
14
+ status: number;
15
+ message?: string;
16
+ }
17
+ export type HandlerOutput = HandlerError | void;
18
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
19
+ auth: HA;
20
+ params: QueryParams;
21
+ input: HandlerInput;
22
+ req: express.Request;
23
+ res: express.Response;
24
+ };
25
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
@@ -1,12 +1,11 @@
1
1
  import express from 'express';
2
2
  import { HandlerAuth } from '@atproto/xrpc-server';
3
- import * as AppBskyModerationDefs from './defs';
3
+ import * as ComAtprotoAdminDefs from './defs';
4
4
  export interface QueryParams {
5
- dids: string[];
6
5
  }
7
6
  export type InputSchema = undefined;
8
7
  export interface OutputSchema {
9
- views: AppBskyModerationDefs.ModServiceView[];
8
+ communicationTemplates: ComAtprotoAdminDefs.CommunicationTemplateView[];
10
9
  [k: string]: unknown;
11
10
  }
12
11
  export type HandlerInput = undefined;
@@ -0,0 +1,39 @@
1
+ import express from 'express';
2
+ import { HandlerAuth } from '@atproto/xrpc-server';
3
+ import * as ComAtprotoAdminDefs from './defs';
4
+ export interface QueryParams {
5
+ }
6
+ export interface InputSchema {
7
+ id: string;
8
+ name?: string;
9
+ contentMarkdown?: string;
10
+ subject?: string;
11
+ updatedBy?: string;
12
+ disabled?: boolean;
13
+ [k: string]: unknown;
14
+ }
15
+ export type OutputSchema = ComAtprotoAdminDefs.CommunicationTemplateView;
16
+ export interface HandlerInput {
17
+ encoding: 'application/json';
18
+ body: InputSchema;
19
+ }
20
+ export interface HandlerSuccess {
21
+ encoding: 'application/json';
22
+ body: OutputSchema;
23
+ headers?: {
24
+ [key: string]: string;
25
+ };
26
+ }
27
+ export interface HandlerError {
28
+ status: number;
29
+ message?: string;
30
+ }
31
+ export type HandlerOutput = HandlerError | HandlerSuccess;
32
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
33
+ auth: HA;
34
+ params: QueryParams;
35
+ input: HandlerInput;
36
+ req: express.Request;
37
+ res: express.Response;
38
+ };
39
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/ozone",
3
- "version": "0.0.2",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "description": "Backend service for moderating the Bluesky network.",
6
6
  "keywords": [
@@ -30,13 +30,13 @@
30
30
  "pino-http": "^8.2.1",
31
31
  "typed-emitter": "^2.1.0",
32
32
  "uint8arrays": "3.0.0",
33
+ "@atproto/api": "^0.9.3",
33
34
  "@atproto/common": "^0.3.3",
35
+ "@atproto/crypto": "^0.3.0",
34
36
  "@atproto/syntax": "^0.1.5",
35
37
  "@atproto/identity": "^0.3.2",
36
38
  "@atproto/lexicon": "^0.3.1",
37
- "@atproto/xrpc-server": "^0.4.2",
38
- "@atproto/crypto": "^0.3.0",
39
- "@atproto/api": "^0.9.0"
39
+ "@atproto/xrpc-server": "^0.4.2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@did-plc/server": "^0.0.1",
@@ -46,11 +46,11 @@
46
46
  "@types/pg": "^8.6.6",
47
47
  "@types/qs": "^6.9.7",
48
48
  "axios": "^0.27.2",
49
+ "@atproto/api": "^0.9.3",
50
+ "@atproto/dev-env": "^0.2.26",
49
51
  "@atproto/lex-cli": "^0.3.0",
50
- "@atproto/api": "^0.9.0",
51
- "@atproto/xrpc": "^0.4.1",
52
- "@atproto/dev-env": "^0.2.23",
53
- "@atproto/pds": "^0.3.11"
52
+ "@atproto/pds": "^0.3.14",
53
+ "@atproto/xrpc": "^0.4.1"
54
54
  },
55
55
  "scripts": {
56
56
  "codegen": "lex gen-server ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
@@ -0,0 +1,37 @@
1
+ import { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'
2
+ import { Server } from '../../lexicon'
3
+ import AppContext from '../../context'
4
+
5
+ export default function (server: Server, ctx: AppContext) {
6
+ server.com.atproto.admin.createCommunicationTemplate({
7
+ auth: ctx.roleVerifier,
8
+ handler: async ({ input, auth }) => {
9
+ const access = auth.credentials
10
+ const db = ctx.db
11
+ const { createdBy, ...template } = input.body
12
+
13
+ if (!access.admin) {
14
+ throw new AuthRequiredError(
15
+ 'Must be an admin to create a communication template',
16
+ )
17
+ }
18
+
19
+ // Once auth starts providing us with the caller's DID, we can get rid of this check
20
+ if (!createdBy) {
21
+ throw new InvalidRequestError('createdBy field is required')
22
+ }
23
+
24
+ const communicationTemplate = ctx.communicationTemplateService(db)
25
+ const newTemplate = await communicationTemplate.create({
26
+ ...template,
27
+ disabled: false,
28
+ lastUpdatedBy: createdBy,
29
+ })
30
+
31
+ return {
32
+ encoding: 'application/json',
33
+ body: communicationTemplate.view(newTemplate),
34
+ }
35
+ },
36
+ })
37
+ }
@@ -0,0 +1,23 @@
1
+ import { AuthRequiredError } from '@atproto/xrpc-server'
2
+ import { Server } from '../../lexicon'
3
+ import AppContext from '../../context'
4
+
5
+ export default function (server: Server, ctx: AppContext) {
6
+ server.com.atproto.admin.deleteCommunicationTemplate({
7
+ auth: ctx.roleVerifier,
8
+ handler: async ({ input, auth }) => {
9
+ const access = auth.credentials
10
+ const db = ctx.db
11
+ const { id } = input.body
12
+
13
+ if (!access.admin) {
14
+ throw new AuthRequiredError(
15
+ 'Must be an admin to delete a communication template',
16
+ )
17
+ }
18
+
19
+ const communicationTemplate = ctx.communicationTemplateService(db)
20
+ await communicationTemplate.delete(Number(id))
21
+ },
22
+ })
23
+ }
@@ -0,0 +1,31 @@
1
+ import { AuthRequiredError } from '@atproto/xrpc-server'
2
+ import { Server } from '../../lexicon'
3
+ import AppContext from '../../context'
4
+
5
+ export default function (server: Server, ctx: AppContext) {
6
+ server.com.atproto.admin.listCommunicationTemplates({
7
+ auth: ctx.roleVerifier,
8
+ handler: async ({ auth }) => {
9
+ const access = auth.credentials
10
+ const db = ctx.db
11
+
12
+ if (!access.moderator) {
13
+ throw new AuthRequiredError(
14
+ 'Must be a full moderator to view list of communication template',
15
+ )
16
+ }
17
+
18
+ const communicationTemplate = ctx.communicationTemplateService(db)
19
+ const list = await communicationTemplate.list()
20
+
21
+ return {
22
+ encoding: 'application/json',
23
+ body: {
24
+ communicationTemplates: list.map((item) =>
25
+ communicationTemplate.view(item),
26
+ ),
27
+ },
28
+ }
29
+ },
30
+ })
31
+ }