@atproto/ozone 0.1.160 → 0.1.161

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 (68) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/api/moderation/emitEvent.d.ts.map +1 -1
  3. package/dist/api/moderation/emitEvent.js +29 -23
  4. package/dist/api/moderation/emitEvent.js.map +1 -1
  5. package/dist/lexicon/index.d.ts +2 -0
  6. package/dist/lexicon/index.d.ts.map +1 -1
  7. package/dist/lexicon/index.js +4 -0
  8. package/dist/lexicon/index.js.map +1 -1
  9. package/dist/lexicon/lexicons.d.ts +242 -46
  10. package/dist/lexicon/lexicons.d.ts.map +1 -1
  11. package/dist/lexicon/lexicons.js +139 -21
  12. package/dist/lexicon/lexicons.js.map +1 -1
  13. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +13 -1
  14. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  15. package/dist/lexicon/types/app/bsky/actor/defs.js +9 -0
  16. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  17. package/dist/lexicon/types/app/bsky/contact/defs.d.ts +10 -0
  18. package/dist/lexicon/types/app/bsky/contact/defs.d.ts.map +1 -1
  19. package/dist/lexicon/types/app/bsky/contact/defs.js +9 -0
  20. package/dist/lexicon/types/app/bsky/contact/defs.js.map +1 -1
  21. package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts +1 -1
  22. package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts.map +1 -1
  23. package/dist/lexicon/types/app/bsky/contact/dismissMatch.js.map +1 -1
  24. package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts +1 -1
  25. package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts.map +1 -1
  26. package/dist/lexicon/types/app/bsky/contact/getMatches.js.map +1 -1
  27. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts +1 -1
  28. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts.map +1 -1
  29. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js.map +1 -1
  30. package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts +1 -1
  31. package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts.map +1 -1
  32. package/dist/lexicon/types/app/bsky/contact/importContacts.js.map +1 -1
  33. package/dist/lexicon/types/app/bsky/contact/removeData.d.ts +1 -1
  34. package/dist/lexicon/types/app/bsky/contact/removeData.d.ts.map +1 -1
  35. package/dist/lexicon/types/app/bsky/contact/removeData.js.map +1 -1
  36. package/dist/lexicon/types/app/bsky/contact/sendNotification.d.ts +26 -0
  37. package/dist/lexicon/types/app/bsky/contact/sendNotification.d.ts.map +1 -0
  38. package/dist/lexicon/types/app/bsky/contact/sendNotification.js +7 -0
  39. package/dist/lexicon/types/app/bsky/contact/sendNotification.js.map +1 -0
  40. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts +1 -1
  41. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts.map +1 -1
  42. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js.map +1 -1
  43. package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts +1 -1
  44. package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts.map +1 -1
  45. package/dist/lexicon/types/app/bsky/contact/verifyPhone.js.map +1 -1
  46. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +1 -1
  47. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
  48. package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
  49. package/dist/mod-service/index.d.ts.map +1 -1
  50. package/dist/mod-service/index.js +10 -4
  51. package/dist/mod-service/index.js.map +1 -1
  52. package/package.json +5 -5
  53. package/src/api/moderation/emitEvent.ts +33 -25
  54. package/src/lexicon/index.ts +13 -0
  55. package/src/lexicon/lexicons.ts +145 -21
  56. package/src/lexicon/types/app/bsky/actor/defs.ts +22 -0
  57. package/src/lexicon/types/app/bsky/contact/defs.ts +19 -0
  58. package/src/lexicon/types/app/bsky/contact/dismissMatch.ts +1 -1
  59. package/src/lexicon/types/app/bsky/contact/getMatches.ts +1 -1
  60. package/src/lexicon/types/app/bsky/contact/getSyncStatus.ts +1 -1
  61. package/src/lexicon/types/app/bsky/contact/importContacts.ts +6 -1
  62. package/src/lexicon/types/app/bsky/contact/removeData.ts +1 -1
  63. package/src/lexicon/types/app/bsky/contact/sendNotification.ts +44 -0
  64. package/src/lexicon/types/app/bsky/contact/startPhoneVerification.ts +1 -1
  65. package/src/lexicon/types/app/bsky/contact/verifyPhone.ts +6 -1
  66. package/src/lexicon/types/app/bsky/notification/listNotifications.ts +1 -0
  67. package/src/mod-service/index.ts +12 -5
  68. package/tsconfig.build.tsbuildinfo +1 -1
@@ -315,36 +315,44 @@ export default function (server: Server, ctx: AppContext) {
315
315
  server.tools.ozone.moderation.emitEvent({
316
316
  auth: ctx.authVerifier.modOrAdminToken,
317
317
  handler: async ({ input, auth }) => {
318
- const moderationEvent = await handleModerationEvent({
319
- input,
320
- auth,
321
- ctx,
322
- })
323
-
324
- // On divert events, we need to automatically take down the blobs
325
- if (isModEventDivert(input.body.event)) {
326
- await handleModerationEvent({
318
+ try {
319
+ const moderationEvent = await handleModerationEvent({
320
+ input,
327
321
  auth,
328
322
  ctx,
329
- input: {
330
- ...input,
331
- body: {
332
- ...input.body,
333
- event: {
334
- ...input.body.event,
335
- $type: 'tools.ozone.moderation.defs#modEventTakedown',
336
- comment:
337
- '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',
323
+ })
324
+
325
+ // On divert events, we need to automatically take down the blobs
326
+ if (isModEventDivert(input.body.event)) {
327
+ await handleModerationEvent({
328
+ auth,
329
+ ctx,
330
+ input: {
331
+ ...input,
332
+ body: {
333
+ ...input.body,
334
+ event: {
335
+ ...input.body.event,
336
+ $type: 'tools.ozone.moderation.defs#modEventTakedown',
337
+ comment:
338
+ '[DIVERT_SIDE_EFFECT]: Automatically taking down after divert event',
339
+ },
340
+ modTool: input.body.modTool,
338
341
  },
339
- modTool: input.body.modTool,
340
342
  },
341
- },
342
- })
343
- }
343
+ })
344
+ }
344
345
 
345
- return {
346
- encoding: 'application/json',
347
- body: moderationEvent,
346
+ return {
347
+ encoding: 'application/json',
348
+ body: moderationEvent,
349
+ }
350
+ } catch (err) {
351
+ httpLogger.error(
352
+ { err, body: input.body },
353
+ 'failed to emit moderation event',
354
+ )
355
+ throw err
348
356
  }
349
357
  },
350
358
  })
@@ -28,6 +28,7 @@ import * as AppBskyContactGetMatches from './types/app/bsky/contact/getMatches.j
28
28
  import * as AppBskyContactGetSyncStatus from './types/app/bsky/contact/getSyncStatus.js'
29
29
  import * as AppBskyContactImportContacts from './types/app/bsky/contact/importContacts.js'
30
30
  import * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.js'
31
+ import * as AppBskyContactSendNotification from './types/app/bsky/contact/sendNotification.js'
31
32
  import * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
32
33
  import * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
33
34
  import * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator.js'
@@ -678,6 +679,18 @@ export class AppBskyContactNS {
678
679
  return this._server.xrpc.method(nsid, cfg)
679
680
  }
680
681
 
682
+ sendNotification<A extends Auth = void>(
683
+ cfg: MethodConfigOrHandler<
684
+ A,
685
+ AppBskyContactSendNotification.QueryParams,
686
+ AppBskyContactSendNotification.HandlerInput,
687
+ AppBskyContactSendNotification.HandlerOutput
688
+ >,
689
+ ) {
690
+ const nsid = 'app.bsky.contact.sendNotification' // @ts-ignore
691
+ return this._server.xrpc.method(nsid, cfg)
692
+ }
693
+
681
694
  startPhoneVerification<A extends Auth = void>(
682
695
  cfg: MethodConfigOrHandler<
683
696
  A,
@@ -401,6 +401,7 @@ export const schemaDict = {
401
401
  'lex:app.bsky.actor.defs#savedFeedsPref',
402
402
  'lex:app.bsky.actor.defs#savedFeedsPrefV2',
403
403
  'lex:app.bsky.actor.defs#personalDetailsPref',
404
+ 'lex:app.bsky.actor.defs#declaredAgePref',
404
405
  'lex:app.bsky.actor.defs#feedViewPref',
405
406
  'lex:app.bsky.actor.defs#threadViewPref',
406
407
  'lex:app.bsky.actor.defs#interestsPref',
@@ -507,6 +508,28 @@ export const schemaDict = {
507
508
  },
508
509
  },
509
510
  },
511
+ declaredAgePref: {
512
+ type: 'object',
513
+ description:
514
+ "Read-only preference containing value(s) inferred from the user's declared birthdate. Absence of this preference object in the response indicates that the user has not made a declaration.",
515
+ properties: {
516
+ isOverAge13: {
517
+ type: 'boolean',
518
+ description:
519
+ 'Indicates if the user has declared that they are over 13 years of age.',
520
+ },
521
+ isOverAge16: {
522
+ type: 'boolean',
523
+ description:
524
+ 'Indicates if the user has declared that they are over 16 years of age.',
525
+ },
526
+ isOverAge18: {
527
+ type: 'boolean',
528
+ description:
529
+ 'Indicates if the user has declared that they are over 18 years of age.',
530
+ },
531
+ },
532
+ },
510
533
  feedViewPref: {
511
534
  type: 'object',
512
535
  required: ['feed'],
@@ -1776,6 +1799,24 @@ export const schemaDict = {
1776
1799
  },
1777
1800
  },
1778
1801
  },
1802
+ notification: {
1803
+ description:
1804
+ 'A stash object to be sent via bsync representing a notification to be created.',
1805
+ type: 'object',
1806
+ required: ['from', 'to'],
1807
+ properties: {
1808
+ from: {
1809
+ description: 'The DID of who this notification comes from.',
1810
+ type: 'string',
1811
+ format: 'did',
1812
+ },
1813
+ to: {
1814
+ description: 'The DID of who this notification should go to.',
1815
+ type: 'string',
1816
+ format: 'did',
1817
+ },
1818
+ },
1819
+ },
1779
1820
  },
1780
1821
  },
1781
1822
  AppBskyContactDismissMatch: {
@@ -1785,7 +1826,7 @@ export const schemaDict = {
1785
1826
  main: {
1786
1827
  type: 'procedure',
1787
1828
  description:
1788
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Removes a match that was found via contact import. It shouldn't appear again if the same contact is re-imported. Requires authentication.",
1829
+ "Removes a match that was found via contact import. It shouldn't appear again if the same contact is re-imported. Requires authentication.",
1789
1830
  input: {
1790
1831
  encoding: 'application/json',
1791
1832
  schema: {
@@ -1809,8 +1850,10 @@ export const schemaDict = {
1809
1850
  },
1810
1851
  errors: [
1811
1852
  {
1812
- name: 'TODO',
1813
- description: 'TODO',
1853
+ name: 'InvalidDid',
1854
+ },
1855
+ {
1856
+ name: 'InternalError',
1814
1857
  },
1815
1858
  ],
1816
1859
  },
@@ -1823,7 +1866,7 @@ export const schemaDict = {
1823
1866
  main: {
1824
1867
  type: 'query',
1825
1868
  description:
1826
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Returns the matched contacts (contacts that were mutually imported). Excludes dismissed matches. Requires authentication.",
1869
+ 'Returns the matched contacts (contacts that were mutually imported). Excludes dismissed matches. Requires authentication.',
1827
1870
  parameters: {
1828
1871
  type: 'params',
1829
1872
  properties: {
@@ -1859,8 +1902,16 @@ export const schemaDict = {
1859
1902
  },
1860
1903
  errors: [
1861
1904
  {
1862
- name: 'TODO',
1863
- description: 'TODO',
1905
+ name: 'InvalidDid',
1906
+ },
1907
+ {
1908
+ name: 'InvalidLimit',
1909
+ },
1910
+ {
1911
+ name: 'InvalidCursor',
1912
+ },
1913
+ {
1914
+ name: 'InternalError',
1864
1915
  },
1865
1916
  ],
1866
1917
  },
@@ -1873,7 +1924,7 @@ export const schemaDict = {
1873
1924
  main: {
1874
1925
  type: 'query',
1875
1926
  description:
1876
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Gets the user's current contact import status. Requires authentication.",
1927
+ "Gets the user's current contact import status. Requires authentication.",
1877
1928
  parameters: {
1878
1929
  type: 'params',
1879
1930
  properties: {},
@@ -1894,8 +1945,10 @@ export const schemaDict = {
1894
1945
  },
1895
1946
  errors: [
1896
1947
  {
1897
- name: 'TODO',
1898
- description: 'TODO',
1948
+ name: 'InvalidDid',
1949
+ },
1950
+ {
1951
+ name: 'InternalError',
1899
1952
  },
1900
1953
  ],
1901
1954
  },
@@ -1908,7 +1961,7 @@ export const schemaDict = {
1908
1961
  main: {
1909
1962
  type: 'procedure',
1910
1963
  description:
1911
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Import contacts for securely matching with other users. This follows the protocol explained in https://docs.bsky.app/blog/contact-import-rfc. Requires authentication.",
1964
+ 'Import contacts for securely matching with other users. This follows the protocol explained in https://docs.bsky.app/blog/contact-import-rfc. Requires authentication.',
1912
1965
  input: {
1913
1966
  encoding: 'application/json',
1914
1967
  schema: {
@@ -1953,8 +2006,19 @@ export const schemaDict = {
1953
2006
  },
1954
2007
  errors: [
1955
2008
  {
1956
- name: 'TODO',
1957
- description: 'TODO',
2009
+ name: 'InvalidDid',
2010
+ },
2011
+ {
2012
+ name: 'InvalidContacts',
2013
+ },
2014
+ {
2015
+ name: 'TooManyContacts',
2016
+ },
2017
+ {
2018
+ name: 'InvalidToken',
2019
+ },
2020
+ {
2021
+ name: 'InternalError',
1958
2022
  },
1959
2023
  ],
1960
2024
  },
@@ -1967,7 +2031,7 @@ export const schemaDict = {
1967
2031
  main: {
1968
2032
  type: 'procedure',
1969
2033
  description:
1970
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Removes all stored hashes used for contact matching, existing matches, and sync status. Requires authentication.",
2034
+ 'Removes all stored hashes used for contact matching, existing matches, and sync status. Requires authentication.',
1971
2035
  input: {
1972
2036
  encoding: 'application/json',
1973
2037
  schema: {
@@ -1984,13 +2048,52 @@ export const schemaDict = {
1984
2048
  },
1985
2049
  errors: [
1986
2050
  {
1987
- name: 'TODO',
1988
- description: 'TODO',
2051
+ name: 'InvalidDid',
2052
+ },
2053
+ {
2054
+ name: 'InternalError',
1989
2055
  },
1990
2056
  ],
1991
2057
  },
1992
2058
  },
1993
2059
  },
2060
+ AppBskyContactSendNotification: {
2061
+ lexicon: 1,
2062
+ id: 'app.bsky.contact.sendNotification',
2063
+ defs: {
2064
+ main: {
2065
+ type: 'procedure',
2066
+ description:
2067
+ 'System endpoint to send notifications related to contact imports. Requires role authentication.',
2068
+ input: {
2069
+ encoding: 'application/json',
2070
+ schema: {
2071
+ type: 'object',
2072
+ required: ['from', 'to'],
2073
+ properties: {
2074
+ from: {
2075
+ description: 'The DID of who this notification comes from.',
2076
+ type: 'string',
2077
+ format: 'did',
2078
+ },
2079
+ to: {
2080
+ description: 'The DID of who this notification should go to.',
2081
+ type: 'string',
2082
+ format: 'did',
2083
+ },
2084
+ },
2085
+ },
2086
+ },
2087
+ output: {
2088
+ encoding: 'application/json',
2089
+ schema: {
2090
+ type: 'object',
2091
+ properties: {},
2092
+ },
2093
+ },
2094
+ },
2095
+ },
2096
+ },
1994
2097
  AppBskyContactStartPhoneVerification: {
1995
2098
  lexicon: 1,
1996
2099
  id: 'app.bsky.contact.startPhoneVerification',
@@ -1998,7 +2101,7 @@ export const schemaDict = {
1998
2101
  main: {
1999
2102
  type: 'procedure',
2000
2103
  description:
2001
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Starts a phone verification flow. The phone passed will receive a code via SMS that should be passed to `app.bsky.contact.verifyPhone`. Requires authentication.",
2104
+ 'Starts a phone verification flow. The phone passed will receive a code via SMS that should be passed to `app.bsky.contact.verifyPhone`. Requires authentication.',
2002
2105
  input: {
2003
2106
  encoding: 'application/json',
2004
2107
  schema: {
@@ -2021,8 +2124,16 @@ export const schemaDict = {
2021
2124
  },
2022
2125
  errors: [
2023
2126
  {
2024
- name: 'TODO',
2025
- description: 'TODO',
2127
+ name: 'RateLimitExceeded',
2128
+ },
2129
+ {
2130
+ name: 'InvalidDid',
2131
+ },
2132
+ {
2133
+ name: 'InvalidPhone',
2134
+ },
2135
+ {
2136
+ name: 'InternalError',
2026
2137
  },
2027
2138
  ],
2028
2139
  },
@@ -2035,7 +2146,7 @@ export const schemaDict = {
2035
2146
  main: {
2036
2147
  type: 'procedure',
2037
2148
  description:
2038
- "WARNING: This is unstable and under active development, don't use it while this warning is here. Verifies control over a phone number with a code received via SMS and starts a contact import session. Requires authentication.",
2149
+ 'Verifies control over a phone number with a code received via SMS and starts a contact import session. Requires authentication.',
2039
2150
  input: {
2040
2151
  encoding: 'application/json',
2041
2152
  schema: {
@@ -2071,8 +2182,19 @@ export const schemaDict = {
2071
2182
  },
2072
2183
  errors: [
2073
2184
  {
2074
- name: 'TODO',
2075
- description: 'TODO',
2185
+ name: 'RateLimitExceeded',
2186
+ },
2187
+ {
2188
+ name: 'InvalidDid',
2189
+ },
2190
+ {
2191
+ name: 'InvalidPhone',
2192
+ },
2193
+ {
2194
+ name: 'InvalidCode',
2195
+ },
2196
+ {
2197
+ name: 'InternalError',
2076
2198
  },
2077
2199
  ],
2078
2200
  },
@@ -6725,6 +6847,7 @@ export const schemaDict = {
6725
6847
  'like-via-repost',
6726
6848
  'repost-via-repost',
6727
6849
  'subscribed-post',
6850
+ 'contact-match',
6728
6851
  ],
6729
6852
  },
6730
6853
  reasonSubject: {
@@ -19949,6 +20072,7 @@ export const ids = {
19949
20072
  AppBskyContactGetSyncStatus: 'app.bsky.contact.getSyncStatus',
19950
20073
  AppBskyContactImportContacts: 'app.bsky.contact.importContacts',
19951
20074
  AppBskyContactRemoveData: 'app.bsky.contact.removeData',
20075
+ AppBskyContactSendNotification: 'app.bsky.contact.sendNotification',
19952
20076
  AppBskyContactStartPhoneVerification:
19953
20077
  'app.bsky.contact.startPhoneVerification',
19954
20078
  AppBskyContactVerifyPhone: 'app.bsky.contact.verifyPhone',
@@ -259,6 +259,7 @@ export type Preferences = (
259
259
  | $Typed<SavedFeedsPref>
260
260
  | $Typed<SavedFeedsPrefV2>
261
261
  | $Typed<PersonalDetailsPref>
262
+ | $Typed<DeclaredAgePref>
262
263
  | $Typed<FeedViewPref>
263
264
  | $Typed<ThreadViewPref>
264
265
  | $Typed<InterestsPref>
@@ -370,6 +371,27 @@ export function validatePersonalDetailsPref<V>(v: V) {
370
371
  return validate<PersonalDetailsPref & V>(v, id, hashPersonalDetailsPref)
371
372
  }
372
373
 
374
+ /** Read-only preference containing value(s) inferred from the user's declared birthdate. Absence of this preference object in the response indicates that the user has not made a declaration. */
375
+ export interface DeclaredAgePref {
376
+ $type?: 'app.bsky.actor.defs#declaredAgePref'
377
+ /** Indicates if the user has declared that they are over 13 years of age. */
378
+ isOverAge13?: boolean
379
+ /** Indicates if the user has declared that they are over 16 years of age. */
380
+ isOverAge16?: boolean
381
+ /** Indicates if the user has declared that they are over 18 years of age. */
382
+ isOverAge18?: boolean
383
+ }
384
+
385
+ const hashDeclaredAgePref = 'declaredAgePref'
386
+
387
+ export function isDeclaredAgePref<V>(v: V) {
388
+ return is$typed(v, id, hashDeclaredAgePref)
389
+ }
390
+
391
+ export function validateDeclaredAgePref<V>(v: V) {
392
+ return validate<DeclaredAgePref & V>(v, id, hashDeclaredAgePref)
393
+ }
394
+
373
395
  export interface FeedViewPref {
374
396
  $type?: 'app.bsky.actor.defs#feedViewPref'
375
397
  /** The URI of the feed, or an identifier which describes the feed. */
@@ -50,3 +50,22 @@ export function isSyncStatus<V>(v: V) {
50
50
  export function validateSyncStatus<V>(v: V) {
51
51
  return validate<SyncStatus & V>(v, id, hashSyncStatus)
52
52
  }
53
+
54
+ /** A stash object to be sent via bsync representing a notification to be created. */
55
+ export interface Notification {
56
+ $type?: 'app.bsky.contact.defs#notification'
57
+ /** The DID of who this notification comes from. */
58
+ from: string
59
+ /** The DID of who this notification should go to. */
60
+ to: string
61
+ }
62
+
63
+ const hashNotification = 'notification'
64
+
65
+ export function isNotification<V>(v: V) {
66
+ return is$typed(v, id, hashNotification)
67
+ }
68
+
69
+ export function validateNotification<V>(v: V) {
70
+ return validate<Notification & V>(v, id, hashNotification)
71
+ }
@@ -37,7 +37,7 @@ export interface HandlerSuccess {
37
37
  export interface HandlerError {
38
38
  status: number
39
39
  message?: string
40
- error?: 'TODO'
40
+ error?: 'InvalidDid' | 'InternalError'
41
41
  }
42
42
 
43
43
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -37,7 +37,7 @@ export interface HandlerSuccess {
37
37
  export interface HandlerError {
38
38
  status: number
39
39
  message?: string
40
- error?: 'TODO'
40
+ error?: 'InvalidDid' | 'InvalidLimit' | 'InvalidCursor' | 'InternalError'
41
41
  }
42
42
 
43
43
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -33,7 +33,7 @@ export interface HandlerSuccess {
33
33
  export interface HandlerError {
34
34
  status: number
35
35
  message?: string
36
- error?: 'TODO'
36
+ error?: 'InvalidDid' | 'InternalError'
37
37
  }
38
38
 
39
39
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -43,7 +43,12 @@ export interface HandlerSuccess {
43
43
  export interface HandlerError {
44
44
  status: number
45
45
  message?: string
46
- error?: 'TODO'
46
+ error?:
47
+ | 'InvalidDid'
48
+ | 'InvalidContacts'
49
+ | 'TooManyContacts'
50
+ | 'InvalidToken'
51
+ | 'InternalError'
47
52
  }
48
53
 
49
54
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -34,7 +34,7 @@ export interface HandlerSuccess {
34
34
  export interface HandlerError {
35
35
  status: number
36
36
  message?: string
37
- error?: 'TODO'
37
+ error?: 'InvalidDid' | 'InternalError'
38
38
  }
39
39
 
40
40
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -0,0 +1,44 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+
13
+ const is$typed = _is$typed,
14
+ validate = _validate
15
+ const id = 'app.bsky.contact.sendNotification'
16
+
17
+ export type QueryParams = {}
18
+
19
+ export interface InputSchema {
20
+ /** The DID of who this notification comes from. */
21
+ from: string
22
+ /** The DID of who this notification should go to. */
23
+ to: string
24
+ }
25
+
26
+ export interface OutputSchema {}
27
+
28
+ export interface HandlerInput {
29
+ encoding: 'application/json'
30
+ body: InputSchema
31
+ }
32
+
33
+ export interface HandlerSuccess {
34
+ encoding: 'application/json'
35
+ body: OutputSchema
36
+ headers?: { [key: string]: string }
37
+ }
38
+
39
+ export interface HandlerError {
40
+ status: number
41
+ message?: string
42
+ }
43
+
44
+ export type HandlerOutput = HandlerError | HandlerSuccess
@@ -37,7 +37,7 @@ export interface HandlerSuccess {
37
37
  export interface HandlerError {
38
38
  status: number
39
39
  message?: string
40
- error?: 'TODO'
40
+ error?: 'RateLimitExceeded' | 'InvalidDid' | 'InvalidPhone' | 'InternalError'
41
41
  }
42
42
 
43
43
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -42,7 +42,12 @@ export interface HandlerSuccess {
42
42
  export interface HandlerError {
43
43
  status: number
44
44
  message?: string
45
- error?: 'TODO'
45
+ error?:
46
+ | 'RateLimitExceeded'
47
+ | 'InvalidDid'
48
+ | 'InvalidPhone'
49
+ | 'InvalidCode'
50
+ | 'InternalError'
46
51
  }
47
52
 
48
53
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -67,6 +67,7 @@ export interface Notification {
67
67
  | 'like-via-repost'
68
68
  | 'repost-via-repost'
69
69
  | 'subscribed-post'
70
+ | 'contact-match'
70
71
  | (string & {})
71
72
  reasonSubject?: string
72
73
  record: { [_ in string]: unknown }
@@ -799,6 +799,18 @@ export class ModerationService {
799
799
  takedownRef,
800
800
  }))
801
801
 
802
+ // The label is consumed by appview if we opt for appview only takedown, this is needed
803
+ // if we opt for pds level takedown, adding the label doesn't hurt
804
+ const takedownLabel = isSuspend ? SUSPEND_LABEL : TAKEDOWN_LABEL
805
+ await this.formatAndCreateLabels(subject.did, null, {
806
+ create: [takedownLabel],
807
+ })
808
+
809
+ // If we dont have to push any events, return early
810
+ if (!values.length) {
811
+ return
812
+ }
813
+
802
814
  const repoEvts = await this.db.db
803
815
  .insertInto('repo_push_event')
804
816
  .values(values)
@@ -813,11 +825,6 @@ export class ModerationService {
813
825
  .returning('id')
814
826
  .execute()
815
827
 
816
- const takedownLabel = isSuspend ? SUSPEND_LABEL : TAKEDOWN_LABEL
817
- await this.formatAndCreateLabels(subject.did, null, {
818
- create: [takedownLabel],
819
- })
820
-
821
828
  this.db.onCommit(() => {
822
829
  this.backgroundQueue.add(async () => {
823
830
  await Promise.all(