techne-sdk 0.4.0 → 0.5.0
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 +38 -0
- package/dist/catalog/catalog.gen.js +375 -121
- package/dist/generated/lexicons.d.ts +408 -126
- package/dist/generated/lexicons.js +225 -61
- package/dist/generated/nsid.d.ts +2 -0
- package/dist/generated/nsid.js +2 -0
- package/dist/generated/nsid.json +2 -0
- package/dist/generated/types/pub/techne/draft/identity/attest.d.ts +2 -0
- package/dist/generated/types/pub/techne/draft/identity/defs.d.ts +23 -7
- package/dist/generated/types/pub/techne/draft/identity/defs.js +7 -0
- package/dist/generated/types/pub/techne/draft/identity/finishAddMethod.d.ts +3 -0
- package/dist/generated/types/pub/techne/draft/identity/listMethods.d.ts +2 -1
- package/dist/generated/types/pub/techne/draft/identity/manageMethods.d.ts +52 -10
- package/dist/generated/types/pub/techne/draft/identity/manageMethods.js +56 -0
- package/dist/generated/types/pub/techne/draft/query/getRecords.d.ts +11 -0
- package/dist/generated/types/pub/techne/draft/query/getRecords.js +7 -0
- package/dist/query/compose.d.ts +1 -1
- package/dist/query/compose.js +1 -1
- package/dist/query/index.d.ts +7 -0
- package/dist/query/index.js +28 -1
- package/dist/versions/react.js +19 -6
- package/dist/wasm/techne-wasm.gen.js +1 -1
- package/dist/wasm/techne-wasm2js.gen.js +12450 -12450
- package/package.json +1 -1
package/dist/generated/nsid.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export declare const NSID: {
|
|
|
101
101
|
readonly IDENTITY_DEFS_LINK_VIEW: "pub.techne.draft.identity.defs#linkView";
|
|
102
102
|
readonly IDENTITY_DEFS_METHOD_VIEW: "pub.techne.draft.identity.defs#methodView";
|
|
103
103
|
readonly IDENTITY_DEFS_PENDING_CHANGE: "pub.techne.draft.identity.defs#pendingChange";
|
|
104
|
+
readonly IDENTITY_DEFS_PERSON_MEMBER: "pub.techne.draft.identity.defs#personMember";
|
|
104
105
|
readonly IDENTITY_FINISH_ADD_METHOD: "pub.techne.draft.identity.finishAddMethod";
|
|
105
106
|
readonly IDENTITY_FINISH_ADD_METHOD_OFFER: "pub.techne.draft.identity.finishAddMethod#offer";
|
|
106
107
|
readonly IDENTITY_FOLD: "pub.techne.draft.identity.fold";
|
|
@@ -211,6 +212,7 @@ export declare const NSID: {
|
|
|
211
212
|
readonly QUERY_GET_RECORDS_CURATION: "pub.techne.draft.query.getRecords#curation";
|
|
212
213
|
readonly QUERY_GET_RECORDS_DEFAULT: "pub.techne.draft.query.getRecords#default";
|
|
213
214
|
readonly QUERY_GET_RECORDS_HANDLE: "pub.techne.draft.query.getRecords#handle";
|
|
215
|
+
readonly QUERY_GET_RECORDS_LINKED_HANDLE: "pub.techne.draft.query.getRecords#linkedHandle";
|
|
214
216
|
readonly QUERY_GET_RECORDS_RESOLVED: "pub.techne.draft.query.getRecords#resolved";
|
|
215
217
|
readonly QUERY_HAS: "pub.techne.draft.query#has";
|
|
216
218
|
readonly QUERY_LIST_RECORDS: "pub.techne.draft.query.listRecords";
|
package/dist/generated/nsid.js
CHANGED
|
@@ -105,6 +105,7 @@ export const NSID = {
|
|
|
105
105
|
IDENTITY_DEFS_LINK_VIEW: 'pub.techne.draft.identity.defs#linkView',
|
|
106
106
|
IDENTITY_DEFS_METHOD_VIEW: 'pub.techne.draft.identity.defs#methodView',
|
|
107
107
|
IDENTITY_DEFS_PENDING_CHANGE: 'pub.techne.draft.identity.defs#pendingChange',
|
|
108
|
+
IDENTITY_DEFS_PERSON_MEMBER: 'pub.techne.draft.identity.defs#personMember',
|
|
108
109
|
IDENTITY_FINISH_ADD_METHOD: 'pub.techne.draft.identity.finishAddMethod',
|
|
109
110
|
IDENTITY_FINISH_ADD_METHOD_OFFER: 'pub.techne.draft.identity.finishAddMethod#offer',
|
|
110
111
|
IDENTITY_FOLD: 'pub.techne.draft.identity.fold',
|
|
@@ -215,6 +216,7 @@ export const NSID = {
|
|
|
215
216
|
QUERY_GET_RECORDS_CURATION: 'pub.techne.draft.query.getRecords#curation',
|
|
216
217
|
QUERY_GET_RECORDS_DEFAULT: 'pub.techne.draft.query.getRecords#default',
|
|
217
218
|
QUERY_GET_RECORDS_HANDLE: 'pub.techne.draft.query.getRecords#handle',
|
|
219
|
+
QUERY_GET_RECORDS_LINKED_HANDLE: 'pub.techne.draft.query.getRecords#linkedHandle',
|
|
218
220
|
QUERY_GET_RECORDS_RESOLVED: 'pub.techne.draft.query.getRecords#resolved',
|
|
219
221
|
QUERY_HAS: 'pub.techne.draft.query#has',
|
|
220
222
|
QUERY_LIST_RECORDS: 'pub.techne.draft.query.listRecords',
|
package/dist/generated/nsid.json
CHANGED
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"IDENTITY_DEFS_LINK_VIEW": "pub.techne.draft.identity.defs#linkView",
|
|
102
102
|
"IDENTITY_DEFS_METHOD_VIEW": "pub.techne.draft.identity.defs#methodView",
|
|
103
103
|
"IDENTITY_DEFS_PENDING_CHANGE": "pub.techne.draft.identity.defs#pendingChange",
|
|
104
|
+
"IDENTITY_DEFS_PERSON_MEMBER": "pub.techne.draft.identity.defs#personMember",
|
|
104
105
|
"IDENTITY_FINISH_ADD_METHOD": "pub.techne.draft.identity.finishAddMethod",
|
|
105
106
|
"IDENTITY_FINISH_ADD_METHOD_OFFER": "pub.techne.draft.identity.finishAddMethod#offer",
|
|
106
107
|
"IDENTITY_FOLD": "pub.techne.draft.identity.fold",
|
|
@@ -211,6 +212,7 @@
|
|
|
211
212
|
"QUERY_GET_RECORDS_CURATION": "pub.techne.draft.query.getRecords#curation",
|
|
212
213
|
"QUERY_GET_RECORDS_DEFAULT": "pub.techne.draft.query.getRecords#default",
|
|
213
214
|
"QUERY_GET_RECORDS_HANDLE": "pub.techne.draft.query.getRecords#handle",
|
|
215
|
+
"QUERY_GET_RECORDS_LINKED_HANDLE": "pub.techne.draft.query.getRecords#linkedHandle",
|
|
214
216
|
"QUERY_GET_RECORDS_RESOLVED": "pub.techne.draft.query.getRecords#resolved",
|
|
215
217
|
"QUERY_HAS": "pub.techne.draft.query#has",
|
|
216
218
|
"QUERY_LIST_RECORDS": "pub.techne.draft.query.listRecords",
|
|
@@ -13,6 +13,8 @@ export interface InputSchema {
|
|
|
13
13
|
verifiedAt: string;
|
|
14
14
|
/** The PDS created the account in this sign-in. */
|
|
15
15
|
newAccount: boolean;
|
|
16
|
+
/** Optional; sent only as true, and only with `newAccount`. The PDS's sign-in page named its Terms of Use and Privacy Policy when this account was made there, so the issuer records the person's assent. Absent: nothing to record (a returning sign-in, a page without the line, an older PDS, or a first-party app that shows its own terms). */
|
|
17
|
+
termsShown?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface OutputSchema {
|
|
18
20
|
/** Hook protocol version. */
|
|
@@ -11,7 +11,7 @@ export interface Channel {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function isChannel<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.defs", "channel">;
|
|
13
13
|
export declare function validateChannel<V>(v: V): ValidationResult<Channel & V>;
|
|
14
|
-
/** One sign-in method of the
|
|
14
|
+
/** One sign-in method of an account. `masked` is always masked. Only identity.manageMethods `list` (the identity PDS's signed hook, for the signed-in owner's own account page) adds `value`; identity.listMethods never does. */
|
|
15
15
|
export interface MethodView {
|
|
16
16
|
$type?: 'pub.techne.draft.identity.defs#methodView';
|
|
17
17
|
/** The method's id: the binding id (the credential's record key) of an email or phone, else the platform's id for it. Names the method in unlinkMethod and manageMethods. */
|
|
@@ -19,6 +19,8 @@ export interface MethodView {
|
|
|
19
19
|
type: 'email' | 'phone' | 'passkey' | 'nostr' | 'recoveryCodes' | (string & {});
|
|
20
20
|
/** The channel with most of it hidden, e.g. `j•••@example.com`, `+1 ••• ••• 4567`; a passkey's or Nostr key's label; `Recovery codes (n left)`. */
|
|
21
21
|
masked: string;
|
|
22
|
+
/** An email's full address or a phone's full number (E.164). Sent only by identity.manageMethods `list`, to the identity PDS, for the owner's own account page; never in identity.listMethods, signInMethods or a notice. Absent on a passkey, Nostr key or recovery codes. */
|
|
23
|
+
value?: string;
|
|
22
24
|
boundAt: string;
|
|
23
25
|
/** A recovery method of this account. Private: only the account sees it. */
|
|
24
26
|
recovery?: boolean;
|
|
@@ -29,30 +31,44 @@ export interface MethodView {
|
|
|
29
31
|
}
|
|
30
32
|
export declare function isMethodView<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.defs", "methodView">;
|
|
31
33
|
export declare function validateMethodView<V>(v: V): ValidationResult<MethodView & V>;
|
|
32
|
-
/** A change that waits for its time (a method's removal
|
|
34
|
+
/** A change that waits for its time (a method's removal, the account's deletion, or a method's move onto another account (identity.manageMethods moveMethod), 7 days, or none for a move a recovery method proved; the account's first recovery mark, 24 hours). A move is completed by the platform once due, tried again after a failed write, and may be dropped instead (identity.manageMethods moveMethod says when). Any of the account's methods, a frozen one too, can cancel it until then; a wait during which one of the account's methods was frozen (even if a recovery method lifted the freeze early) is dropped when it runs out, not completed. */
|
|
33
35
|
export interface PendingChange {
|
|
34
36
|
$type?: 'pub.techne.draft.identity.defs#pendingChange';
|
|
35
37
|
id: string;
|
|
36
|
-
kind: 'removeMethod' | 'deleteAccount' | 'markRecovery' | (string & {});
|
|
37
|
-
/** The method it removes or
|
|
38
|
+
kind: 'removeMethod' | 'deleteAccount' | 'markRecovery' | 'moveMethod' | (string & {});
|
|
39
|
+
/** The method it removes, marks or moves (for an incoming move, the other account's method). */
|
|
38
40
|
method?: string;
|
|
41
|
+
/** moveMethod: the other account. On the account the method leaves, where it goes; on the account it joins (identity.manageMethods `list` shows the move there too, and either account can cancel it), where it comes from. */
|
|
42
|
+
other?: string;
|
|
39
43
|
createdAt: string;
|
|
40
44
|
dueAt: string;
|
|
41
45
|
}
|
|
42
46
|
export declare function isPendingChange<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.defs", "pendingChange">;
|
|
43
47
|
export declare function validatePendingChange<V>(v: V): ValidationResult<PendingChange & V>;
|
|
44
|
-
/**
|
|
48
|
+
/** Another account of the caller's person: the two are linked (identity.manageMethods moveMethod), every DID of the person naming every other in `alsoKnownAs`. Linked accounts have no primary, and a link is always mutual: identity.listMethods sends `mutual` as true. */
|
|
45
49
|
export interface LinkView {
|
|
46
50
|
$type?: 'pub.techne.draft.identity.defs#linkView';
|
|
47
51
|
/** The other account. */
|
|
48
52
|
did: string;
|
|
49
53
|
handle?: string;
|
|
50
|
-
|
|
51
|
-
/** Both accounts hold a matching pub.techne.draft.accountLink; a link counts only when true. */
|
|
54
|
+
/** Retired: a link is always mutual, and identity.listMethods sends `true` (it was: both accounts hold a matching pub.techne.draft.accountLink). */
|
|
52
55
|
mutual: boolean;
|
|
56
|
+
/** When the two accounts became one person. */
|
|
57
|
+
since?: string;
|
|
53
58
|
}
|
|
54
59
|
export declare function isLinkView<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.defs", "linkView">;
|
|
55
60
|
export declare function validateLinkView<V>(v: V): ValidationResult<LinkView & V>;
|
|
61
|
+
/** Another account of an account's person (identity.manageMethods `list` and moveMethod). */
|
|
62
|
+
export interface PersonMember {
|
|
63
|
+
$type?: 'pub.techne.draft.identity.defs#personMember';
|
|
64
|
+
did: string;
|
|
65
|
+
/** When it joined the person. Sent by `list`. */
|
|
66
|
+
since?: string;
|
|
67
|
+
/** Its handle, when the platform knows one. Sent in addChannel's `otherPerson`. */
|
|
68
|
+
handle?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare function isPersonMember<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.defs", "personMember">;
|
|
71
|
+
export declare function validatePersonMember<V>(v: V): ValidationResult<PersonMember & V>;
|
|
56
72
|
/** A link token as its owner sees it, without the token. */
|
|
57
73
|
export interface LinkTokenView {
|
|
58
74
|
$type?: 'pub.techne.draft.identity.defs#linkTokenView';
|
|
@@ -30,6 +30,13 @@ export function isLinkView(v) {
|
|
|
30
30
|
export function validateLinkView(v) {
|
|
31
31
|
return validate(v, id, hashLinkView);
|
|
32
32
|
}
|
|
33
|
+
const hashPersonMember = 'personMember';
|
|
34
|
+
export function isPersonMember(v) {
|
|
35
|
+
return is$typed(v, id, hashPersonMember);
|
|
36
|
+
}
|
|
37
|
+
export function validatePersonMember(v) {
|
|
38
|
+
return validate(v, id, hashPersonMember);
|
|
39
|
+
}
|
|
33
40
|
const hashLinkTokenView = 'linkTokenView';
|
|
34
41
|
export function isLinkTokenView(v) {
|
|
35
42
|
return is$typed(v, id, hashLinkTokenView);
|
|
@@ -13,6 +13,8 @@ export interface OutputSchema {
|
|
|
13
13
|
status: 'added' | 'alreadyYours' | 'boundElsewhere' | 'unavailable' | (string & {});
|
|
14
14
|
method?: PubTechneDraftIdentityDefs.MethodView;
|
|
15
15
|
offer?: Offer;
|
|
16
|
+
/** `boundElsewhere` when both accounts hold something: the account the method signs in to (no `offer`). */
|
|
17
|
+
other?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface CallOptions {
|
|
18
20
|
signal?: AbortSignal;
|
|
@@ -46,6 +48,7 @@ export declare class UpstreamFailureError extends XRPCError {
|
|
|
46
48
|
export declare function toKnownErr(e: any): any;
|
|
47
49
|
export interface Offer {
|
|
48
50
|
$type?: 'pub.techne.draft.identity.finishAddMethod#offer';
|
|
51
|
+
/** `fold`. (`link` is retired and no longer offered.) */
|
|
49
52
|
action: 'fold' | 'link' | (string & {});
|
|
50
53
|
token: string;
|
|
51
54
|
/** The account the method is bound to. */
|
|
@@ -10,8 +10,9 @@ export type QueryParams = {
|
|
|
10
10
|
export type InputSchema = undefined;
|
|
11
11
|
export interface OutputSchema {
|
|
12
12
|
methods: PubTechneDraftIdentityDefs.MethodView[];
|
|
13
|
+
/** The other accounts of the caller's person (linked with identity.manageMethods moveMethod), each with `did`, `since` and `mutual` (always true); linked accounts have no primary. Empty when it is alone. */
|
|
13
14
|
links: PubTechneDraftIdentityDefs.LinkView[];
|
|
14
|
-
/** The account's pending changes, soonest first (the account page shows them at the top, with Cancel). */
|
|
15
|
+
/** The account's pending changes, soonest first (the account page shows them at the top, with Cancel), a move of one of its methods onto another account included. */
|
|
15
16
|
pending?: PubTechneDraftIdentityDefs.PendingChange[];
|
|
16
17
|
}
|
|
17
18
|
export interface CallOptions {
|
|
@@ -8,11 +8,12 @@ import type * as PubTechneDraftIdentityFinishAddMethod from './finishAddMethod.j
|
|
|
8
8
|
export type QueryParams = {};
|
|
9
9
|
export interface InputSchema {
|
|
10
10
|
v: 1;
|
|
11
|
-
|
|
11
|
+
/** The op. `link` is retired: it answers 400 InvalidRequest; `moveMethod` links two accounts now. */
|
|
12
|
+
op: 'list' | 'signInMethods' | 'sendTo' | 'remove' | 'cancel' | 'freeze' | 'unfreeze' | 'mark' | 'unmark' | 'signOut' | 'delete' | 'addExternal' | 'newRecoveryCodes' | 'redeemCode' | 'setPrograms' | 'importBackupEmails' | 'findKey' | 'notices' | 'noticesSent' | 'dueDeletes' | 'dueDeletesDone' | 'addChannel' | 'fold' | 'link' | 'moveMethod' | 'unlink' | 'operator' | (string & {});
|
|
12
13
|
/** The signed-in account. Required for every op but `notices`, `noticesSent`, `dueDeletes` and `dueDeletesDone`. */
|
|
13
14
|
did?: string;
|
|
14
15
|
stepUp?: StepUp;
|
|
15
|
-
/** The method acted on (its `id` in `list` or `signInMethods`). */
|
|
16
|
+
/** The method acted on (its `id` in `list` or `signInMethods`). moveMethod: the method of `from` that moves onto `did`. unlink: the method of `did` handed to `other` when `other` would have none left. */
|
|
16
17
|
method?: string;
|
|
17
18
|
/** The pending change `cancel` cancels. */
|
|
18
19
|
pending?: string;
|
|
@@ -21,7 +22,7 @@ export interface InputSchema {
|
|
|
21
22
|
external?: External;
|
|
22
23
|
/** A recovery code, for `redeemCode`. */
|
|
23
24
|
code?: string;
|
|
24
|
-
/**
|
|
25
|
+
/** Unused, kept for older clients: notice ids for `noticesSent`, which confirms none. */
|
|
25
26
|
ids?: number[];
|
|
26
27
|
/** Retired, not read: a bare list has no verification dates, so the cutoff can't hold. importBackupEmails without `backupEmails` is 400 InvalidRequest. */
|
|
27
28
|
emails?: string[];
|
|
@@ -30,9 +31,14 @@ export interface InputSchema {
|
|
|
30
31
|
/** dueDeletesDone: the accounts whose PDS account was deleted. */
|
|
31
32
|
dids?: string[];
|
|
32
33
|
channel?: PubTechneDraftIdentityDefs.Channel;
|
|
33
|
-
/** fold
|
|
34
|
+
/** fold: the offer's token from addChannel. (link, retired, took one too.) */
|
|
34
35
|
token?: string;
|
|
35
|
-
/**
|
|
36
|
+
/** moveMethod: the account the method leaves. */
|
|
37
|
+
from?: string;
|
|
38
|
+
fromStepUp?: StepUp;
|
|
39
|
+
/** unlink: the account that leaves `did`'s person. */
|
|
40
|
+
other?: string;
|
|
41
|
+
/** Retired, not read: it was the retired `link` op's primary account. Linked accounts have no primary. */
|
|
36
42
|
primary?: string;
|
|
37
43
|
/** setPrograms: on or off. */
|
|
38
44
|
on?: boolean;
|
|
@@ -41,17 +47,21 @@ export interface InputSchema {
|
|
|
41
47
|
}
|
|
42
48
|
export interface OutputSchema {
|
|
43
49
|
v: 1;
|
|
44
|
-
/** `done`: it happened now. `pending`: it waits (`pending`). `deleted` / `deleting` (`delete` done now): the account is gone / its local half is gone and a sweep finishes the rest (deleteAccount's `deleted` / `pending`; a deletion that could not start answers 503 Unavailable, try again). `bound`: addExternal's key is on another account. `invalid`: redeemCode's code is wrong, used, or the set is not a recovery method or is frozen. `hasRecovery`: importBackupEmails found a recovery method on the account; nothing changed. `indexOff`: importBackupEmails can't mark anything while the identity index is off; nothing changed. `alreadyImported`: importBackupEmails ran for this account before; nothing changed. `added` / `alreadyYours` / `boundElsewhere` / `unavailable`: addChannel, as identity.finishAddMethod. `folded
|
|
50
|
+
/** `done`: it happened now. `pending`: it waits (`pending`). `deleted` / `deleting` (`delete` done now): the account is gone / its local half is gone and a sweep finishes the rest (deleteAccount's `deleted` / `pending`; a deletion that could not start answers 503 Unavailable, try again). `bound`: addExternal's key is on another account. `invalid`: redeemCode's code is wrong, used, or the set is not a recovery method or is frozen. `hasRecovery`: importBackupEmails found a recovery method on the account; nothing changed. `indexOff`: importBackupEmails can't mark anything while the identity index is off; nothing changed. `alreadyImported`: importBackupEmails ran for this account before; nothing changed. `added` / `alreadyYours` / `boundElsewhere` / `unavailable`: addChannel, as identity.finishAddMethod. `folded`: fold done. `linked`: retired (the retired `link` op's answer). moveMethod answers `pending` only, with `pending` (the change, a defs#pendingChange) and `due`. `none`: findKey's key is no method of an account the calling PDS hosts. */
|
|
45
51
|
status?: 'done' | 'pending' | 'deleted' | 'deleting' | 'bound' | 'invalid' | 'hasRecovery' | 'indexOff' | 'alreadyImported' | 'added' | 'alreadyYours' | 'boundElsewhere' | 'unavailable' | 'folded' | 'linked' | 'none' | (string & {});
|
|
46
52
|
pending?: PubTechneDraftIdentityDefs.PendingChange;
|
|
47
|
-
/**
|
|
53
|
+
/** moveMethod `pending`: when the move is due (now for one a recovery method of `from` proved, else 7 days on). The platform completes it then or after a failed try, unless it is cancelled or dropped. */
|
|
54
|
+
due?: string;
|
|
55
|
+
/** addExternal's new method id, the recovery-code set redeemCode used, or addChannel's method id when `added` or `alreadyYours` (empty while the identity index is off); findKey's method id of the key. addChannel `boundElsewhere` when both accounts hold something: the other account's method id, for `moveMethod` (identity.finishAddMethod's session answer leaves it out). */
|
|
48
56
|
method?: string;
|
|
49
57
|
/** newRecoveryCodes: the codes, shown once. */
|
|
50
58
|
codes?: string[];
|
|
59
|
+
/** list: the account's methods (`value` on emails and phones; see defs#methodView). */
|
|
51
60
|
methods?: PubTechneDraftIdentityDefs.MethodView[];
|
|
52
61
|
hasRecovery?: boolean;
|
|
62
|
+
/** Unused, kept for older clients: always empty. The platform emails every notice itself. */
|
|
53
63
|
notices?: Notice[];
|
|
54
|
-
/**
|
|
64
|
+
/** dueDeletesDone: how many were confirmed. noticesSent (unused, kept for older clients): always 0. */
|
|
55
65
|
count?: number;
|
|
56
66
|
/** signInMethods: the account's methods that can sign in now (not frozen), oldest first. */
|
|
57
67
|
signInMethods?: SignInMethod[];
|
|
@@ -63,8 +73,14 @@ export interface OutputSchema {
|
|
|
63
73
|
offer?: PubTechneDraftIdentityFinishAddMethod.Offer;
|
|
64
74
|
/** fold: the kept account. findKey: the account the key signs in to. */
|
|
65
75
|
did?: string;
|
|
76
|
+
/** addChannel `boundElsewhere` when both accounts hold something: the account the channel signs in to (for `moveMethod`'s `from`). */
|
|
77
|
+
other?: string;
|
|
78
|
+
/** addChannel `boundElsewhere` (either form): the other accounts of the person of the account the channel signs in to, now (`did`, `handle` when known), that account itself left out; empty when it is alone. */
|
|
79
|
+
otherPerson?: PubTechneDraftIdentityDefs.PersonMember[];
|
|
66
80
|
/** fold: the account folded in and deleted. */
|
|
67
81
|
emptied?: string;
|
|
82
|
+
/** list: the other accounts of `did`'s person (empty when it is alone). moveMethod no longer answers `done`, which carried the person's accounts here. */
|
|
83
|
+
person?: PubTechneDraftIdentityDefs.PersonMember[];
|
|
68
84
|
link?: PubTechneDraftIdentityDefs.LinkView;
|
|
69
85
|
/** findKey: the key's method is frozen now and can't sign in. */
|
|
70
86
|
frozen?: boolean;
|
|
@@ -141,6 +157,30 @@ export declare class ProgramsOnError extends XRPCError {
|
|
|
141
157
|
export declare class IsRecoveryError extends XRPCError {
|
|
142
158
|
constructor(src: XRPCError);
|
|
143
159
|
}
|
|
160
|
+
export declare class FromStepUpRequiredError extends XRPCError {
|
|
161
|
+
constructor(src: XRPCError);
|
|
162
|
+
}
|
|
163
|
+
export declare class FrozenError extends XRPCError {
|
|
164
|
+
constructor(src: XRPCError);
|
|
165
|
+
}
|
|
166
|
+
export declare class PendingChangeError extends XRPCError {
|
|
167
|
+
constructor(src: XRPCError);
|
|
168
|
+
}
|
|
169
|
+
export declare class TooManyError extends XRPCError {
|
|
170
|
+
constructor(src: XRPCError);
|
|
171
|
+
}
|
|
172
|
+
export declare class SameError extends XRPCError {
|
|
173
|
+
constructor(src: XRPCError);
|
|
174
|
+
}
|
|
175
|
+
export declare class NoKeyError extends XRPCError {
|
|
176
|
+
constructor(src: XRPCError);
|
|
177
|
+
}
|
|
178
|
+
export declare class NeedsMethodError extends XRPCError {
|
|
179
|
+
constructor(src: XRPCError);
|
|
180
|
+
}
|
|
181
|
+
export declare class NotLinkedError extends XRPCError {
|
|
182
|
+
constructor(src: XRPCError);
|
|
183
|
+
}
|
|
144
184
|
export declare function toKnownErr(e: any): any;
|
|
145
185
|
/** What the PDS's step-up proved. */
|
|
146
186
|
export interface StepUp {
|
|
@@ -159,12 +199,13 @@ export interface External {
|
|
|
159
199
|
}
|
|
160
200
|
export declare function isExternal<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.manageMethods", "external">;
|
|
161
201
|
export declare function validateExternal<V>(v: V): ValidationResult<External & V>;
|
|
202
|
+
/** Unused, kept for older clients: `notices` always answers an empty list. The platform emails every notice itself, to the account's email methods only. */
|
|
162
203
|
export interface Notice {
|
|
163
204
|
$type?: 'pub.techne.draft.identity.manageMethods#notice';
|
|
164
205
|
id: number;
|
|
165
206
|
did: string;
|
|
166
|
-
/** What the notice is about: a change that started to wait (`removeMethod`, `deleteAccount`, `markRecovery`), a `freeze`, `waitDropped`: the change in `pending` was not completed because one of the account's methods was frozen during its wait,
|
|
167
|
-
event: 'removeMethod' | 'deleteAccount' | 'markRecovery' | 'freeze' | 'waitDropped' | 'programsOn' | (string & {});
|
|
207
|
+
/** What the notice is about: a change that started to wait (`removeMethod`, `deleteAccount`, `markRecovery`, `moveMethod`), a `freeze`, `waitDropped`: the change in `pending` was not completed because one of the account's methods was frozen during its wait, `programsOn`: programs can now sign in with one of the account's Nostr keys (`setPrograms` on; no `pending`), `linked` / `unlinked`: a link (moveMethod completed) or an unlink changed the account's person, `moveDropped` / `moveTimedOut` / `moveCancelled`: a move was dropped because a key can't be used or the identity PDS refused it for good, because it still could not be written 24 hours past due, or because something changed on one of its accounts, or `akaLeft` / `emailLeft`: an `alsoKnownAs` entry or an identity-PDS account email the platform owed removing was given up and is left. */
|
|
208
|
+
event: 'removeMethod' | 'deleteAccount' | 'markRecovery' | 'freeze' | 'waitDropped' | 'programsOn' | 'moveMethod' | 'linked' | 'unlinked' | 'moveDropped' | 'moveTimedOut' | 'moveCancelled' | 'akaLeft' | 'emailLeft' | (string & {});
|
|
168
209
|
to: NoticeTo;
|
|
169
210
|
pending?: PubTechneDraftIdentityDefs.PendingChange;
|
|
170
211
|
createdAt: string;
|
|
@@ -179,6 +220,7 @@ export interface ProvedMethod {
|
|
|
179
220
|
}
|
|
180
221
|
export declare function isProvedMethod<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.identity.manageMethods", "provedMethod">;
|
|
181
222
|
export declare function validateProvedMethod<V>(v: V): ValidationResult<ProvedMethod & V>;
|
|
223
|
+
/** An email or phone number in full: `sendTo`'s `to`. Also the shape of #notice's `to`, which is unused and kept for older clients (notices go to email methods only). */
|
|
182
224
|
export interface NoticeTo {
|
|
183
225
|
$type?: 'pub.techne.draft.identity.manageMethods#noticeTo';
|
|
184
226
|
type: 'email' | 'phone' | 'nostr' | (string & {});
|
|
@@ -101,6 +101,46 @@ export class IsRecoveryError extends XRPCError {
|
|
|
101
101
|
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
export class FromStepUpRequiredError extends XRPCError {
|
|
105
|
+
constructor(src) {
|
|
106
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export class FrozenError extends XRPCError {
|
|
110
|
+
constructor(src) {
|
|
111
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export class PendingChangeError extends XRPCError {
|
|
115
|
+
constructor(src) {
|
|
116
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export class TooManyError extends XRPCError {
|
|
120
|
+
constructor(src) {
|
|
121
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export class SameError extends XRPCError {
|
|
125
|
+
constructor(src) {
|
|
126
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export class NoKeyError extends XRPCError {
|
|
130
|
+
constructor(src) {
|
|
131
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export class NeedsMethodError extends XRPCError {
|
|
135
|
+
constructor(src) {
|
|
136
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export class NotLinkedError extends XRPCError {
|
|
140
|
+
constructor(src) {
|
|
141
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
104
144
|
export function toKnownErr(e) {
|
|
105
145
|
if (e instanceof XRPCError) {
|
|
106
146
|
if (e.error === 'BadSignature')
|
|
@@ -141,6 +181,22 @@ export function toKnownErr(e) {
|
|
|
141
181
|
return new ProgramsOnError(e);
|
|
142
182
|
if (e.error === 'IsRecovery')
|
|
143
183
|
return new IsRecoveryError(e);
|
|
184
|
+
if (e.error === 'FromStepUpRequired')
|
|
185
|
+
return new FromStepUpRequiredError(e);
|
|
186
|
+
if (e.error === 'Frozen')
|
|
187
|
+
return new FrozenError(e);
|
|
188
|
+
if (e.error === 'PendingChange')
|
|
189
|
+
return new PendingChangeError(e);
|
|
190
|
+
if (e.error === 'TooMany')
|
|
191
|
+
return new TooManyError(e);
|
|
192
|
+
if (e.error === 'Same')
|
|
193
|
+
return new SameError(e);
|
|
194
|
+
if (e.error === 'NoKey')
|
|
195
|
+
return new NoKeyError(e);
|
|
196
|
+
if (e.error === 'NeedsMethod')
|
|
197
|
+
return new NeedsMethodError(e);
|
|
198
|
+
if (e.error === 'NotLinked')
|
|
199
|
+
return new NotLinkedError(e);
|
|
144
200
|
}
|
|
145
201
|
return e;
|
|
146
202
|
}
|
|
@@ -48,9 +48,20 @@ export interface Handle {
|
|
|
48
48
|
$type?: 'pub.techne.draft.query.getRecords#handle';
|
|
49
49
|
did: string;
|
|
50
50
|
handle: string;
|
|
51
|
+
/** The other accounts linked to this one now (the same person; links are public, alsoKnownAs on both DIDs). Absent when none, and while a sign-in method of any account of the person is frozen (a freeze pauses the link). A linked account that is not active or is suspended is left out. */
|
|
52
|
+
linked?: LinkedHandle[];
|
|
51
53
|
}
|
|
52
54
|
export declare function isHandle<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.query.getRecords", "handle">;
|
|
53
55
|
export declare function validateHandle<V>(v: V): ValidationResult<Handle & V>;
|
|
56
|
+
export interface LinkedHandle {
|
|
57
|
+
$type?: 'pub.techne.draft.query.getRecords#linkedHandle';
|
|
58
|
+
did: string;
|
|
59
|
+
handle?: string;
|
|
60
|
+
/** The linked account's public profile name, when it has one. */
|
|
61
|
+
displayName?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare function isLinkedHandle<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.query.getRecords", "linkedHandle">;
|
|
64
|
+
export declare function validateLinkedHandle<V>(v: V): ValidationResult<LinkedHandle & V>;
|
|
54
65
|
export interface Resolved {
|
|
55
66
|
$type?: 'pub.techne.draft.query.getRecords#resolved';
|
|
56
67
|
/** The URI asked. */
|
|
@@ -25,6 +25,13 @@ export function isHandle(v) {
|
|
|
25
25
|
export function validateHandle(v) {
|
|
26
26
|
return validate(v, id, hashHandle);
|
|
27
27
|
}
|
|
28
|
+
const hashLinkedHandle = 'linkedHandle';
|
|
29
|
+
export function isLinkedHandle(v) {
|
|
30
|
+
return is$typed(v, id, hashLinkedHandle);
|
|
31
|
+
}
|
|
32
|
+
export function validateLinkedHandle(v) {
|
|
33
|
+
return validate(v, id, hashLinkedHandle);
|
|
34
|
+
}
|
|
28
35
|
const hashResolved = 'resolved';
|
|
29
36
|
export function isResolved(v) {
|
|
30
37
|
return is$typed(v, id, hashResolved);
|
package/dist/query/compose.d.ts
CHANGED
|
@@ -224,7 +224,7 @@ export declare class Composed {
|
|
|
224
224
|
* than the platform reads in one step, and this throws (`<who>: step <name> matched more than …`) rather than
|
|
225
225
|
* answer part of the list. */
|
|
226
226
|
whole<V = Record<string, unknown>, E extends EnvelopeField = EnvelopeField, U extends boolean = true>(step: StepRef<'list', true, E, U>, who: string): StepRecord<V, E, U>[];
|
|
227
|
-
/** A get step's answer as `getRecordsAnswer` gives it: records by URI, withheld, handles, curation, defaults.
|
|
227
|
+
/** A get step's answer as `getRecordsAnswer` gives it: records by URI, withheld, handles, linked, curation, defaults.
|
|
228
228
|
* Only a step that keeps its records' `uri`. */
|
|
229
229
|
answer<V = Record<string, unknown>, E extends EnvelopeField = EnvelopeField>(step: StepRef<'get', true, E, true>): StepAnswer<V, E>;
|
|
230
230
|
/** A step's records in the order answered, list or get: the read for a step asked `uri: false`, whose records
|
package/dist/query/compose.js
CHANGED
|
@@ -316,7 +316,7 @@ export class Composed {
|
|
|
316
316
|
throw new Error(`${who}: step ${step.name} matched more than ${MAX_STEP_LIMIT} records`);
|
|
317
317
|
return page.records;
|
|
318
318
|
}
|
|
319
|
-
/** A get step's answer as `getRecordsAnswer` gives it: records by URI, withheld, handles, curation, defaults.
|
|
319
|
+
/** A get step's answer as `getRecordsAnswer` gives it: records by URI, withheld, handles, linked, curation, defaults.
|
|
320
320
|
* Only a step that keeps its records' `uri`. */
|
|
321
321
|
answer(step) {
|
|
322
322
|
const s = this.#raw(step.name);
|
package/dist/query/index.d.ts
CHANGED
|
@@ -189,6 +189,10 @@ export declare function curationOf(c: unknown): Curation | undefined;
|
|
|
189
189
|
/** A handle fit to show, trimmed: `undefined` when there is none, or when it is `handle.invalid` (any case),
|
|
190
190
|
* what atproto reports for an account whose handle does not verify, which names no one. */
|
|
191
191
|
export declare function shownHandle(handle: string | null | undefined): string | undefined;
|
|
192
|
+
/** Another account of the same person as a handle entry's (Linking v2: accounts linked on the identity PDS are
|
|
193
|
+
* one person on the platform): its DID, and its public handle (never `handle.invalid`, see {@link shownHandle})
|
|
194
|
+
* and profile name when it has them. The generated `getRecords#linkedHandle`. */
|
|
195
|
+
export type LinkedAccount = Omit<GetRecords.LinkedHandle, '$type'>;
|
|
192
196
|
/** {@link getRecords}'s records, and the asked URIs moderation withheld from this caller. */
|
|
193
197
|
export interface RecordsAnswer<V = Record<string, unknown>> {
|
|
194
198
|
records: Map<string, QueryRecord<V>>;
|
|
@@ -196,6 +200,9 @@ export interface RecordsAnswer<V = Record<string, unknown>> {
|
|
|
196
200
|
/** Asked with `{ handles: true }`: each named repo's public handle, by DID (empty otherwise; never
|
|
197
201
|
* `handle.invalid`, see {@link shownHandle}). */
|
|
198
202
|
handles: Map<string, string>;
|
|
203
|
+
/** Asked with `{ handles: true }`: the other accounts of each named repo's person, by DID, from each handle
|
|
204
|
+
* entry's `linked` (only DIDs that have some; empty otherwise, and from a platform that does not send it). */
|
|
205
|
+
linked: Map<string, LinkedAccount[]>;
|
|
199
206
|
/** Asked with `{ curation: true }`, signed in: the curation status of each asked URI that is the
|
|
200
207
|
* caller's own, by URI (empty otherwise, and for anyone else's record or a private one). */
|
|
201
208
|
curation: Map<string, Curation>;
|
package/dist/query/index.js
CHANGED
|
@@ -150,6 +150,26 @@ export function shownHandle(handle) {
|
|
|
150
150
|
const h = handle?.trim();
|
|
151
151
|
return h && h.toLowerCase() !== 'handle.invalid' ? h : undefined;
|
|
152
152
|
}
|
|
153
|
+
/** A `getRecords#handle` entry's `linked` list as {@link LinkedAccount}s: malformed entries, the entry's own DID
|
|
154
|
+
* and repeats left out. */
|
|
155
|
+
function linkedAccountsOf(list, self) {
|
|
156
|
+
if (!Array.isArray(list))
|
|
157
|
+
return [];
|
|
158
|
+
const seen = new Set([self]);
|
|
159
|
+
const out = [];
|
|
160
|
+
for (const v of list) {
|
|
161
|
+
if (!v || typeof v !== 'object')
|
|
162
|
+
continue;
|
|
163
|
+
const { did, handle, displayName } = v;
|
|
164
|
+
if (typeof did !== 'string' || !did || seen.has(did))
|
|
165
|
+
continue;
|
|
166
|
+
seen.add(did);
|
|
167
|
+
const shown = typeof handle === 'string' ? shownHandle(handle) : undefined;
|
|
168
|
+
const name = typeof displayName === 'string' ? displayName.trim() : '';
|
|
169
|
+
out.push({ did, ...(shown ? { handle: shown } : {}), ...(name ? { displayName: name } : {}) });
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
153
173
|
/** The records at `uris` the viewer may read, by URI, and which of the asked URIs were withheld. With
|
|
154
174
|
* `handles`, also the public handle of each repo the URIs name; with `curation`, the curation status
|
|
155
175
|
* of each asked URI that is the signed-in caller's own (no extra read: the same call answers it).
|
|
@@ -168,15 +188,22 @@ export async function getRecordsAnswer(read, uris, opts = {}) {
|
|
|
168
188
|
/** One or more `getRecords` pages (or a composed get step's answer) as a {@link RecordsAnswer}. */
|
|
169
189
|
export function answerOf(pages) {
|
|
170
190
|
const handles = new Map();
|
|
191
|
+
const linked = new Map();
|
|
171
192
|
for (const h of pages.flatMap((p) => (Array.isArray(p.handles) ? p.handles : []))) {
|
|
172
|
-
|
|
193
|
+
if (typeof h?.did !== 'string')
|
|
194
|
+
continue;
|
|
195
|
+
const handle = typeof h.handle === 'string' ? shownHandle(h.handle) : undefined;
|
|
173
196
|
if (handle)
|
|
174
197
|
handles.set(h.did, handle);
|
|
198
|
+
const others = linkedAccountsOf(h.linked, h.did);
|
|
199
|
+
if (others.length)
|
|
200
|
+
linked.set(h.did, others);
|
|
175
201
|
}
|
|
176
202
|
return {
|
|
177
203
|
records: new Map(pages.flatMap((p) => p.records).map((r) => [r.uri, r])),
|
|
178
204
|
withheld: new Set(pages.flatMap((p) => (Array.isArray(p.withheld) ? p.withheld : []))),
|
|
179
205
|
handles,
|
|
206
|
+
linked,
|
|
180
207
|
curation: new Map(pages
|
|
181
208
|
.flatMap((p) => (Array.isArray(p.curation) ? p.curation : []))
|
|
182
209
|
.map(curationOf)
|
package/dist/versions/react.js
CHANGED
|
@@ -40,20 +40,33 @@ export function useEvent(uri, options = {}) {
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
loadRef.current = load;
|
|
42
42
|
});
|
|
43
|
+
// Reads are numbered; an answer lands only when it is newer than the last one shown (`shown`), so the
|
|
44
|
+
// newest answer wins. `reload()` does not drop a read still in flight: a caller that reloads faster than
|
|
45
|
+
// the network answers would otherwise never see one. A uri (or data mode) change raises the floor to the
|
|
46
|
+
// last read sent, so nothing read for the previous uri ever lands. That effect is declared before the
|
|
47
|
+
// read's, so on a uri change the floor is raised before the new uri's read is numbered.
|
|
48
|
+
const sent = useRef(0);
|
|
49
|
+
const shown = useRef(0);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
shown.current = sent.current;
|
|
52
|
+
}, [uri, dataMode]);
|
|
43
53
|
useEffect(() => {
|
|
44
54
|
const read = loadRef.current;
|
|
45
55
|
if (!uri || !read || dataMode)
|
|
46
56
|
return;
|
|
47
|
-
|
|
57
|
+
const seq = ++sent.current;
|
|
58
|
+
const landed = () => {
|
|
59
|
+
if (seq <= shown.current)
|
|
60
|
+
return false;
|
|
61
|
+
shown.current = seq;
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
48
64
|
read(uri).then((out) => {
|
|
49
|
-
if (!
|
|
65
|
+
if (!landed())
|
|
50
66
|
return;
|
|
51
67
|
setLoaded({ uri, out });
|
|
52
68
|
setFailed(null);
|
|
53
|
-
}, (e) =>
|
|
54
|
-
return () => {
|
|
55
|
-
live = false;
|
|
56
|
-
};
|
|
69
|
+
}, (e) => landed() && setFailed({ uri, error: e }));
|
|
57
70
|
}, [uri, dataMode, reads]);
|
|
58
71
|
const data = dataMode ? given ?? null : loaded && loaded.uri === uri ? loaded.out : null;
|
|
59
72
|
const error = !dataMode && failed && failed.uri === uri ? failed.error : null;
|