@atproto/bsky 0.0.197 → 0.0.198
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.
- package/CHANGELOG.md +16 -0
- package/dist/lexicon/index.d.ts +11 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +32 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +700 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +367 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/ageassurance/begin.d.ts +31 -0
- package/dist/lexicon/types/app/bsky/ageassurance/begin.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/begin.js +7 -0
- package/dist/lexicon/types/app/bsky/ageassurance/begin.js.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts +138 -0
- package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/defs.js +115 -0
- package/dist/lexicon/types/app/bsky/ageassurance/defs.js.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getConfig.d.ts +18 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getConfig.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getConfig.js +7 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getConfig.js.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getState.d.ts +24 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getState.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getState.js +7 -0
- package/dist/lexicon/types/app/bsky/ageassurance/getState.js.map +1 -0
- package/dist/stash.d.ts.map +1 -1
- package/dist/stash.js +1 -0
- package/dist/stash.js.map +1 -1
- package/package.json +14 -14
- package/src/lexicon/index.ts +49 -0
- package/src/lexicon/lexicons.ts +392 -0
- package/src/lexicon/types/app/bsky/ageassurance/begin.ts +54 -0
- package/src/lexicon/types/app/bsky/ageassurance/defs.ts +301 -0
- package/src/lexicon/types/app/bsky/ageassurance/getConfig.ts +34 -0
- package/src/lexicon/types/app/bsky/ageassurance/getState.ts +42 -0
- package/src/stash.ts +2 -0
- package/tests/blob-resolver.test.ts +2 -0
- package/tests/data-plane/duplicate-records.test.ts +2 -0
- package/tests/data-plane/indexing.test.ts +2 -0
- package/tests/data-plane/subscription.test.ts +2 -0
- package/tests/image/server.test.ts +2 -0
- package/tests/image/uri.test.ts +2 -0
- package/tests/views/posts.test.ts +96 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
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.ageassurance.defs'
|
|
16
|
+
|
|
17
|
+
/** The access level granted based on Age Assurance data we've processed. */
|
|
18
|
+
export type Access = 'unknown' | 'none' | 'safe' | 'full' | (string & {})
|
|
19
|
+
/** The status of the Age Assurance process. */
|
|
20
|
+
export type Status =
|
|
21
|
+
| 'unknown'
|
|
22
|
+
| 'pending'
|
|
23
|
+
| 'assured'
|
|
24
|
+
| 'blocked'
|
|
25
|
+
| (string & {})
|
|
26
|
+
|
|
27
|
+
/** The user's computed Age Assurance state. */
|
|
28
|
+
export interface State {
|
|
29
|
+
$type?: 'app.bsky.ageassurance.defs#state'
|
|
30
|
+
/** The timestamp when this state was last updated. */
|
|
31
|
+
lastInitiatedAt?: string
|
|
32
|
+
status: Status
|
|
33
|
+
access: Access
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const hashState = 'state'
|
|
37
|
+
|
|
38
|
+
export function isState<V>(v: V) {
|
|
39
|
+
return is$typed(v, id, hashState)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function validateState<V>(v: V) {
|
|
43
|
+
return validate<State & V>(v, id, hashState)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Additional metadata needed to compute Age Assurance state client-side. */
|
|
47
|
+
export interface StateMetadata {
|
|
48
|
+
$type?: 'app.bsky.ageassurance.defs#stateMetadata'
|
|
49
|
+
/** The account creation timestamp. */
|
|
50
|
+
accountCreatedAt?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const hashStateMetadata = 'stateMetadata'
|
|
54
|
+
|
|
55
|
+
export function isStateMetadata<V>(v: V) {
|
|
56
|
+
return is$typed(v, id, hashStateMetadata)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function validateStateMetadata<V>(v: V) {
|
|
60
|
+
return validate<StateMetadata & V>(v, id, hashStateMetadata)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface Config {
|
|
64
|
+
$type?: 'app.bsky.ageassurance.defs#config'
|
|
65
|
+
/** The per-region Age Assurance configuration. */
|
|
66
|
+
regions: ConfigRegion[]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const hashConfig = 'config'
|
|
70
|
+
|
|
71
|
+
export function isConfig<V>(v: V) {
|
|
72
|
+
return is$typed(v, id, hashConfig)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function validateConfig<V>(v: V) {
|
|
76
|
+
return validate<Config & V>(v, id, hashConfig)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The Age Assurance configuration for a specific region. */
|
|
80
|
+
export interface ConfigRegion {
|
|
81
|
+
$type?: 'app.bsky.ageassurance.defs#configRegion'
|
|
82
|
+
/** The ISO 3166-1 alpha-2 country code this configuration applies to. */
|
|
83
|
+
countryCode: string
|
|
84
|
+
/** The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. */
|
|
85
|
+
regionCode?: string
|
|
86
|
+
/** The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item. */
|
|
87
|
+
rules: (
|
|
88
|
+
| $Typed<ConfigRegionRuleDefault>
|
|
89
|
+
| $Typed<ConfigRegionRuleIfDeclaredOverAge>
|
|
90
|
+
| $Typed<ConfigRegionRuleIfDeclaredUnderAge>
|
|
91
|
+
| $Typed<ConfigRegionRuleIfAssuredOverAge>
|
|
92
|
+
| $Typed<ConfigRegionRuleIfAssuredUnderAge>
|
|
93
|
+
| $Typed<ConfigRegionRuleIfAccountNewerThan>
|
|
94
|
+
| $Typed<ConfigRegionRuleIfAccountOlderThan>
|
|
95
|
+
| { $type: string }
|
|
96
|
+
)[]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const hashConfigRegion = 'configRegion'
|
|
100
|
+
|
|
101
|
+
export function isConfigRegion<V>(v: V) {
|
|
102
|
+
return is$typed(v, id, hashConfigRegion)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function validateConfigRegion<V>(v: V) {
|
|
106
|
+
return validate<ConfigRegion & V>(v, id, hashConfigRegion)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Age Assurance rule that applies by default. */
|
|
110
|
+
export interface ConfigRegionRuleDefault {
|
|
111
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleDefault'
|
|
112
|
+
access: Access
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const hashConfigRegionRuleDefault = 'configRegionRuleDefault'
|
|
116
|
+
|
|
117
|
+
export function isConfigRegionRuleDefault<V>(v: V) {
|
|
118
|
+
return is$typed(v, id, hashConfigRegionRuleDefault)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function validateConfigRegionRuleDefault<V>(v: V) {
|
|
122
|
+
return validate<ConfigRegionRuleDefault & V>(
|
|
123
|
+
v,
|
|
124
|
+
id,
|
|
125
|
+
hashConfigRegionRuleDefault,
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age. */
|
|
130
|
+
export interface ConfigRegionRuleIfDeclaredOverAge {
|
|
131
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge'
|
|
132
|
+
/** The age threshold as a whole integer. */
|
|
133
|
+
age: number
|
|
134
|
+
access: Access
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const hashConfigRegionRuleIfDeclaredOverAge =
|
|
138
|
+
'configRegionRuleIfDeclaredOverAge'
|
|
139
|
+
|
|
140
|
+
export function isConfigRegionRuleIfDeclaredOverAge<V>(v: V) {
|
|
141
|
+
return is$typed(v, id, hashConfigRegionRuleIfDeclaredOverAge)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function validateConfigRegionRuleIfDeclaredOverAge<V>(v: V) {
|
|
145
|
+
return validate<ConfigRegionRuleIfDeclaredOverAge & V>(
|
|
146
|
+
v,
|
|
147
|
+
id,
|
|
148
|
+
hashConfigRegionRuleIfDeclaredOverAge,
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Age Assurance rule that applies if the user has declared themselves under a certain age. */
|
|
153
|
+
export interface ConfigRegionRuleIfDeclaredUnderAge {
|
|
154
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge'
|
|
155
|
+
/** The age threshold as a whole integer. */
|
|
156
|
+
age: number
|
|
157
|
+
access: Access
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const hashConfigRegionRuleIfDeclaredUnderAge =
|
|
161
|
+
'configRegionRuleIfDeclaredUnderAge'
|
|
162
|
+
|
|
163
|
+
export function isConfigRegionRuleIfDeclaredUnderAge<V>(v: V) {
|
|
164
|
+
return is$typed(v, id, hashConfigRegionRuleIfDeclaredUnderAge)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function validateConfigRegionRuleIfDeclaredUnderAge<V>(v: V) {
|
|
168
|
+
return validate<ConfigRegionRuleIfDeclaredUnderAge & V>(
|
|
169
|
+
v,
|
|
170
|
+
id,
|
|
171
|
+
hashConfigRegionRuleIfDeclaredUnderAge,
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age. */
|
|
176
|
+
export interface ConfigRegionRuleIfAssuredOverAge {
|
|
177
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge'
|
|
178
|
+
/** The age threshold as a whole integer. */
|
|
179
|
+
age: number
|
|
180
|
+
access: Access
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const hashConfigRegionRuleIfAssuredOverAge = 'configRegionRuleIfAssuredOverAge'
|
|
184
|
+
|
|
185
|
+
export function isConfigRegionRuleIfAssuredOverAge<V>(v: V) {
|
|
186
|
+
return is$typed(v, id, hashConfigRegionRuleIfAssuredOverAge)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function validateConfigRegionRuleIfAssuredOverAge<V>(v: V) {
|
|
190
|
+
return validate<ConfigRegionRuleIfAssuredOverAge & V>(
|
|
191
|
+
v,
|
|
192
|
+
id,
|
|
193
|
+
hashConfigRegionRuleIfAssuredOverAge,
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Age Assurance rule that applies if the user has been assured to be under a certain age. */
|
|
198
|
+
export interface ConfigRegionRuleIfAssuredUnderAge {
|
|
199
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge'
|
|
200
|
+
/** The age threshold as a whole integer. */
|
|
201
|
+
age: number
|
|
202
|
+
access: Access
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const hashConfigRegionRuleIfAssuredUnderAge =
|
|
206
|
+
'configRegionRuleIfAssuredUnderAge'
|
|
207
|
+
|
|
208
|
+
export function isConfigRegionRuleIfAssuredUnderAge<V>(v: V) {
|
|
209
|
+
return is$typed(v, id, hashConfigRegionRuleIfAssuredUnderAge)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function validateConfigRegionRuleIfAssuredUnderAge<V>(v: V) {
|
|
213
|
+
return validate<ConfigRegionRuleIfAssuredUnderAge & V>(
|
|
214
|
+
v,
|
|
215
|
+
id,
|
|
216
|
+
hashConfigRegionRuleIfAssuredUnderAge,
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Age Assurance rule that applies if the account is equal-to or newer than a certain date. */
|
|
221
|
+
export interface ConfigRegionRuleIfAccountNewerThan {
|
|
222
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan'
|
|
223
|
+
/** The date threshold as a datetime string. */
|
|
224
|
+
date: string
|
|
225
|
+
access: Access
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const hashConfigRegionRuleIfAccountNewerThan =
|
|
229
|
+
'configRegionRuleIfAccountNewerThan'
|
|
230
|
+
|
|
231
|
+
export function isConfigRegionRuleIfAccountNewerThan<V>(v: V) {
|
|
232
|
+
return is$typed(v, id, hashConfigRegionRuleIfAccountNewerThan)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function validateConfigRegionRuleIfAccountNewerThan<V>(v: V) {
|
|
236
|
+
return validate<ConfigRegionRuleIfAccountNewerThan & V>(
|
|
237
|
+
v,
|
|
238
|
+
id,
|
|
239
|
+
hashConfigRegionRuleIfAccountNewerThan,
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Age Assurance rule that applies if the account is older than a certain date. */
|
|
244
|
+
export interface ConfigRegionRuleIfAccountOlderThan {
|
|
245
|
+
$type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan'
|
|
246
|
+
/** The date threshold as a datetime string. */
|
|
247
|
+
date: string
|
|
248
|
+
access: Access
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const hashConfigRegionRuleIfAccountOlderThan =
|
|
252
|
+
'configRegionRuleIfAccountOlderThan'
|
|
253
|
+
|
|
254
|
+
export function isConfigRegionRuleIfAccountOlderThan<V>(v: V) {
|
|
255
|
+
return is$typed(v, id, hashConfigRegionRuleIfAccountOlderThan)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function validateConfigRegionRuleIfAccountOlderThan<V>(v: V) {
|
|
259
|
+
return validate<ConfigRegionRuleIfAccountOlderThan & V>(
|
|
260
|
+
v,
|
|
261
|
+
id,
|
|
262
|
+
hashConfigRegionRuleIfAccountOlderThan,
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Object used to store Age Assurance data in stash. */
|
|
267
|
+
export interface Event {
|
|
268
|
+
$type?: 'app.bsky.ageassurance.defs#event'
|
|
269
|
+
/** The date and time of this write operation. */
|
|
270
|
+
createdAt: string
|
|
271
|
+
/** The unique identifier for this instance of the Age Assurance flow, in UUID format. */
|
|
272
|
+
attemptId: string
|
|
273
|
+
/** The status of the Age Assurance process. */
|
|
274
|
+
status: 'unknown' | 'pending' | 'assured' | 'blocked' | (string & {})
|
|
275
|
+
/** The access level granted based on Age Assurance data we've processed. */
|
|
276
|
+
access: 'unknown' | 'none' | 'safe' | 'full' | (string & {})
|
|
277
|
+
/** The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. */
|
|
278
|
+
countryCode: string
|
|
279
|
+
/** The ISO 3166-2 region code provided when beginning the Age Assurance flow. */
|
|
280
|
+
regionCode?: string
|
|
281
|
+
/** The email used for Age Assurance. */
|
|
282
|
+
email?: string
|
|
283
|
+
/** The IP address used when initiating the Age Assurance flow. */
|
|
284
|
+
initIp?: string
|
|
285
|
+
/** The user agent used when initiating the Age Assurance flow. */
|
|
286
|
+
initUa?: string
|
|
287
|
+
/** The IP address used when completing the Age Assurance flow. */
|
|
288
|
+
completeIp?: string
|
|
289
|
+
/** The user agent used when completing the Age Assurance flow. */
|
|
290
|
+
completeUa?: string
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const hashEvent = 'event'
|
|
294
|
+
|
|
295
|
+
export function isEvent<V>(v: V) {
|
|
296
|
+
return is$typed(v, id, hashEvent)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function validateEvent<V>(v: V) {
|
|
300
|
+
return validate<Event & V>(v, id, hashEvent)
|
|
301
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import type * as AppBskyAgeassuranceDefs from './defs.js'
|
|
13
|
+
|
|
14
|
+
const is$typed = _is$typed,
|
|
15
|
+
validate = _validate
|
|
16
|
+
const id = 'app.bsky.ageassurance.getConfig'
|
|
17
|
+
|
|
18
|
+
export type QueryParams = {}
|
|
19
|
+
export type InputSchema = undefined
|
|
20
|
+
export type OutputSchema = AppBskyAgeassuranceDefs.Config
|
|
21
|
+
export type HandlerInput = void
|
|
22
|
+
|
|
23
|
+
export interface HandlerSuccess {
|
|
24
|
+
encoding: 'application/json'
|
|
25
|
+
body: OutputSchema
|
|
26
|
+
headers?: { [key: string]: string }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface HandlerError {
|
|
30
|
+
status: number
|
|
31
|
+
message?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import type * as AppBskyAgeassuranceDefs from './defs.js'
|
|
13
|
+
|
|
14
|
+
const is$typed = _is$typed,
|
|
15
|
+
validate = _validate
|
|
16
|
+
const id = 'app.bsky.ageassurance.getState'
|
|
17
|
+
|
|
18
|
+
export type QueryParams = {
|
|
19
|
+
countryCode: string
|
|
20
|
+
regionCode?: string
|
|
21
|
+
}
|
|
22
|
+
export type InputSchema = undefined
|
|
23
|
+
|
|
24
|
+
export interface OutputSchema {
|
|
25
|
+
state: AppBskyAgeassuranceDefs.State
|
|
26
|
+
metadata: AppBskyAgeassuranceDefs.StateMetadata
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type HandlerInput = void
|
|
30
|
+
|
|
31
|
+
export interface HandlerSuccess {
|
|
32
|
+
encoding: 'application/json'
|
|
33
|
+
body: OutputSchema
|
|
34
|
+
headers?: { [key: string]: string }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface HandlerError {
|
|
38
|
+
status: number
|
|
39
|
+
message?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
package/src/stash.ts
CHANGED
package/tests/image/uri.test.ts
CHANGED
|
@@ -19,7 +19,30 @@ describe('pds posts views', () => {
|
|
|
19
19
|
pdsAgent = network.pds.getClient()
|
|
20
20
|
sc = network.getSeedClient()
|
|
21
21
|
await basicSeed(sc)
|
|
22
|
+
|
|
23
|
+
await sc.createAccount('eve', {
|
|
24
|
+
handle: 'eve.test',
|
|
25
|
+
email: 'eve@eve.com',
|
|
26
|
+
password: 'hunter2',
|
|
27
|
+
})
|
|
28
|
+
await sc.post(sc.dids.eve, 'post will go down')
|
|
29
|
+
|
|
30
|
+
await sc.createAccount('frankie', {
|
|
31
|
+
handle: 'frankie.test',
|
|
32
|
+
email: 'frankie@frankie.com',
|
|
33
|
+
password: 'hunter2',
|
|
34
|
+
})
|
|
35
|
+
await sc.post(sc.dids.frankie, 'account will go down')
|
|
36
|
+
|
|
22
37
|
await network.processAll()
|
|
38
|
+
|
|
39
|
+
await network.bsky.ctx.dataplane.takedownRecord({
|
|
40
|
+
recordUri: sc.posts[sc.dids.eve][0].ref.uriStr,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
await network.bsky.ctx.dataplane.takedownActor({
|
|
44
|
+
did: sc.dids.frankie,
|
|
45
|
+
})
|
|
23
46
|
})
|
|
24
47
|
|
|
25
48
|
afterAll(async () => {
|
|
@@ -49,6 +72,79 @@ describe('pds posts views', () => {
|
|
|
49
72
|
expect(forSnapshot(posts.data.posts)).toMatchSnapshot()
|
|
50
73
|
})
|
|
51
74
|
|
|
75
|
+
it(`omits not-found posts`, async () => {
|
|
76
|
+
// This is a valid post AT-URI (from a prod post), but it shouldn't exist in the test env.
|
|
77
|
+
const badPostUri =
|
|
78
|
+
'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3m5yqexldn22q'
|
|
79
|
+
|
|
80
|
+
const uris = [
|
|
81
|
+
sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
82
|
+
sc.posts[sc.dids.alice][1].ref.uriStr,
|
|
83
|
+
sc.posts[sc.dids.bob][0].ref.uriStr,
|
|
84
|
+
badPostUri,
|
|
85
|
+
]
|
|
86
|
+
const posts = await agent.app.bsky.feed.getPosts(
|
|
87
|
+
{ uris },
|
|
88
|
+
{
|
|
89
|
+
headers: await network.serviceHeaders(
|
|
90
|
+
sc.dids.alice,
|
|
91
|
+
ids.AppBskyFeedGetPosts,
|
|
92
|
+
),
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
expect(posts.data.posts.length).toBe(uris.length - 1)
|
|
97
|
+
expect(posts.data.posts.map((p) => p.uri).includes(badPostUri)).toBe(false)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it(`omits taken-down posts`, async () => {
|
|
101
|
+
// Taken-down post.
|
|
102
|
+
const badPostUri = sc.posts[sc.dids.eve][0].ref.uriStr
|
|
103
|
+
|
|
104
|
+
const uris = [
|
|
105
|
+
sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
106
|
+
sc.posts[sc.dids.alice][1].ref.uriStr,
|
|
107
|
+
sc.posts[sc.dids.bob][0].ref.uriStr,
|
|
108
|
+
badPostUri,
|
|
109
|
+
]
|
|
110
|
+
const posts = await agent.app.bsky.feed.getPosts(
|
|
111
|
+
{ uris },
|
|
112
|
+
{
|
|
113
|
+
headers: await network.serviceHeaders(
|
|
114
|
+
sc.dids.alice,
|
|
115
|
+
ids.AppBskyFeedGetPosts,
|
|
116
|
+
),
|
|
117
|
+
},
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
expect(posts.data.posts.length).toBe(uris.length - 1)
|
|
121
|
+
expect(posts.data.posts.map((p) => p.uri).includes(badPostUri)).toBe(false)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it(`omits posts by taken-down accounts`, async () => {
|
|
125
|
+
// Taken-down account.
|
|
126
|
+
const badPostUri = sc.posts[sc.dids.frankie][0].ref.uriStr
|
|
127
|
+
|
|
128
|
+
const uris = [
|
|
129
|
+
sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
130
|
+
sc.posts[sc.dids.alice][1].ref.uriStr,
|
|
131
|
+
sc.posts[sc.dids.bob][0].ref.uriStr,
|
|
132
|
+
badPostUri,
|
|
133
|
+
]
|
|
134
|
+
const posts = await agent.app.bsky.feed.getPosts(
|
|
135
|
+
{ uris },
|
|
136
|
+
{
|
|
137
|
+
headers: await network.serviceHeaders(
|
|
138
|
+
sc.dids.alice,
|
|
139
|
+
ids.AppBskyFeedGetPosts,
|
|
140
|
+
),
|
|
141
|
+
},
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
expect(posts.data.posts.length).toBe(uris.length - 1)
|
|
145
|
+
expect(posts.data.posts.map((p) => p.uri).includes(badPostUri)).toBe(false)
|
|
146
|
+
})
|
|
147
|
+
|
|
52
148
|
it('fetches posts unauthed', async () => {
|
|
53
149
|
const uris = [
|
|
54
150
|
sc.posts[sc.dids.alice][0].ref.uriStr,
|