@atproto/bsky 0.0.172 → 0.0.174
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 +15 -0
- package/dist/api/app/bsky/unspecced/checkHandleAvailability.d.ts +4 -0
- package/dist/api/app/bsky/unspecced/checkHandleAvailability.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/checkHandleAvailability.js +238 -0
- package/dist/api/app/bsky/unspecced/checkHandleAvailability.js.map +1 -0
- package/dist/api/app/bsky/unspecced/initAgeAssurance.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/initAgeAssurance.js +71 -9
- package/dist/api/app/bsky/unspecced/initAgeAssurance.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/kws.d.ts +2 -0
- package/dist/kws.d.ts.map +1 -1
- package/dist/kws.js +10 -2
- package/dist/kws.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -2
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -4
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +268 -82
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +145 -42
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/checkHandleAvailability.d.ts +58 -0
- package/dist/lexicon/types/app/bsky/unspecced/checkHandleAvailability.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/checkHandleAvailability.js +34 -0
- package/dist/lexicon/types/app/bsky/unspecced/checkHandleAvailability.js.map +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/initAgeAssurance.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/unspecced/initAgeAssurance.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/api/app/bsky/unspecced/checkHandleAvailability.ts +291 -0
- package/src/api/app/bsky/unspecced/initAgeAssurance.ts +96 -11
- package/src/api/index.ts +2 -0
- package/src/kws.ts +9 -1
- package/src/lexicon/index.ts +24 -11
- package/src/lexicon/lexicons.ts +154 -43
- package/src/lexicon/types/app/bsky/unspecced/checkHandleAvailability.ts +99 -0
- package/src/lexicon/types/app/bsky/unspecced/initAgeAssurance.ts +1 -0
- package/tests/views/age-assurance.test.ts +44 -0
- package/tests/views/handle-availability.test.ts +294 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
package/src/lexicon/index.ts
CHANGED
|
@@ -109,8 +109,8 @@ import * as AppBskyFeedGetFeedGenerators from './types/app/bsky/feed/getFeedGene
|
|
|
109
109
|
import * as AppBskyFeedGetFeedSkeleton from './types/app/bsky/feed/getFeedSkeleton.js'
|
|
110
110
|
import * as AppBskyFeedGetLikes from './types/app/bsky/feed/getLikes.js'
|
|
111
111
|
import * as AppBskyFeedGetListFeed from './types/app/bsky/feed/getListFeed.js'
|
|
112
|
-
import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
|
|
113
112
|
import * as AppBskyFeedGetPosts from './types/app/bsky/feed/getPosts.js'
|
|
113
|
+
import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread.js'
|
|
114
114
|
import * as AppBskyFeedGetQuotes from './types/app/bsky/feed/getQuotes.js'
|
|
115
115
|
import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy.js'
|
|
116
116
|
import * as AppBskyFeedGetSuggestedFeeds from './types/app/bsky/feed/getSuggestedFeeds.js'
|
|
@@ -149,6 +149,7 @@ import * as AppBskyNotificationPutPreferencesV2 from './types/app/bsky/notificat
|
|
|
149
149
|
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush.js'
|
|
150
150
|
import * as AppBskyNotificationUnregisterPush from './types/app/bsky/notification/unregisterPush.js'
|
|
151
151
|
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen.js'
|
|
152
|
+
import * as AppBskyUnspeccedCheckHandleAvailability from './types/app/bsky/unspecced/checkHandleAvailability.js'
|
|
152
153
|
import * as AppBskyUnspeccedGetAgeAssuranceState from './types/app/bsky/unspecced/getAgeAssuranceState.js'
|
|
153
154
|
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig.js'
|
|
154
155
|
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators.js'
|
|
@@ -1600,27 +1601,27 @@ export class AppBskyFeedNS {
|
|
|
1600
1601
|
return this._server.xrpc.method(nsid, cfg)
|
|
1601
1602
|
}
|
|
1602
1603
|
|
|
1603
|
-
|
|
1604
|
+
getPosts<A extends Auth = void>(
|
|
1604
1605
|
cfg: MethodConfigOrHandler<
|
|
1605
1606
|
A,
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1607
|
+
AppBskyFeedGetPosts.QueryParams,
|
|
1608
|
+
AppBskyFeedGetPosts.HandlerInput,
|
|
1609
|
+
AppBskyFeedGetPosts.HandlerOutput
|
|
1609
1610
|
>,
|
|
1610
1611
|
) {
|
|
1611
|
-
const nsid = 'app.bsky.feed.
|
|
1612
|
+
const nsid = 'app.bsky.feed.getPosts' // @ts-ignore
|
|
1612
1613
|
return this._server.xrpc.method(nsid, cfg)
|
|
1613
1614
|
}
|
|
1614
1615
|
|
|
1615
|
-
|
|
1616
|
+
getPostThread<A extends Auth = void>(
|
|
1616
1617
|
cfg: MethodConfigOrHandler<
|
|
1617
1618
|
A,
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1619
|
+
AppBskyFeedGetPostThread.QueryParams,
|
|
1620
|
+
AppBskyFeedGetPostThread.HandlerInput,
|
|
1621
|
+
AppBskyFeedGetPostThread.HandlerOutput
|
|
1621
1622
|
>,
|
|
1622
1623
|
) {
|
|
1623
|
-
const nsid = 'app.bsky.feed.
|
|
1624
|
+
const nsid = 'app.bsky.feed.getPostThread' // @ts-ignore
|
|
1624
1625
|
return this._server.xrpc.method(nsid, cfg)
|
|
1625
1626
|
}
|
|
1626
1627
|
|
|
@@ -2120,6 +2121,18 @@ export class AppBskyUnspeccedNS {
|
|
|
2120
2121
|
this._server = server
|
|
2121
2122
|
}
|
|
2122
2123
|
|
|
2124
|
+
checkHandleAvailability<A extends Auth = void>(
|
|
2125
|
+
cfg: MethodConfigOrHandler<
|
|
2126
|
+
A,
|
|
2127
|
+
AppBskyUnspeccedCheckHandleAvailability.QueryParams,
|
|
2128
|
+
AppBskyUnspeccedCheckHandleAvailability.HandlerInput,
|
|
2129
|
+
AppBskyUnspeccedCheckHandleAvailability.HandlerOutput
|
|
2130
|
+
>,
|
|
2131
|
+
) {
|
|
2132
|
+
const nsid = 'app.bsky.unspecced.checkHandleAvailability' // @ts-ignore
|
|
2133
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2123
2136
|
getAgeAssuranceState<A extends Auth = void>(
|
|
2124
2137
|
cfg: MethodConfigOrHandler<
|
|
2125
2138
|
A,
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -7282,6 +7282,48 @@ export const schemaDict = {
|
|
|
7282
7282
|
},
|
|
7283
7283
|
},
|
|
7284
7284
|
},
|
|
7285
|
+
AppBskyFeedGetPosts: {
|
|
7286
|
+
lexicon: 1,
|
|
7287
|
+
id: 'app.bsky.feed.getPosts',
|
|
7288
|
+
defs: {
|
|
7289
|
+
main: {
|
|
7290
|
+
type: 'query',
|
|
7291
|
+
description:
|
|
7292
|
+
"Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
|
|
7293
|
+
parameters: {
|
|
7294
|
+
type: 'params',
|
|
7295
|
+
required: ['uris'],
|
|
7296
|
+
properties: {
|
|
7297
|
+
uris: {
|
|
7298
|
+
type: 'array',
|
|
7299
|
+
description: 'List of post AT-URIs to return hydrated views for.',
|
|
7300
|
+
items: {
|
|
7301
|
+
type: 'string',
|
|
7302
|
+
format: 'at-uri',
|
|
7303
|
+
},
|
|
7304
|
+
maxLength: 25,
|
|
7305
|
+
},
|
|
7306
|
+
},
|
|
7307
|
+
},
|
|
7308
|
+
output: {
|
|
7309
|
+
encoding: 'application/json',
|
|
7310
|
+
schema: {
|
|
7311
|
+
type: 'object',
|
|
7312
|
+
required: ['posts'],
|
|
7313
|
+
properties: {
|
|
7314
|
+
posts: {
|
|
7315
|
+
type: 'array',
|
|
7316
|
+
items: {
|
|
7317
|
+
type: 'ref',
|
|
7318
|
+
ref: 'lex:app.bsky.feed.defs#postView',
|
|
7319
|
+
},
|
|
7320
|
+
},
|
|
7321
|
+
},
|
|
7322
|
+
},
|
|
7323
|
+
},
|
|
7324
|
+
},
|
|
7325
|
+
},
|
|
7326
|
+
},
|
|
7285
7327
|
AppBskyFeedGetPostThread: {
|
|
7286
7328
|
lexicon: 1,
|
|
7287
7329
|
id: 'app.bsky.feed.getPostThread',
|
|
@@ -7346,48 +7388,6 @@ export const schemaDict = {
|
|
|
7346
7388
|
},
|
|
7347
7389
|
},
|
|
7348
7390
|
},
|
|
7349
|
-
AppBskyFeedGetPosts: {
|
|
7350
|
-
lexicon: 1,
|
|
7351
|
-
id: 'app.bsky.feed.getPosts',
|
|
7352
|
-
defs: {
|
|
7353
|
-
main: {
|
|
7354
|
-
type: 'query',
|
|
7355
|
-
description:
|
|
7356
|
-
"Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
|
|
7357
|
-
parameters: {
|
|
7358
|
-
type: 'params',
|
|
7359
|
-
required: ['uris'],
|
|
7360
|
-
properties: {
|
|
7361
|
-
uris: {
|
|
7362
|
-
type: 'array',
|
|
7363
|
-
description: 'List of post AT-URIs to return hydrated views for.',
|
|
7364
|
-
items: {
|
|
7365
|
-
type: 'string',
|
|
7366
|
-
format: 'at-uri',
|
|
7367
|
-
},
|
|
7368
|
-
maxLength: 25,
|
|
7369
|
-
},
|
|
7370
|
-
},
|
|
7371
|
-
},
|
|
7372
|
-
output: {
|
|
7373
|
-
encoding: 'application/json',
|
|
7374
|
-
schema: {
|
|
7375
|
-
type: 'object',
|
|
7376
|
-
required: ['posts'],
|
|
7377
|
-
properties: {
|
|
7378
|
-
posts: {
|
|
7379
|
-
type: 'array',
|
|
7380
|
-
items: {
|
|
7381
|
-
type: 'ref',
|
|
7382
|
-
ref: 'lex:app.bsky.feed.defs#postView',
|
|
7383
|
-
},
|
|
7384
|
-
},
|
|
7385
|
-
},
|
|
7386
|
-
},
|
|
7387
|
-
},
|
|
7388
|
-
},
|
|
7389
|
-
},
|
|
7390
|
-
},
|
|
7391
7391
|
AppBskyFeedGetQuotes: {
|
|
7392
7392
|
lexicon: 1,
|
|
7393
7393
|
id: 'app.bsky.feed.getQuotes',
|
|
@@ -10511,6 +10511,104 @@ export const schemaDict = {
|
|
|
10511
10511
|
},
|
|
10512
10512
|
},
|
|
10513
10513
|
},
|
|
10514
|
+
AppBskyUnspeccedCheckHandleAvailability: {
|
|
10515
|
+
lexicon: 1,
|
|
10516
|
+
id: 'app.bsky.unspecced.checkHandleAvailability',
|
|
10517
|
+
defs: {
|
|
10518
|
+
main: {
|
|
10519
|
+
type: 'query',
|
|
10520
|
+
description:
|
|
10521
|
+
'Checks whether the provided handle is available. If the handle is not available, available suggestions will be returned. Optional inputs will be used to generate suggestions.',
|
|
10522
|
+
parameters: {
|
|
10523
|
+
type: 'params',
|
|
10524
|
+
required: ['handle'],
|
|
10525
|
+
properties: {
|
|
10526
|
+
handle: {
|
|
10527
|
+
type: 'string',
|
|
10528
|
+
format: 'handle',
|
|
10529
|
+
description:
|
|
10530
|
+
'Tentative handle. Will be checked for availability or used to build handle suggestions.',
|
|
10531
|
+
},
|
|
10532
|
+
email: {
|
|
10533
|
+
type: 'string',
|
|
10534
|
+
description:
|
|
10535
|
+
'User-provided email. Might be used to build handle suggestions.',
|
|
10536
|
+
},
|
|
10537
|
+
birthDate: {
|
|
10538
|
+
type: 'string',
|
|
10539
|
+
format: 'datetime',
|
|
10540
|
+
description:
|
|
10541
|
+
'User-provided birth date. Might be used to build handle suggestions.',
|
|
10542
|
+
},
|
|
10543
|
+
},
|
|
10544
|
+
},
|
|
10545
|
+
output: {
|
|
10546
|
+
encoding: 'application/json',
|
|
10547
|
+
schema: {
|
|
10548
|
+
type: 'object',
|
|
10549
|
+
required: ['handle', 'result'],
|
|
10550
|
+
properties: {
|
|
10551
|
+
handle: {
|
|
10552
|
+
type: 'string',
|
|
10553
|
+
format: 'handle',
|
|
10554
|
+
description: 'Echo of the input handle.',
|
|
10555
|
+
},
|
|
10556
|
+
result: {
|
|
10557
|
+
type: 'union',
|
|
10558
|
+
refs: [
|
|
10559
|
+
'lex:app.bsky.unspecced.checkHandleAvailability#resultAvailable',
|
|
10560
|
+
'lex:app.bsky.unspecced.checkHandleAvailability#resultUnavailable',
|
|
10561
|
+
],
|
|
10562
|
+
},
|
|
10563
|
+
},
|
|
10564
|
+
},
|
|
10565
|
+
},
|
|
10566
|
+
errors: [
|
|
10567
|
+
{
|
|
10568
|
+
name: 'InvalidEmail',
|
|
10569
|
+
description: 'An invalid email was provided.',
|
|
10570
|
+
},
|
|
10571
|
+
],
|
|
10572
|
+
},
|
|
10573
|
+
resultAvailable: {
|
|
10574
|
+
type: 'object',
|
|
10575
|
+
description: 'Indicates the provided handle is available.',
|
|
10576
|
+
properties: {},
|
|
10577
|
+
},
|
|
10578
|
+
resultUnavailable: {
|
|
10579
|
+
type: 'object',
|
|
10580
|
+
description:
|
|
10581
|
+
'Indicates the provided handle is unavailable and gives suggestions of available handles.',
|
|
10582
|
+
required: ['suggestions'],
|
|
10583
|
+
properties: {
|
|
10584
|
+
suggestions: {
|
|
10585
|
+
type: 'array',
|
|
10586
|
+
description:
|
|
10587
|
+
'List of suggested handles based on the provided inputs.',
|
|
10588
|
+
items: {
|
|
10589
|
+
type: 'ref',
|
|
10590
|
+
ref: 'lex:app.bsky.unspecced.checkHandleAvailability#suggestion',
|
|
10591
|
+
},
|
|
10592
|
+
},
|
|
10593
|
+
},
|
|
10594
|
+
},
|
|
10595
|
+
suggestion: {
|
|
10596
|
+
type: 'object',
|
|
10597
|
+
required: ['handle', 'method'],
|
|
10598
|
+
properties: {
|
|
10599
|
+
handle: {
|
|
10600
|
+
type: 'string',
|
|
10601
|
+
format: 'handle',
|
|
10602
|
+
},
|
|
10603
|
+
method: {
|
|
10604
|
+
type: 'string',
|
|
10605
|
+
description:
|
|
10606
|
+
'Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics.',
|
|
10607
|
+
},
|
|
10608
|
+
},
|
|
10609
|
+
},
|
|
10610
|
+
},
|
|
10611
|
+
},
|
|
10514
10612
|
AppBskyUnspeccedDefs: {
|
|
10515
10613
|
lexicon: 1,
|
|
10516
10614
|
id: 'app.bsky.unspecced.defs',
|
|
@@ -11589,6 +11687,17 @@ export const schemaDict = {
|
|
|
11589
11687
|
ref: 'lex:app.bsky.unspecced.defs#ageAssuranceState',
|
|
11590
11688
|
},
|
|
11591
11689
|
},
|
|
11690
|
+
errors: [
|
|
11691
|
+
{
|
|
11692
|
+
name: 'InvalidEmail',
|
|
11693
|
+
},
|
|
11694
|
+
{
|
|
11695
|
+
name: 'DidTooLong',
|
|
11696
|
+
},
|
|
11697
|
+
{
|
|
11698
|
+
name: 'InvalidInitiation',
|
|
11699
|
+
},
|
|
11700
|
+
],
|
|
11592
11701
|
},
|
|
11593
11702
|
},
|
|
11594
11703
|
},
|
|
@@ -13460,8 +13569,8 @@ export const ids = {
|
|
|
13460
13569
|
AppBskyFeedGetFeedSkeleton: 'app.bsky.feed.getFeedSkeleton',
|
|
13461
13570
|
AppBskyFeedGetLikes: 'app.bsky.feed.getLikes',
|
|
13462
13571
|
AppBskyFeedGetListFeed: 'app.bsky.feed.getListFeed',
|
|
13463
|
-
AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
|
|
13464
13572
|
AppBskyFeedGetPosts: 'app.bsky.feed.getPosts',
|
|
13573
|
+
AppBskyFeedGetPostThread: 'app.bsky.feed.getPostThread',
|
|
13465
13574
|
AppBskyFeedGetQuotes: 'app.bsky.feed.getQuotes',
|
|
13466
13575
|
AppBskyFeedGetRepostedBy: 'app.bsky.feed.getRepostedBy',
|
|
13467
13576
|
AppBskyFeedGetSuggestedFeeds: 'app.bsky.feed.getSuggestedFeeds',
|
|
@@ -13522,6 +13631,8 @@ export const ids = {
|
|
|
13522
13631
|
AppBskyNotificationUnregisterPush: 'app.bsky.notification.unregisterPush',
|
|
13523
13632
|
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
|
|
13524
13633
|
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
|
|
13634
|
+
AppBskyUnspeccedCheckHandleAvailability:
|
|
13635
|
+
'app.bsky.unspecced.checkHandleAvailability',
|
|
13525
13636
|
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
|
|
13526
13637
|
AppBskyUnspeccedGetAgeAssuranceState:
|
|
13527
13638
|
'app.bsky.unspecced.getAgeAssuranceState',
|
|
@@ -0,0 +1,99 @@
|
|
|
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.unspecced.checkHandleAvailability'
|
|
16
|
+
|
|
17
|
+
export type QueryParams = {
|
|
18
|
+
/** Tentative handle. Will be checked for availability or used to build handle suggestions. */
|
|
19
|
+
handle: string
|
|
20
|
+
/** User-provided email. Might be used to build handle suggestions. */
|
|
21
|
+
email?: string
|
|
22
|
+
/** User-provided birth date. Might be used to build handle suggestions. */
|
|
23
|
+
birthDate?: string
|
|
24
|
+
}
|
|
25
|
+
export type InputSchema = undefined
|
|
26
|
+
|
|
27
|
+
export interface OutputSchema {
|
|
28
|
+
/** Echo of the input handle. */
|
|
29
|
+
handle: string
|
|
30
|
+
result:
|
|
31
|
+
| $Typed<ResultAvailable>
|
|
32
|
+
| $Typed<ResultUnavailable>
|
|
33
|
+
| { $type: string }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type HandlerInput = void
|
|
37
|
+
|
|
38
|
+
export interface HandlerSuccess {
|
|
39
|
+
encoding: 'application/json'
|
|
40
|
+
body: OutputSchema
|
|
41
|
+
headers?: { [key: string]: string }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface HandlerError {
|
|
45
|
+
status: number
|
|
46
|
+
message?: string
|
|
47
|
+
error?: 'InvalidEmail'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
|
51
|
+
|
|
52
|
+
/** Indicates the provided handle is available. */
|
|
53
|
+
export interface ResultAvailable {
|
|
54
|
+
$type?: 'app.bsky.unspecced.checkHandleAvailability#resultAvailable'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const hashResultAvailable = 'resultAvailable'
|
|
58
|
+
|
|
59
|
+
export function isResultAvailable<V>(v: V) {
|
|
60
|
+
return is$typed(v, id, hashResultAvailable)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function validateResultAvailable<V>(v: V) {
|
|
64
|
+
return validate<ResultAvailable & V>(v, id, hashResultAvailable)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Indicates the provided handle is unavailable and gives suggestions of available handles. */
|
|
68
|
+
export interface ResultUnavailable {
|
|
69
|
+
$type?: 'app.bsky.unspecced.checkHandleAvailability#resultUnavailable'
|
|
70
|
+
/** List of suggested handles based on the provided inputs. */
|
|
71
|
+
suggestions: Suggestion[]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const hashResultUnavailable = 'resultUnavailable'
|
|
75
|
+
|
|
76
|
+
export function isResultUnavailable<V>(v: V) {
|
|
77
|
+
return is$typed(v, id, hashResultUnavailable)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function validateResultUnavailable<V>(v: V) {
|
|
81
|
+
return validate<ResultUnavailable & V>(v, id, hashResultUnavailable)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface Suggestion {
|
|
85
|
+
$type?: 'app.bsky.unspecced.checkHandleAvailability#suggestion'
|
|
86
|
+
handle: string
|
|
87
|
+
/** Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics. */
|
|
88
|
+
method: string
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const hashSuggestion = 'suggestion'
|
|
92
|
+
|
|
93
|
+
export function isSuggestion<V>(v: V) {
|
|
94
|
+
return is$typed(v, id, hashSuggestion)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function validateSuggestion<V>(v: V) {
|
|
98
|
+
return validate<Suggestion & V>(v, id, hashSuggestion)
|
|
99
|
+
}
|
|
@@ -189,6 +189,50 @@ describe('age assurance views', () => {
|
|
|
189
189
|
)
|
|
190
190
|
})
|
|
191
191
|
|
|
192
|
+
it('ensures user cannot re-init flow from terminal state', async () => {
|
|
193
|
+
const actor = sc.dids.bob
|
|
194
|
+
const state0 = await getAgeAssurance(actor)
|
|
195
|
+
expect(state0).toStrictEqual({
|
|
196
|
+
status: 'unknown',
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
const init1 = await initAgeAssurance(actor)
|
|
200
|
+
expect(init1).toStrictEqual({
|
|
201
|
+
status: 'pending',
|
|
202
|
+
lastInitiatedAt: expect.any(String),
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
const init2 = await initAgeAssurance(actor)
|
|
206
|
+
expect(init2).toStrictEqual({
|
|
207
|
+
status: 'pending',
|
|
208
|
+
lastInitiatedAt: expect.any(String),
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Can re-init flow if the state is pending.
|
|
213
|
+
*/
|
|
214
|
+
expect(sendEmailMock).toHaveBeenCalledTimes(2)
|
|
215
|
+
|
|
216
|
+
const externalPayload: KwsExternalPayload = {
|
|
217
|
+
actorDid: actor,
|
|
218
|
+
attemptId,
|
|
219
|
+
}
|
|
220
|
+
const status = { verified: true }
|
|
221
|
+
await kwsServer.callVerificationResponse(network.bsky.url, {
|
|
222
|
+
externalPayload,
|
|
223
|
+
status,
|
|
224
|
+
})
|
|
225
|
+
const finalizedState = await getAgeAssurance(actor)
|
|
226
|
+
expect(finalizedState).toStrictEqual({
|
|
227
|
+
status: 'assured',
|
|
228
|
+
lastInitiatedAt: expect.any(String),
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
await expect(initAgeAssurance(actor)).rejects.toThrowError(
|
|
232
|
+
`Cannot initiate age assurance flow from current state: assured`,
|
|
233
|
+
)
|
|
234
|
+
})
|
|
235
|
+
|
|
192
236
|
describe('verification response flow', () => {
|
|
193
237
|
it('performs the AA flow', async () => {
|
|
194
238
|
const state0 = await getAgeAssurance(actorDid)
|