@atproto/ozone 0.1.6 → 0.1.8

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 (77) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/communication/createTemplate.js +2 -2
  3. package/dist/api/communication/createTemplate.js.map +1 -1
  4. package/dist/api/communication/deleteTemplate.js +2 -2
  5. package/dist/api/communication/deleteTemplate.js.map +1 -1
  6. package/dist/api/communication/updateTemplate.js +2 -2
  7. package/dist/api/communication/updateTemplate.js.map +1 -1
  8. package/dist/api/proxied.d.ts.map +1 -1
  9. package/dist/api/proxied.js +10 -0
  10. package/dist/api/proxied.js.map +1 -1
  11. package/dist/auth-verifier.d.ts.map +1 -1
  12. package/dist/db/pagination.d.ts +5 -5
  13. package/dist/db/pagination.d.ts.map +1 -1
  14. package/dist/db/types.d.ts.map +1 -1
  15. package/dist/lexicon/index.d.ts +18 -0
  16. package/dist/lexicon/index.d.ts.map +1 -1
  17. package/dist/lexicon/index.js +23 -1
  18. package/dist/lexicon/index.js.map +1 -1
  19. package/dist/lexicon/lexicons.d.ts +291 -0
  20. package/dist/lexicon/lexicons.d.ts.map +1 -1
  21. package/dist/lexicon/lexicons.js +307 -0
  22. package/dist/lexicon/lexicons.js.map +1 -1
  23. package/dist/lexicon/types/app/bsky/embed/record.d.ts +3 -0
  24. package/dist/lexicon/types/app/bsky/embed/record.d.ts.map +1 -1
  25. package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
  26. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +38 -0
  27. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  28. package/dist/lexicon/types/app/bsky/feed/defs.js +35 -1
  29. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  30. package/dist/lexicon/types/app/bsky/feed/generator.d.ts +2 -0
  31. package/dist/lexicon/types/app/bsky/feed/generator.d.ts.map +1 -1
  32. package/dist/lexicon/types/app/bsky/feed/generator.js.map +1 -1
  33. package/dist/lexicon/types/app/bsky/feed/searchPosts.d.ts +18 -0
  34. package/dist/lexicon/types/app/bsky/feed/searchPosts.d.ts.map +1 -1
  35. package/dist/lexicon/types/app/bsky/feed/sendInteractions.d.ts +40 -0
  36. package/dist/lexicon/types/app/bsky/feed/sendInteractions.d.ts.map +1 -0
  37. package/dist/lexicon/types/app/bsky/feed/sendInteractions.js +3 -0
  38. package/dist/lexicon/types/app/bsky/feed/sendInteractions.js.map +1 -0
  39. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +40 -0
  40. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -0
  41. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.js +3 -0
  42. package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.js.map +1 -0
  43. package/dist/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.d.ts +2 -0
  44. package/dist/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.d.ts.map +1 -1
  45. package/dist/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.d.ts +20 -0
  46. package/dist/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.d.ts.map +1 -1
  47. package/dist/lexicon/types/com/atproto/server/createSession.d.ts +3 -1
  48. package/dist/lexicon/types/com/atproto/server/createSession.d.ts.map +1 -1
  49. package/dist/lexicon/types/com/atproto/server/getSession.d.ts +1 -0
  50. package/dist/lexicon/types/com/atproto/server/getSession.d.ts.map +1 -1
  51. package/dist/lexicon/types/com/atproto/server/updateEmail.d.ts +1 -0
  52. package/dist/lexicon/types/com/atproto/server/updateEmail.d.ts.map +1 -1
  53. package/dist/mod-service/index.d.ts.map +1 -1
  54. package/dist/mod-service/index.js +2 -2
  55. package/dist/mod-service/index.js.map +1 -1
  56. package/package.json +3 -3
  57. package/src/api/communication/createTemplate.ts +2 -2
  58. package/src/api/communication/deleteTemplate.ts +2 -2
  59. package/src/api/communication/updateTemplate.ts +2 -2
  60. package/src/api/proxied.ts +14 -0
  61. package/src/lexicon/index.ts +38 -0
  62. package/src/lexicon/lexicons.ts +336 -0
  63. package/src/lexicon/types/app/bsky/embed/record.ts +3 -0
  64. package/src/lexicon/types/app/bsky/feed/defs.ts +63 -0
  65. package/src/lexicon/types/app/bsky/feed/generator.ts +2 -0
  66. package/src/lexicon/types/app/bsky/feed/searchPosts.ts +18 -0
  67. package/src/lexicon/types/app/bsky/feed/sendInteractions.ts +49 -0
  68. package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +50 -0
  69. package/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +2 -0
  70. package/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +20 -0
  71. package/src/lexicon/types/com/atproto/server/createSession.ts +3 -1
  72. package/src/lexicon/types/com/atproto/server/getSession.ts +1 -0
  73. package/src/lexicon/types/com/atproto/server/updateEmail.ts +1 -0
  74. package/src/mod-service/index.ts +6 -5
  75. package/tests/communication-templates.test.ts +5 -5
  76. package/tests/moderation-statuses.test.ts +27 -0
  77. package/tests/repo-search.test.ts +1 -1
@@ -12,6 +12,8 @@ import * as AppBskyUnspeccedDefs from './defs'
12
12
  export interface QueryParams {
13
13
  /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */
14
14
  q: string
15
+ /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */
16
+ viewer?: string
15
17
  /** If true, acts as fast/simple 'typeahead' query. */
16
18
  typeahead?: boolean
17
19
  limit: number
@@ -12,6 +12,26 @@ import * as AppBskyUnspeccedDefs from './defs'
12
12
  export interface QueryParams {
13
13
  /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
14
14
  q: string
15
+ /** Specifies the ranking order of results. */
16
+ sort: 'top' | 'latest' | (string & {})
17
+ /** Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). */
18
+ since?: string
19
+ /** Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). */
20
+ until?: string
21
+ /** Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. */
22
+ mentions?: string
23
+ /** Filter to posts by the given account. Handles are resolved to DID before query-time. */
24
+ author?: string
25
+ /** Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. */
26
+ lang?: string
27
+ /** Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. */
28
+ domain?: string
29
+ /** Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. */
30
+ url?: string
31
+ /** Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. */
32
+ tag?: string[]
33
+ /** DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. */
34
+ viewer?: string
15
35
  limit: number
16
36
  /** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
17
37
  cursor?: string
@@ -14,6 +14,7 @@ export interface InputSchema {
14
14
  /** Handle or other identifier supported by the server for the authenticating user. */
15
15
  identifier: string
16
16
  password: string
17
+ authFactorToken?: string
17
18
  [k: string]: unknown
18
19
  }
19
20
 
@@ -25,6 +26,7 @@ export interface OutputSchema {
25
26
  didDoc?: {}
26
27
  email?: string
27
28
  emailConfirmed?: boolean
29
+ emailAuthFactor?: boolean
28
30
  [k: string]: unknown
29
31
  }
30
32
 
@@ -42,7 +44,7 @@ export interface HandlerSuccess {
42
44
  export interface HandlerError {
43
45
  status: number
44
46
  message?: string
45
- error?: 'AccountTakedown'
47
+ error?: 'AccountTakedown' | 'AuthFactorTokenRequired'
46
48
  }
47
49
 
48
50
  export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
@@ -17,6 +17,7 @@ export interface OutputSchema {
17
17
  did: string
18
18
  email?: string
19
19
  emailConfirmed?: boolean
20
+ emailAuthFactor?: boolean
20
21
  didDoc?: {}
21
22
  [k: string]: unknown
22
23
  }
@@ -12,6 +12,7 @@ export interface QueryParams {}
12
12
 
13
13
  export interface InputSchema {
14
14
  email: string
15
+ emailAuthFactor?: boolean
15
16
  /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */
16
17
  token?: string
17
18
  [k: string]: unknown
@@ -759,7 +759,9 @@ export class ModerationService {
759
759
 
760
760
  if (tags.length) {
761
761
  builder = builder.where(
762
- sql`${ref('moderation_subject_status.tags')} @> ${jsonb(tags)}`,
762
+ sql`${ref('moderation_subject_status.tags')} ?| array[${sql.join(
763
+ tags,
764
+ )}]::TEXT[]`,
763
765
  )
764
766
  }
765
767
 
@@ -767,9 +769,9 @@ export class ModerationService {
767
769
  builder = builder.where((qb) =>
768
770
  qb
769
771
  .where(
770
- sql`NOT(${ref('moderation_subject_status.tags')} @> ${jsonb(
771
- excludeTags,
772
- )})`,
772
+ sql`NOT(${ref(
773
+ 'moderation_subject_status.tags',
774
+ )} ?| array[${sql.join(excludeTags)}]::TEXT[])`,
773
775
  )
774
776
  .orWhere('tags', 'is', null),
775
777
  )
@@ -787,7 +789,6 @@ export class ModerationService {
787
789
  tryIndex: true,
788
790
  nullsLast: true,
789
791
  })
790
-
791
792
  const results = await paginatedBuilder.execute()
792
793
 
793
794
  const infos = await this.views.getAccoutInfosByDid(
@@ -42,11 +42,11 @@ describe('communication-templates', () => {
42
42
  { ...templateOne, createdBy: sc.dids.bob },
43
43
  {
44
44
  encoding: 'application/json',
45
- headers: await network.ozone.modHeaders('moderator'),
45
+ headers: await network.ozone.modHeaders('triage'),
46
46
  },
47
47
  )
48
48
  await expect(moderatorReq).rejects.toThrow(
49
- 'Must be an admin to create a communication template',
49
+ 'Must be a moderator to create a communication template',
50
50
  )
51
51
  const modReq = await agent.api.tools.ozone.communication.createTemplate(
52
52
  { ...templateOne, createdBy: sc.dids.bob },
@@ -105,19 +105,19 @@ describe('communication-templates', () => {
105
105
  { id: '1' },
106
106
  {
107
107
  encoding: 'application/json',
108
- headers: await network.ozone.modHeaders('moderator'),
108
+ headers: await network.ozone.modHeaders('triage'),
109
109
  },
110
110
  )
111
111
 
112
112
  await expect(modReq).rejects.toThrow(
113
- 'Must be an admin to delete a communication template',
113
+ 'Must be a moderator to delete a communication template',
114
114
  )
115
115
 
116
116
  await agent.api.tools.ozone.communication.deleteTemplate(
117
117
  { id: '1' },
118
118
  {
119
119
  encoding: 'application/json',
120
- headers: await network.ozone.modHeaders('admin'),
120
+ headers: await network.ozone.modHeaders('moderator'),
121
121
  },
122
122
  )
123
123
  const list = await listTemplates()
@@ -99,6 +99,33 @@ describe('moderation-statuses', () => {
99
99
  expect(nonKlingonQueue.subjectStatuses.map((s) => s.id)).not.toContain(
100
100
  klingonQueue.subjectStatuses[0].id,
101
101
  )
102
+
103
+ // Verify multi lang tag exclusion
104
+ Promise.all(
105
+ nonKlingonQueue.subjectStatuses.map((s, i) => {
106
+ return modClient.emitEvent({
107
+ subject: s.subject,
108
+ event: {
109
+ $type: 'tools.ozone.moderation.defs#modEventTag',
110
+ add: [i % 2 ? 'lang:jp' : 'lang:it'],
111
+ remove: [],
112
+ comment: 'Adding custom lang tag',
113
+ },
114
+ createdBy: sc.dids.alice,
115
+ })
116
+ }),
117
+ )
118
+
119
+ const queueWithoutKlingonAndItalian = await modClient.queryStatuses({
120
+ excludeTags: ['lang:i', 'lang:it'],
121
+ })
122
+
123
+ queueWithoutKlingonAndItalian.subjectStatuses
124
+ .map((s) => s.tags)
125
+ .flat()
126
+ .forEach((tag) => {
127
+ expect(['lang:it', 'lang:i']).not.toContain(tag)
128
+ })
102
129
  })
103
130
 
104
131
  it('returns paginated statuses', async () => {
@@ -52,7 +52,7 @@ describe('admin repo search view', () => {
52
52
  const shouldContain = [
53
53
  'cara-wiegand69.test', // Present despite repo takedown
54
54
  'carlos6.test',
55
- 'carolina-mcdermott77.test',
55
+ 'carolina-mcderm77.test',
56
56
  ]
57
57
 
58
58
  shouldContain.forEach((handle) => expect(handles).toContain(handle))