@atproto/pds 0.4.161 → 0.4.163
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 +14 -0
- package/dist/lexicon/index.d.ts +2 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +186 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +103 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- 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/dist/lexicon/types/com/atproto/temp/checkHandleAvailability.d.ts +58 -0
- package/dist/lexicon/types/com/atproto/temp/checkHandleAvailability.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/temp/checkHandleAvailability.js +34 -0
- package/dist/lexicon/types/com/atproto/temp/checkHandleAvailability.js.map +1 -0
- package/package.json +6 -6
- package/src/lexicon/index.ts +13 -0
- package/src/lexicon/lexicons.ts +111 -0
- package/src/lexicon/types/app/bsky/unspecced/initAgeAssurance.ts +1 -0
- package/src/lexicon/types/com/atproto/temp/checkHandleAvailability.ts +99 -0
- package/tests/crud.test.ts +7 -3
- package/tsconfig.build.tsbuildinfo +1 -1
@@ -23,6 +23,7 @@ export interface HandlerSuccess {
|
|
23
23
|
export interface HandlerError {
|
24
24
|
status: number;
|
25
25
|
message?: string;
|
26
|
+
error?: 'InvalidEmail' | 'DidTooLong' | 'InvalidInitiation';
|
26
27
|
}
|
27
28
|
export type HandlerOutput = HandlerError | HandlerSuccess;
|
28
29
|
//# sourceMappingURL=initAgeAssurance.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"initAgeAssurance.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/initAgeAssurance.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,oBAAoB,MAAM,WAAW,CAAA;AAMtD,MAAM,MAAM,WAAW,GAAG,EAAE,CAAA;AAE5B,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAA;AAEjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"initAgeAssurance.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/initAgeAssurance.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,oBAAoB,MAAM,WAAW,CAAA;AAMtD,MAAM,MAAM,WAAW,GAAG,EAAE,CAAA;AAE5B,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAA;AAEjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,mBAAmB,CAAA;CAC5D;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
5
|
+
import { type $Typed } from '../../../../util';
|
6
|
+
export type QueryParams = {
|
7
|
+
/** Tentative handle. Will be checked for availability or used to build handle suggestions. */
|
8
|
+
handle: string;
|
9
|
+
/** User-provided email. Might be used to build handle suggestions. */
|
10
|
+
email?: string;
|
11
|
+
/** User-provided birth date. Might be used to build handle suggestions. */
|
12
|
+
birthDate?: string;
|
13
|
+
};
|
14
|
+
export type InputSchema = undefined;
|
15
|
+
export interface OutputSchema {
|
16
|
+
/** Echo of the input handle. */
|
17
|
+
handle: string;
|
18
|
+
result: $Typed<ResultAvailable> | $Typed<ResultUnavailable> | {
|
19
|
+
$type: string;
|
20
|
+
};
|
21
|
+
}
|
22
|
+
export type HandlerInput = void;
|
23
|
+
export interface HandlerSuccess {
|
24
|
+
encoding: 'application/json';
|
25
|
+
body: OutputSchema;
|
26
|
+
headers?: {
|
27
|
+
[key: string]: string;
|
28
|
+
};
|
29
|
+
}
|
30
|
+
export interface HandlerError {
|
31
|
+
status: number;
|
32
|
+
message?: string;
|
33
|
+
error?: 'InvalidEmail';
|
34
|
+
}
|
35
|
+
export type HandlerOutput = HandlerError | HandlerSuccess;
|
36
|
+
/** Indicates the provided handle is available. */
|
37
|
+
export interface ResultAvailable {
|
38
|
+
$type?: 'com.atproto.temp.checkHandleAvailability#resultAvailable';
|
39
|
+
}
|
40
|
+
export declare function isResultAvailable<V>(v: V): v is import("../../../../util").$TypedObject<V, "com.atproto.temp.checkHandleAvailability", "resultAvailable">;
|
41
|
+
export declare function validateResultAvailable<V>(v: V): ValidationResult<ResultAvailable & V>;
|
42
|
+
/** Indicates the provided handle is unavailable and gives suggestions of available handles. */
|
43
|
+
export interface ResultUnavailable {
|
44
|
+
$type?: 'com.atproto.temp.checkHandleAvailability#resultUnavailable';
|
45
|
+
/** List of suggested handles based on the provided inputs. */
|
46
|
+
suggestions: Suggestion[];
|
47
|
+
}
|
48
|
+
export declare function isResultUnavailable<V>(v: V): v is import("../../../../util").$TypedObject<V, "com.atproto.temp.checkHandleAvailability", "resultUnavailable">;
|
49
|
+
export declare function validateResultUnavailable<V>(v: V): ValidationResult<ResultUnavailable & V>;
|
50
|
+
export interface Suggestion {
|
51
|
+
$type?: 'com.atproto.temp.checkHandleAvailability#suggestion';
|
52
|
+
handle: string;
|
53
|
+
/** Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics. */
|
54
|
+
method: string;
|
55
|
+
}
|
56
|
+
export declare function isSuggestion<V>(v: V): v is import("../../../../util").$TypedObject<V, "com.atproto.temp.checkHandleAvailability", "suggestion">;
|
57
|
+
export declare function validateSuggestion<V>(v: V): ValidationResult<Suggestion & V>;
|
58
|
+
//# sourceMappingURL=checkHandleAvailability.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkHandleAvailability.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/com/atproto/temp/checkHandleAvailability.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAGjE,OAAO,EACL,KAAK,MAAM,EAGZ,MAAM,kBAAkB,CAAA;AAMzB,MAAM,MAAM,WAAW,GAAG;IACxB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EACF,MAAM,CAAC,eAAe,CAAC,GACvB,MAAM,CAAC,iBAAiB,CAAC,GACzB;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,CAAA;AAE/B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA;AAEzD,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,0DAA0D,CAAA;CACnE;AAID,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kHAExC;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,yCAE9C;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,4DAA4D,CAAA;IACpE,8DAA8D;IAC9D,WAAW,EAAE,UAAU,EAAE,CAAA;CAC1B;AAID,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,oHAE1C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,2CAEhD;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,qDAAqD,CAAA;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,6GAA6G;IAC7G,MAAM,EAAE,MAAM,CAAA;CACf;AAID,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,6GAEnC;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,oCAEzC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isResultAvailable = isResultAvailable;
|
4
|
+
exports.validateResultAvailable = validateResultAvailable;
|
5
|
+
exports.isResultUnavailable = isResultUnavailable;
|
6
|
+
exports.validateResultUnavailable = validateResultUnavailable;
|
7
|
+
exports.isSuggestion = isSuggestion;
|
8
|
+
exports.validateSuggestion = validateSuggestion;
|
9
|
+
const lexicons_1 = require("../../../../lexicons");
|
10
|
+
const util_1 = require("../../../../util");
|
11
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
12
|
+
const id = 'com.atproto.temp.checkHandleAvailability';
|
13
|
+
const hashResultAvailable = 'resultAvailable';
|
14
|
+
function isResultAvailable(v) {
|
15
|
+
return is$typed(v, id, hashResultAvailable);
|
16
|
+
}
|
17
|
+
function validateResultAvailable(v) {
|
18
|
+
return validate(v, id, hashResultAvailable);
|
19
|
+
}
|
20
|
+
const hashResultUnavailable = 'resultUnavailable';
|
21
|
+
function isResultUnavailable(v) {
|
22
|
+
return is$typed(v, id, hashResultUnavailable);
|
23
|
+
}
|
24
|
+
function validateResultUnavailable(v) {
|
25
|
+
return validate(v, id, hashResultUnavailable);
|
26
|
+
}
|
27
|
+
const hashSuggestion = 'suggestion';
|
28
|
+
function isSuggestion(v) {
|
29
|
+
return is$typed(v, id, hashSuggestion);
|
30
|
+
}
|
31
|
+
function validateSuggestion(v) {
|
32
|
+
return validate(v, id, hashSuggestion);
|
33
|
+
}
|
34
|
+
//# sourceMappingURL=checkHandleAvailability.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkHandleAvailability.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/com/atproto/temp/checkHandleAvailability.ts"],"names":[],"mappings":";;AA0DA,8CAEC;AAED,0DAEC;AAWD,kDAEC;AAED,8DAEC;AAWD,oCAEC;AAED,gDAEC;AA7FD,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,0CAA0C,CAAA;AA0CrD,MAAM,mBAAmB,GAAG,iBAAiB,CAAA;AAE7C,SAAgB,iBAAiB,CAAI,CAAI;IACvC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAA;AAC7C,CAAC;AAED,SAAgB,uBAAuB,CAAI,CAAI;IAC7C,OAAO,QAAQ,CAAsB,CAAC,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAA;AAClE,CAAC;AASD,MAAM,qBAAqB,GAAG,mBAAmB,CAAA;AAEjD,SAAgB,mBAAmB,CAAI,CAAI;IACzC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAA;AAC/C,CAAC;AAED,SAAgB,yBAAyB,CAAI,CAAI;IAC/C,OAAO,QAAQ,CAAwB,CAAC,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAA;AACtE,CAAC;AASD,MAAM,cAAc,GAAG,YAAY,CAAA;AAEnC,SAAgB,YAAY,CAAI,CAAI;IAClC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,cAAc,CAAC,CAAA;AACxC,CAAC;AAED,SAAgB,kBAAkB,CAAI,CAAI;IACxC,OAAO,QAAQ,CAAiB,CAAC,EAAE,EAAE,EAAE,cAAc,CAAC,CAAA;AACxD,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/pds",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.163",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
6
6
|
"keywords": [
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"zod": "^3.23.8",
|
50
50
|
"@atproto-labs/fetch-node": "0.1.9",
|
51
51
|
"@atproto-labs/xrpc-utils": "0.0.17",
|
52
|
-
"@atproto/api": "^0.
|
52
|
+
"@atproto/api": "^0.16.0",
|
53
53
|
"@atproto/aws": "^0.2.25",
|
54
54
|
"@atproto/common": "^0.4.11",
|
55
55
|
"@atproto/crypto": "^0.4.4",
|
@@ -77,10 +77,10 @@
|
|
77
77
|
"ts-node": "^10.8.2",
|
78
78
|
"typescript": "^5.6.3",
|
79
79
|
"ws": "^8.12.0",
|
80
|
-
"@atproto/api": "^0.
|
81
|
-
"@atproto/bsky": "^0.0.
|
82
|
-
"@atproto/dev-env": "^0.3.
|
83
|
-
"@atproto/lex-cli": "^0.9.
|
80
|
+
"@atproto/api": "^0.16.0",
|
81
|
+
"@atproto/bsky": "^0.0.175",
|
82
|
+
"@atproto/dev-env": "^0.3.158",
|
83
|
+
"@atproto/lex-cli": "^0.9.1",
|
84
84
|
"@atproto/oauth-client-browser-example": "0.0.5"
|
85
85
|
},
|
86
86
|
"scripts": {
|
package/src/lexicon/index.ts
CHANGED
@@ -89,6 +89,7 @@ import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOf
|
|
89
89
|
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl.js'
|
90
90
|
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos.js'
|
91
91
|
import * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle.js'
|
92
|
+
import * as ComAtprotoTempCheckHandleAvailability from './types/com/atproto/temp/checkHandleAvailability.js'
|
92
93
|
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue.js'
|
93
94
|
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels.js'
|
94
95
|
import * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification.js'
|
@@ -1355,6 +1356,18 @@ export class ComAtprotoTempNS {
|
|
1355
1356
|
return this._server.xrpc.method(nsid, cfg)
|
1356
1357
|
}
|
1357
1358
|
|
1359
|
+
checkHandleAvailability<A extends Auth = void>(
|
1360
|
+
cfg: MethodConfigOrHandler<
|
1361
|
+
A,
|
1362
|
+
ComAtprotoTempCheckHandleAvailability.QueryParams,
|
1363
|
+
ComAtprotoTempCheckHandleAvailability.HandlerInput,
|
1364
|
+
ComAtprotoTempCheckHandleAvailability.HandlerOutput
|
1365
|
+
>,
|
1366
|
+
) {
|
1367
|
+
const nsid = 'com.atproto.temp.checkHandleAvailability' // @ts-ignore
|
1368
|
+
return this._server.xrpc.method(nsid, cfg)
|
1369
|
+
}
|
1370
|
+
|
1358
1371
|
checkSignupQueue<A extends Auth = void>(
|
1359
1372
|
cfg: MethodConfigOrHandler<
|
1360
1373
|
A,
|
package/src/lexicon/lexicons.ts
CHANGED
@@ -4449,6 +4449,104 @@ export const schemaDict = {
|
|
4449
4449
|
},
|
4450
4450
|
},
|
4451
4451
|
},
|
4452
|
+
ComAtprotoTempCheckHandleAvailability: {
|
4453
|
+
lexicon: 1,
|
4454
|
+
id: 'com.atproto.temp.checkHandleAvailability',
|
4455
|
+
defs: {
|
4456
|
+
main: {
|
4457
|
+
type: 'query',
|
4458
|
+
description:
|
4459
|
+
'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.',
|
4460
|
+
parameters: {
|
4461
|
+
type: 'params',
|
4462
|
+
required: ['handle'],
|
4463
|
+
properties: {
|
4464
|
+
handle: {
|
4465
|
+
type: 'string',
|
4466
|
+
format: 'handle',
|
4467
|
+
description:
|
4468
|
+
'Tentative handle. Will be checked for availability or used to build handle suggestions.',
|
4469
|
+
},
|
4470
|
+
email: {
|
4471
|
+
type: 'string',
|
4472
|
+
description:
|
4473
|
+
'User-provided email. Might be used to build handle suggestions.',
|
4474
|
+
},
|
4475
|
+
birthDate: {
|
4476
|
+
type: 'string',
|
4477
|
+
format: 'datetime',
|
4478
|
+
description:
|
4479
|
+
'User-provided birth date. Might be used to build handle suggestions.',
|
4480
|
+
},
|
4481
|
+
},
|
4482
|
+
},
|
4483
|
+
output: {
|
4484
|
+
encoding: 'application/json',
|
4485
|
+
schema: {
|
4486
|
+
type: 'object',
|
4487
|
+
required: ['handle', 'result'],
|
4488
|
+
properties: {
|
4489
|
+
handle: {
|
4490
|
+
type: 'string',
|
4491
|
+
format: 'handle',
|
4492
|
+
description: 'Echo of the input handle.',
|
4493
|
+
},
|
4494
|
+
result: {
|
4495
|
+
type: 'union',
|
4496
|
+
refs: [
|
4497
|
+
'lex:com.atproto.temp.checkHandleAvailability#resultAvailable',
|
4498
|
+
'lex:com.atproto.temp.checkHandleAvailability#resultUnavailable',
|
4499
|
+
],
|
4500
|
+
},
|
4501
|
+
},
|
4502
|
+
},
|
4503
|
+
},
|
4504
|
+
errors: [
|
4505
|
+
{
|
4506
|
+
name: 'InvalidEmail',
|
4507
|
+
description: 'An invalid email was provided.',
|
4508
|
+
},
|
4509
|
+
],
|
4510
|
+
},
|
4511
|
+
resultAvailable: {
|
4512
|
+
type: 'object',
|
4513
|
+
description: 'Indicates the provided handle is available.',
|
4514
|
+
properties: {},
|
4515
|
+
},
|
4516
|
+
resultUnavailable: {
|
4517
|
+
type: 'object',
|
4518
|
+
description:
|
4519
|
+
'Indicates the provided handle is unavailable and gives suggestions of available handles.',
|
4520
|
+
required: ['suggestions'],
|
4521
|
+
properties: {
|
4522
|
+
suggestions: {
|
4523
|
+
type: 'array',
|
4524
|
+
description:
|
4525
|
+
'List of suggested handles based on the provided inputs.',
|
4526
|
+
items: {
|
4527
|
+
type: 'ref',
|
4528
|
+
ref: 'lex:com.atproto.temp.checkHandleAvailability#suggestion',
|
4529
|
+
},
|
4530
|
+
},
|
4531
|
+
},
|
4532
|
+
},
|
4533
|
+
suggestion: {
|
4534
|
+
type: 'object',
|
4535
|
+
required: ['handle', 'method'],
|
4536
|
+
properties: {
|
4537
|
+
handle: {
|
4538
|
+
type: 'string',
|
4539
|
+
format: 'handle',
|
4540
|
+
},
|
4541
|
+
method: {
|
4542
|
+
type: 'string',
|
4543
|
+
description:
|
4544
|
+
'Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics.',
|
4545
|
+
},
|
4546
|
+
},
|
4547
|
+
},
|
4548
|
+
},
|
4549
|
+
},
|
4452
4550
|
ComAtprotoTempCheckSignupQueue: {
|
4453
4551
|
lexicon: 1,
|
4454
4552
|
id: 'com.atproto.temp.checkSignupQueue',
|
@@ -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
|
},
|
@@ -17636,6 +17745,8 @@ export const ids = {
|
|
17636
17745
|
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
|
17637
17746
|
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
|
17638
17747
|
ComAtprotoTempAddReservedHandle: 'com.atproto.temp.addReservedHandle',
|
17748
|
+
ComAtprotoTempCheckHandleAvailability:
|
17749
|
+
'com.atproto.temp.checkHandleAvailability',
|
17639
17750
|
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
|
17640
17751
|
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
|
17641
17752
|
ComAtprotoTempRequestPhoneVerification:
|
@@ -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 = 'com.atproto.temp.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?: 'com.atproto.temp.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?: 'com.atproto.temp.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?: 'com.atproto.temp.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
|
+
}
|
package/tests/crud.test.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import assert from 'node:assert'
|
2
2
|
import fs from 'node:fs/promises'
|
3
|
-
import { AtpAgent } from '@atproto/api'
|
3
|
+
import { AppBskyFeedPostRecord, AtpAgent } from '@atproto/api'
|
4
4
|
import { TID, cidForCbor, ui8ToArrayBuffer } from '@atproto/common'
|
5
5
|
import { TestNetworkNoAppView } from '@atproto/dev-env'
|
6
6
|
import { BlobRef } from '@atproto/lexicon'
|
@@ -247,7 +247,9 @@ describe('crud operations', () => {
|
|
247
247
|
})
|
248
248
|
|
249
249
|
it('in forwards order', async () => {
|
250
|
-
const results = (
|
250
|
+
const results = (
|
251
|
+
results: Awaited<ReturnType<AppBskyFeedPostRecord['list']>>[],
|
252
|
+
) => results.flatMap((res) => res.records)
|
251
253
|
const paginator = async (cursor?: string) => {
|
252
254
|
const res = await agent.app.bsky.feed.post.list({
|
253
255
|
repo: aliceAgent.accountDid,
|
@@ -271,7 +273,9 @@ describe('crud operations', () => {
|
|
271
273
|
})
|
272
274
|
|
273
275
|
it('in reverse order', async () => {
|
274
|
-
const results = (
|
276
|
+
const results = (
|
277
|
+
results: Awaited<ReturnType<AppBskyFeedPostRecord['list']>>[],
|
278
|
+
) => results.flatMap((res) => res.records)
|
275
279
|
const paginator = async (cursor?: string) => {
|
276
280
|
const res = await agent.app.bsky.feed.post.list({
|
277
281
|
repo: aliceAgent.accountDid,
|