@atcute/client 3.0.0 → 3.1.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/README.md +72 -13
- package/dist/client.d.ts +181 -0
- package/dist/client.js +180 -0
- package/dist/client.js.map +1 -0
- package/dist/credential-manager.d.ts +47 -38
- package/dist/credential-manager.js +50 -41
- package/dist/credential-manager.js.map +1 -1
- package/dist/fetch-handler.d.ts +2 -2
- package/dist/fetch-handler.js +1 -1
- package/dist/fetch-handler.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lexicons.d.ts +82 -0
- package/dist/rpc.d.ts +44 -8
- package/dist/rpc.js +13 -1
- package/dist/rpc.js.map +1 -1
- package/lib/client.ts +406 -0
- package/lib/credential-manager.ts +119 -93
- package/lib/fetch-handler.ts +3 -3
- package/lib/index.ts +3 -2
- package/lib/lexicons.ts +81 -0
- package/lib/rpc.ts +44 -8
- package/package.json +2 -2
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
import { Client, ClientResponseError, isXRPCErrorPayload, ok } from './client.js';
|
|
1
2
|
import { simpleFetchHandler } from './fetch-handler.js';
|
|
2
|
-
import { XRPC, XRPCError } from './rpc.js';
|
|
3
3
|
import { getPdsEndpoint } from './utils/did.js';
|
|
4
4
|
import { decodeJwt } from './utils/jwt.js';
|
|
5
5
|
export class CredentialManager {
|
|
6
|
+
/** internal client instance for making authentication requests */
|
|
6
7
|
#server;
|
|
8
|
+
/** holds a promise for the current refresh operation, used for debouncing */
|
|
7
9
|
#refreshSessionPromise;
|
|
10
|
+
/** callback for session expiration */
|
|
8
11
|
#onExpired;
|
|
12
|
+
/** callback for successful session refresh */
|
|
9
13
|
#onRefresh;
|
|
14
|
+
/** callback for session updates */
|
|
10
15
|
#onSessionUpdate;
|
|
11
16
|
constructor({ service, onExpired, onRefresh, onSessionUpdate, fetch: _fetch = fetch, }) {
|
|
12
17
|
this.serviceUrl = service;
|
|
13
18
|
this.fetch = _fetch;
|
|
14
|
-
this.#server = new
|
|
19
|
+
this.#server = new Client({ handler: simpleFetchHandler({ service, fetch: _fetch }) });
|
|
15
20
|
this.#onRefresh = onRefresh;
|
|
16
21
|
this.#onExpired = onExpired;
|
|
17
22
|
this.#onSessionUpdate = onSessionUpdate;
|
|
18
23
|
}
|
|
24
|
+
/** service URL to make actual API requests with */
|
|
19
25
|
get dispatchUrl() {
|
|
20
26
|
return this.session?.pdsUri ?? this.serviceUrl;
|
|
21
27
|
}
|
|
@@ -38,12 +44,13 @@ export class CredentialManager {
|
|
|
38
44
|
catch {
|
|
39
45
|
return initialResponse;
|
|
40
46
|
}
|
|
41
|
-
//
|
|
42
|
-
// - refreshSession
|
|
43
|
-
// -
|
|
47
|
+
// return initial response if:
|
|
48
|
+
// - the above refreshSession failed and cleared the session
|
|
49
|
+
// - provided request body was a stream, which can't be resent once consumed
|
|
44
50
|
if (!this.session || init.body instanceof ReadableStream) {
|
|
45
51
|
return initialResponse;
|
|
46
52
|
}
|
|
53
|
+
// set the new token and retry the request
|
|
47
54
|
headers.set('authorization', `Bearer ${this.session.accessJwt}`);
|
|
48
55
|
return await (0, this.fetch)(url, { ...init, headers });
|
|
49
56
|
}
|
|
@@ -55,24 +62,21 @@ export class CredentialManager {
|
|
|
55
62
|
if (!currentSession) {
|
|
56
63
|
return;
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (err instanceof XRPCError) {
|
|
69
|
-
const kind = err.kind;
|
|
70
|
-
if (kind === 'ExpiredToken' || kind === 'InvalidToken') {
|
|
71
|
-
this.session = undefined;
|
|
72
|
-
this.#onExpired?.(currentSession);
|
|
73
|
-
}
|
|
65
|
+
const response = await this.#server.post('com.atproto.server.refreshSession', {
|
|
66
|
+
headers: {
|
|
67
|
+
authorization: `Bearer ${currentSession.refreshJwt}`,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
const error = response.data.error;
|
|
72
|
+
if (error === 'ExpiredToken' || error === 'InvalidToken') {
|
|
73
|
+
this.session = undefined;
|
|
74
|
+
this.#onExpired?.(currentSession);
|
|
74
75
|
}
|
|
76
|
+
throw new ClientResponseError(response);
|
|
75
77
|
}
|
|
78
|
+
this.#updateSession({ ...currentSession, ...response.data });
|
|
79
|
+
this.#onRefresh?.(this.session);
|
|
76
80
|
}
|
|
77
81
|
#updateSession(raw) {
|
|
78
82
|
const didDoc = raw.didDoc;
|
|
@@ -88,7 +92,7 @@ export class CredentialManager {
|
|
|
88
92
|
pdsUri: pdsUri,
|
|
89
93
|
email: raw.email,
|
|
90
94
|
emailConfirmed: raw.emailConfirmed,
|
|
91
|
-
emailAuthFactor: raw.
|
|
95
|
+
emailAuthFactor: raw.emailAuthFactor,
|
|
92
96
|
active: raw.active ?? true,
|
|
93
97
|
inactiveStatus: raw.status,
|
|
94
98
|
};
|
|
@@ -97,14 +101,14 @@ export class CredentialManager {
|
|
|
97
101
|
return newSession;
|
|
98
102
|
}
|
|
99
103
|
/**
|
|
100
|
-
*
|
|
101
|
-
* @param session
|
|
104
|
+
* resume from a persisted session
|
|
105
|
+
* @param session session data, taken from `AtpAuth#session` after login
|
|
102
106
|
*/
|
|
103
107
|
async resume(session) {
|
|
104
|
-
const now = Date.now() /
|
|
108
|
+
const now = Date.now() / 1_000 + 60 * 5;
|
|
105
109
|
const refreshToken = decodeJwt(session.refreshJwt);
|
|
106
110
|
if (now >= refreshToken.exp) {
|
|
107
|
-
throw new
|
|
111
|
+
throw new ClientResponseError({ status: 401, data: { error: 'InvalidToken' } });
|
|
108
112
|
}
|
|
109
113
|
const accessToken = decodeJwt(session.accessJwt);
|
|
110
114
|
this.session = session;
|
|
@@ -112,42 +116,43 @@ export class CredentialManager {
|
|
|
112
116
|
await this.#refreshSession();
|
|
113
117
|
}
|
|
114
118
|
else {
|
|
115
|
-
const promise = this.#server.get('com.atproto.server.getSession', {
|
|
119
|
+
const promise = ok(this.#server.get('com.atproto.server.getSession', {
|
|
116
120
|
headers: {
|
|
117
121
|
authorization: `Bearer ${session.accessJwt}`,
|
|
118
122
|
},
|
|
119
|
-
});
|
|
120
|
-
promise.then((
|
|
123
|
+
}));
|
|
124
|
+
promise.then((next) => {
|
|
121
125
|
const existing = this.session;
|
|
122
|
-
|
|
123
|
-
if (!existing) {
|
|
126
|
+
if (!existing || existing.did !== next.did) {
|
|
124
127
|
return;
|
|
125
128
|
}
|
|
126
129
|
this.#updateSession({ ...existing, ...next });
|
|
130
|
+
}, (_err) => {
|
|
131
|
+
// ignore error
|
|
127
132
|
});
|
|
128
133
|
}
|
|
129
134
|
if (!this.session) {
|
|
130
|
-
throw new
|
|
135
|
+
throw new ClientResponseError({ status: 401, data: { error: 'InvalidToken' } });
|
|
131
136
|
}
|
|
132
137
|
return this.session;
|
|
133
138
|
}
|
|
134
139
|
/**
|
|
135
|
-
*
|
|
136
|
-
* @param options
|
|
137
|
-
* @returns
|
|
140
|
+
* sign in to an account
|
|
141
|
+
* @param options credential options
|
|
142
|
+
* @returns session data
|
|
138
143
|
*/
|
|
139
144
|
async login(options) {
|
|
140
145
|
// Reset the session
|
|
141
146
|
this.session = undefined;
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const session = await ok(this.#server.post('com.atproto.server.createSession', {
|
|
148
|
+
input: {
|
|
144
149
|
identifier: options.identifier,
|
|
145
150
|
password: options.password,
|
|
146
151
|
authFactorToken: options.code,
|
|
147
152
|
allowTakendown: options.allowTakendown,
|
|
148
153
|
},
|
|
149
|
-
});
|
|
150
|
-
return this.#updateSession(
|
|
154
|
+
}));
|
|
155
|
+
return this.#updateSession(session);
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
const isExpiredTokenResponse = async (response) => {
|
|
@@ -157,14 +162,18 @@ const isExpiredTokenResponse = async (response) => {
|
|
|
157
162
|
if (extractContentType(response.headers) !== 'application/json') {
|
|
158
163
|
return false;
|
|
159
164
|
}
|
|
165
|
+
// this is nasty as it relies heavily on what the PDS returns, but avoiding
|
|
166
|
+
// cloning and reading the request as much as possible is better.
|
|
160
167
|
// {"error":"ExpiredToken","message":"Token has expired"}
|
|
161
168
|
// {"error":"ExpiredToken","message":"Token is expired"}
|
|
162
169
|
if (extractContentLength(response.headers) > 54 * 1.5) {
|
|
163
170
|
return false;
|
|
164
171
|
}
|
|
165
172
|
try {
|
|
166
|
-
const
|
|
167
|
-
|
|
173
|
+
const data = await response.clone().json();
|
|
174
|
+
if (isXRPCErrorPayload(data)) {
|
|
175
|
+
return data.error === 'ExpiredToken';
|
|
176
|
+
}
|
|
168
177
|
}
|
|
169
178
|
catch { }
|
|
170
179
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../lib/credential-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../lib/credential-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAoB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgF3C,MAAM,OAAO,iBAAiB;IAM7B,kEAAkE;IAClE,OAAO,CAAS;IAChB,6EAA6E;IAC7E,sBAAsB,CAA4B;IAElD,sCAAsC;IACtC,UAAU,CAAwC;IAClD,8CAA8C;IAC9C,UAAU,CAAwC;IAClD,mCAAmC;IACnC,gBAAgB,CAA8C;IAK9D,YAAY,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT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I,CAAC,KAAK,KAAK,cAAc,CAAC;QACtC,CAAC;IACF,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC/C,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;AAC3D,CAAC,CAAC;AACF,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
package/dist/fetch-handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** fetch handler function */
|
|
2
2
|
export type FetchHandler = (pathname: string, init: RequestInit) => Promise<Response>;
|
|
3
|
-
/**
|
|
3
|
+
/** fetch handler in an object */
|
|
4
4
|
export interface FetchHandlerObject {
|
|
5
5
|
handle(this: FetchHandlerObject, pathname: string, init: RequestInit): Promise<Response>;
|
|
6
6
|
}
|
package/dist/fetch-handler.js
CHANGED
|
@@ -7,7 +7,7 @@ export const buildFetchHandler = (handler) => {
|
|
|
7
7
|
export const simpleFetchHandler = ({ service, fetch: _fetch = fetch, }) => {
|
|
8
8
|
return async (pathname, init) => {
|
|
9
9
|
const url = new URL(pathname, service);
|
|
10
|
-
return _fetch(url, init);
|
|
10
|
+
return await _fetch(url, init);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=fetch-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-handler.js","sourceRoot":"","sources":["../lib/fetch-handler.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAA0C,EAAgB,EAAE;IAC7F,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAClC,OAAO,EACP,KAAK,EAAE,MAAM,GAAG,KAAK,GACM,EAAgB,EAAE;IAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-handler.js","sourceRoot":"","sources":["../lib/fetch-handler.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAA0C,EAAgB,EAAE;IAC7F,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAClC,OAAO,EACP,KAAK,EAAE,MAAM,GAAG,KAAK,GACM,EAAgB,EAAE;IAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,OAAO,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC"}
|
package/dist/lexicons.d.ts
CHANGED
|
@@ -292,6 +292,17 @@ export declare namespace ComAtprotoAdminUpdateAccountPassword {
|
|
|
292
292
|
}
|
|
293
293
|
type Output = undefined;
|
|
294
294
|
}
|
|
295
|
+
/** Administrative action to update an account's signing key in their Did document. */
|
|
296
|
+
export declare namespace ComAtprotoAdminUpdateAccountSigningKey {
|
|
297
|
+
interface Params {
|
|
298
|
+
}
|
|
299
|
+
interface Input {
|
|
300
|
+
did: At.Did;
|
|
301
|
+
/** Did-key formatted public key */
|
|
302
|
+
signingKey: At.Did;
|
|
303
|
+
}
|
|
304
|
+
type Output = undefined;
|
|
305
|
+
}
|
|
295
306
|
/** Update the service-specific admin status of a subject (account, record, or blob). */
|
|
296
307
|
export declare namespace ComAtprotoAdminUpdateSubjectStatus {
|
|
297
308
|
interface Params {
|
|
@@ -1270,6 +1281,9 @@ export declare namespace ComAtprotoServerUpdateEmail {
|
|
|
1270
1281
|
TokenRequired: {};
|
|
1271
1282
|
}
|
|
1272
1283
|
}
|
|
1284
|
+
export declare namespace ComAtprotoSyncDefs {
|
|
1285
|
+
type HostStatus = 'active' | 'banned' | 'idle' | 'offline' | 'throttled' | (string & {});
|
|
1286
|
+
}
|
|
1273
1287
|
/** Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. */
|
|
1274
1288
|
export declare namespace ComAtprotoSyncGetBlob {
|
|
1275
1289
|
interface Params {
|
|
@@ -1334,6 +1348,25 @@ export declare namespace ComAtprotoSyncGetHead {
|
|
|
1334
1348
|
HeadNotFound: {};
|
|
1335
1349
|
}
|
|
1336
1350
|
}
|
|
1351
|
+
/** Returns information about a specified upstream host, as consumed by the server. Implemented by relays. */
|
|
1352
|
+
export declare namespace ComAtprotoSyncGetHostStatus {
|
|
1353
|
+
interface Params {
|
|
1354
|
+
/** Hostname of the host (eg, PDS or relay) being queried. */
|
|
1355
|
+
hostname: string;
|
|
1356
|
+
}
|
|
1357
|
+
type Input = undefined;
|
|
1358
|
+
interface Output {
|
|
1359
|
+
hostname: string;
|
|
1360
|
+
/** Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. */
|
|
1361
|
+
accountCount?: number;
|
|
1362
|
+
/** Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). */
|
|
1363
|
+
seq?: number;
|
|
1364
|
+
status?: ComAtprotoSyncDefs.HostStatus;
|
|
1365
|
+
}
|
|
1366
|
+
interface Errors {
|
|
1367
|
+
HostNotFound: {};
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1337
1370
|
/** Get the current commit CID & revision of the specified repo. Does not require auth. */
|
|
1338
1371
|
export declare namespace ComAtprotoSyncGetLatestCommit {
|
|
1339
1372
|
interface Params {
|
|
@@ -1434,6 +1467,33 @@ export declare namespace ComAtprotoSyncListBlobs {
|
|
|
1434
1467
|
RepoDeactivated: {};
|
|
1435
1468
|
}
|
|
1436
1469
|
}
|
|
1470
|
+
/** Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays. */
|
|
1471
|
+
export declare namespace ComAtprotoSyncListHosts {
|
|
1472
|
+
interface Params {
|
|
1473
|
+
cursor?: string;
|
|
1474
|
+
/**
|
|
1475
|
+
* Minimum: 1 \
|
|
1476
|
+
* Maximum: 1000
|
|
1477
|
+
* @default 200
|
|
1478
|
+
*/
|
|
1479
|
+
limit?: number;
|
|
1480
|
+
}
|
|
1481
|
+
type Input = undefined;
|
|
1482
|
+
interface Output {
|
|
1483
|
+
/** Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first. */
|
|
1484
|
+
hosts: Host[];
|
|
1485
|
+
cursor?: string;
|
|
1486
|
+
}
|
|
1487
|
+
interface Host {
|
|
1488
|
+
[Brand.Type]?: 'com.atproto.sync.listHosts#host';
|
|
1489
|
+
/** hostname of server; not a URL (no scheme) */
|
|
1490
|
+
hostname: string;
|
|
1491
|
+
accountCount?: number;
|
|
1492
|
+
/** Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). */
|
|
1493
|
+
seq?: number;
|
|
1494
|
+
status?: ComAtprotoSyncDefs.HostStatus;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1437
1497
|
/** Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. */
|
|
1438
1498
|
export declare namespace ComAtprotoSyncListRepos {
|
|
1439
1499
|
interface Params {
|
|
@@ -1503,6 +1563,9 @@ export declare namespace ComAtprotoSyncRequestCrawl {
|
|
|
1503
1563
|
hostname: string;
|
|
1504
1564
|
}
|
|
1505
1565
|
type Output = undefined;
|
|
1566
|
+
interface Errors {
|
|
1567
|
+
HostBanned: {};
|
|
1568
|
+
}
|
|
1506
1569
|
}
|
|
1507
1570
|
export declare namespace ComAtprotoSyncSubscribeRepos {
|
|
1508
1571
|
/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */
|
|
@@ -1829,6 +1892,14 @@ export declare interface Queries {
|
|
|
1829
1892
|
json: ComAtprotoSyncGetHead.Output;
|
|
1830
1893
|
};
|
|
1831
1894
|
};
|
|
1895
|
+
'com.atproto.sync.getHostStatus': {
|
|
1896
|
+
params: ComAtprotoSyncGetHostStatus.Params;
|
|
1897
|
+
/** @deprecated */
|
|
1898
|
+
output: ComAtprotoSyncGetHostStatus.Output;
|
|
1899
|
+
response: {
|
|
1900
|
+
json: ComAtprotoSyncGetHostStatus.Output;
|
|
1901
|
+
};
|
|
1902
|
+
};
|
|
1832
1903
|
'com.atproto.sync.getLatestCommit': {
|
|
1833
1904
|
params: ComAtprotoSyncGetLatestCommit.Params;
|
|
1834
1905
|
/** @deprecated */
|
|
@@ -1865,6 +1936,14 @@ export declare interface Queries {
|
|
|
1865
1936
|
json: ComAtprotoSyncListBlobs.Output;
|
|
1866
1937
|
};
|
|
1867
1938
|
};
|
|
1939
|
+
'com.atproto.sync.listHosts': {
|
|
1940
|
+
params: ComAtprotoSyncListHosts.Params;
|
|
1941
|
+
/** @deprecated */
|
|
1942
|
+
output: ComAtprotoSyncListHosts.Output;
|
|
1943
|
+
response: {
|
|
1944
|
+
json: ComAtprotoSyncListHosts.Output;
|
|
1945
|
+
};
|
|
1946
|
+
};
|
|
1868
1947
|
'com.atproto.sync.listRepos': {
|
|
1869
1948
|
params: ComAtprotoSyncListRepos.Params;
|
|
1870
1949
|
/** @deprecated */
|
|
@@ -1927,6 +2006,9 @@ export declare interface Procedures {
|
|
|
1927
2006
|
'com.atproto.admin.updateAccountPassword': {
|
|
1928
2007
|
input: ComAtprotoAdminUpdateAccountPassword.Input;
|
|
1929
2008
|
};
|
|
2009
|
+
'com.atproto.admin.updateAccountSigningKey': {
|
|
2010
|
+
input: ComAtprotoAdminUpdateAccountSigningKey.Input;
|
|
2011
|
+
};
|
|
1930
2012
|
'com.atproto.admin.updateSubjectStatus': {
|
|
1931
2013
|
input: ComAtprotoAdminUpdateSubjectStatus.Input;
|
|
1932
2014
|
/** @deprecated */
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import type { At, Procedures, Queries } from './lexicons.js';
|
|
2
2
|
import { type FetchHandler, type FetchHandlerObject } from './fetch-handler.js';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
3
6
|
export type HeadersObject = Record<string, string>;
|
|
4
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Response from XRPC service
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
5
11
|
export interface XRPCResponse<T = any> {
|
|
6
12
|
data: T;
|
|
7
13
|
headers: HeadersObject;
|
|
8
14
|
}
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Options for constructing an XRPC error
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
10
19
|
export interface XRPCErrorOptions {
|
|
11
20
|
kind?: string;
|
|
12
21
|
description?: string;
|
|
13
22
|
headers?: HeadersObject;
|
|
14
23
|
cause?: unknown;
|
|
15
24
|
}
|
|
16
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Error coming from the XRPC service
|
|
27
|
+
* @deprecated
|
|
28
|
+
*/
|
|
17
29
|
export declare class XRPCError extends Error {
|
|
18
30
|
name: string;
|
|
19
31
|
/** Response status */
|
|
@@ -26,17 +38,26 @@ export declare class XRPCError extends Error {
|
|
|
26
38
|
description?: string;
|
|
27
39
|
constructor(status: number, { kind, description, headers, cause, }?: XRPCErrorOptions);
|
|
28
40
|
}
|
|
29
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Service proxy options
|
|
43
|
+
* @deprecated
|
|
44
|
+
*/
|
|
30
45
|
export interface XRPCProxyOptions {
|
|
31
46
|
type: 'atproto_pds' | 'atproto_labeler' | 'bsky_fg' | 'bsky_notif' | ({} & string);
|
|
32
47
|
service: At.Did;
|
|
33
48
|
}
|
|
34
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Options for constructing an XRPC
|
|
51
|
+
* @deprecated
|
|
52
|
+
*/
|
|
35
53
|
export interface XRPCOptions {
|
|
36
54
|
handler: FetchHandler | FetchHandlerObject;
|
|
37
55
|
proxy?: XRPCProxyOptions;
|
|
38
56
|
}
|
|
39
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* XRPC request options
|
|
59
|
+
* @deprecated
|
|
60
|
+
*/
|
|
40
61
|
export interface XRPCRequestOptions {
|
|
41
62
|
type: 'get' | 'post';
|
|
42
63
|
nsid: string;
|
|
@@ -45,7 +66,10 @@ export interface XRPCRequestOptions {
|
|
|
45
66
|
data?: FormData | Blob | ArrayBufferView | Record<string, unknown>;
|
|
46
67
|
signal?: AbortSignal;
|
|
47
68
|
}
|
|
48
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* XRPC response
|
|
71
|
+
* @deprecated
|
|
72
|
+
*/
|
|
49
73
|
export interface XRPCResponse<T = any> {
|
|
50
74
|
data: T;
|
|
51
75
|
headers: HeadersObject;
|
|
@@ -57,7 +81,10 @@ interface BaseRPCOptions {
|
|
|
57
81
|
/** Signal for aborting the request */
|
|
58
82
|
signal?: AbortSignal;
|
|
59
83
|
}
|
|
60
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Options for the query/procedure request
|
|
86
|
+
* @deprecated
|
|
87
|
+
*/
|
|
61
88
|
export type RPCOptions<T> = BaseRPCOptions & (T extends {
|
|
62
89
|
params: any;
|
|
63
90
|
} ? {
|
|
@@ -70,6 +97,9 @@ export type RPCOptions<T> = BaseRPCOptions & (T extends {
|
|
|
70
97
|
type OutputOf<T> = T extends {
|
|
71
98
|
output: any;
|
|
72
99
|
} ? T['output'] : never;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated
|
|
102
|
+
*/
|
|
73
103
|
export declare class XRPC {
|
|
74
104
|
handle: FetchHandler;
|
|
75
105
|
proxy: XRPCProxyOptions | undefined;
|
|
@@ -91,6 +121,12 @@ export declare class XRPC {
|
|
|
91
121
|
/** Makes a request to the XRPC service */
|
|
92
122
|
request(options: XRPCRequestOptions): Promise<XRPCResponse>;
|
|
93
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated
|
|
126
|
+
*/
|
|
94
127
|
export declare const clone: (rpc: XRPC) => XRPC;
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated
|
|
130
|
+
*/
|
|
95
131
|
export declare const withProxy: (rpc: XRPC, options: XRPCProxyOptions) => XRPC;
|
|
96
132
|
export {};
|
package/dist/rpc.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { buildFetchHandler } from './fetch-handler.js';
|
|
2
2
|
import { mergeHeaders } from './utils/http.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Error coming from the XRPC service
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
4
7
|
export class XRPCError extends Error {
|
|
5
8
|
constructor(status, { kind = `HTTP error ${status}`, description = `Unspecified error description`, headers, cause, } = {}) {
|
|
6
9
|
super(`${kind} > ${description}`, { cause });
|
|
@@ -11,6 +14,9 @@ export class XRPCError extends Error {
|
|
|
11
14
|
this.headers = headers || {};
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
14
20
|
export class XRPC {
|
|
15
21
|
constructor({ handler, proxy }) {
|
|
16
22
|
this.handle = buildFetchHandler(handler);
|
|
@@ -132,9 +138,15 @@ const isErrorResponse = (value) => {
|
|
|
132
138
|
return ((kindType === 'undefined' || kindType === 'string') &&
|
|
133
139
|
(messageType === 'undefined' || messageType === 'string'));
|
|
134
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated
|
|
143
|
+
*/
|
|
135
144
|
export const clone = (rpc) => {
|
|
136
145
|
return new XRPC({ handler: rpc.handle, proxy: rpc.proxy });
|
|
137
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated
|
|
149
|
+
*/
|
|
138
150
|
export const withProxy = (rpc, options) => {
|
|
139
151
|
return new XRPC({ handler: rpc.handle, proxy: options });
|
|
140
152
|
};
|
package/dist/rpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../lib/rpc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources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