@atproto/ozone 0.1.113 → 0.1.115

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 (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/moderation/getRecord.d.ts.map +1 -1
  3. package/dist/api/moderation/getRecord.js +1 -1
  4. package/dist/api/moderation/getRecord.js.map +1 -1
  5. package/dist/lexicon/lexicons.d.ts +116 -124
  6. package/dist/lexicon/lexicons.d.ts.map +1 -1
  7. package/dist/lexicon/lexicons.js +68 -66
  8. package/dist/lexicon/lexicons.js.map +1 -1
  9. package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts +33 -0
  10. package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts.map +1 -1
  11. package/dist/lexicon/types/app/bsky/unspecced/defs.js +36 -0
  12. package/dist/lexicon/types/app/bsky/unspecced/defs.js.map +1 -1
  13. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +5 -13
  14. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -1
  15. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js +0 -9
  16. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -1
  17. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts +2 -29
  18. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -1
  19. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js +0 -36
  20. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js.map +1 -1
  21. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +1 -1
  22. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
  23. package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
  24. package/dist/mod-service/index.d.ts.map +1 -1
  25. package/dist/mod-service/index.js +5 -21
  26. package/dist/mod-service/index.js.map +1 -1
  27. package/dist/mod-service/util.d.ts +10 -0
  28. package/dist/mod-service/util.d.ts.map +1 -1
  29. package/dist/mod-service/util.js +25 -1
  30. package/dist/mod-service/util.js.map +1 -1
  31. package/dist/mod-service/views.d.ts +6 -2
  32. package/dist/mod-service/views.d.ts.map +1 -1
  33. package/dist/mod-service/views.js +46 -15
  34. package/dist/mod-service/views.js.map +1 -1
  35. package/package.json +4 -4
  36. package/src/api/moderation/getRecord.ts +4 -1
  37. package/src/lexicon/lexicons.ts +74 -71
  38. package/src/lexicon/types/app/bsky/unspecced/defs.ts +73 -0
  39. package/src/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.ts +5 -22
  40. package/src/lexicon/types/app/bsky/unspecced/getPostThreadV2.ts +5 -72
  41. package/src/lexicon/types/tools/ozone/moderation/defs.ts +1 -0
  42. package/src/mod-service/index.ts +17 -15
  43. package/src/mod-service/util.ts +24 -0
  44. package/src/mod-service/views.ts +52 -17
  45. package/tests/__snapshots__/get-record.test.ts.snap +26 -0
  46. package/tests/get-record.test.ts +16 -6
@@ -75,7 +75,7 @@ describe('admin get record view', () => {
75
75
  })
76
76
 
77
77
  it('gets a record by uri, even when taken down.', async () => {
78
- const result = await agent.api.tools.ozone.moderation.getRecord(
78
+ const result = await agent.tools.ozone.moderation.getRecord(
79
79
  { uri: sc.posts[sc.dids.alice][0].ref.uriStr },
80
80
  { headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecord) },
81
81
  )
@@ -83,7 +83,7 @@ describe('admin get record view', () => {
83
83
  })
84
84
 
85
85
  it('gets a record by uri and cid.', async () => {
86
- const result = await agent.api.tools.ozone.moderation.getRecord(
86
+ const result = await agent.tools.ozone.moderation.getRecord(
87
87
  {
88
88
  uri: sc.posts[sc.dids.alice][0].ref.uriStr,
89
89
  cid: sc.posts[sc.dids.alice][0].ref.cidStr,
@@ -94,7 +94,7 @@ describe('admin get record view', () => {
94
94
  })
95
95
 
96
96
  it('fails when record does not exist.', async () => {
97
- const promise = agent.api.tools.ozone.moderation.getRecord(
97
+ const promise = agent.tools.ozone.moderation.getRecord(
98
98
  {
99
99
  uri: AtUri.make(
100
100
  sc.dids.alice,
@@ -104,17 +104,27 @@ describe('admin get record view', () => {
104
104
  },
105
105
  { headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecord) },
106
106
  )
107
- await expect(promise).rejects.toThrow('Record not found')
107
+ await expect(promise).rejects.toThrow('Could not locate record')
108
108
  })
109
109
 
110
110
  it('fails when record cid does not exist.', async () => {
111
- const promise = agent.api.tools.ozone.moderation.getRecord(
111
+ const promise = agent.tools.ozone.moderation.getRecord(
112
112
  {
113
113
  uri: sc.posts[sc.dids.alice][0].ref.uriStr,
114
114
  cid: sc.posts[sc.dids.alice][1].ref.cidStr, // Mismatching cid
115
115
  },
116
116
  { headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecord) },
117
117
  )
118
- await expect(promise).rejects.toThrow('Record not found')
118
+ await expect(promise).rejects.toThrow('Could not locate record')
119
+ })
120
+
121
+ it('gets record from pds if appview does not have it.', async () => {
122
+ const post = await sc.post(sc.dids.carol, 'this is test')
123
+ const { data: postFromOzone } =
124
+ await agent.tools.ozone.moderation.getRecord(
125
+ { uri: post.ref.uriStr },
126
+ { headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecord) },
127
+ )
128
+ expect(forSnapshot(postFromOzone)).toMatchSnapshot()
119
129
  })
120
130
  })