@atproto/api 0.12.22-next.0 → 0.12.22

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atproto/api
2
2
 
3
+ ## 0.12.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2553](https://github.com/bluesky-social/atproto/pull/2553) [`af7d3912a`](https://github.com/bluesky-social/atproto/commit/af7d3912a3b304a752ed72947eaa8cf28b35ec02) Thanks [@devinivy](https://github.com/devinivy)! - Support for starter packs (app.bsky.graph.starterpack)
8
+
3
9
  ## 0.12.21
4
10
 
5
11
  ### Patch Changes
@@ -7735,7 +7735,7 @@ exports.schemaDict = {
7735
7735
  main: {
7736
7736
  type: 'record',
7737
7737
  description: 'Record defining a starter pack of actors and feeds for new users.',
7738
- key: 'any',
7738
+ key: 'tid',
7739
7739
  record: {
7740
7740
  type: 'object',
7741
7741
  required: ['name', 'list', 'createdAt'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/api",
3
- "version": "0.12.22-next.0",
3
+ "version": "0.12.22",
4
4
  "license": "MIT",
5
5
  "description": "Client library for atproto and Bluesky",
6
6
  "keywords": [
@@ -19,10 +19,10 @@
19
19
  "dependencies": {
20
20
  "multiformats": "^9.9.0",
21
21
  "tlds": "^1.234.0",
22
+ "@atproto/common-web": "^0.3.0",
22
23
  "@atproto/lexicon": "^0.4.0",
23
24
  "@atproto/syntax": "^0.3.0",
24
- "@atproto/xrpc": "^0.5.0",
25
- "@atproto/common-web": "^0.3.0"
25
+ "@atproto/xrpc": "^0.5.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "get-port": "^6.1.2",
@@ -7977,7 +7977,7 @@ export const schemaDict = {
7977
7977
  type: 'record',
7978
7978
  description:
7979
7979
  'Record defining a starter pack of actors and feeds for new users.',
7980
- key: 'any',
7980
+ key: 'tid',
7981
7981
  record: {
7982
7982
  type: 'object',
7983
7983
  required: ['name', 'list', 'createdAt'],
@@ -1,82 +0,0 @@
1
- import { ComAtprotoServerCreateAccount, ComAtprotoServerCreateSession, ComAtprotoServerGetSession } from '../client';
2
- import { AtpAgentLoginOpts, AtpPersistSessionHandler, AtpSessionData } from '../types';
3
- import { SessionManager } from './session-manager';
4
- export interface AtpSessionManagerOptions {
5
- service: string | URL;
6
- persistSession?: AtpPersistSessionHandler;
7
- fetch?: typeof globalThis.fetch;
8
- }
9
- /**
10
- * A {@link SessionManager} that uses legacy "com.atproto.server" endpoints to
11
- * manage sessions and route XRPC requests.
12
- */
13
- export declare class AtpSessionManager extends SessionManager {
14
- serviceUrl: URL;
15
- pdsUrl?: URL;
16
- session?: AtpSessionData;
17
- private fetch;
18
- private persistSession?;
19
- private refreshSessionPromise;
20
- private client;
21
- constructor(options: AtpSessionManagerOptions);
22
- getServiceUrl(): URL;
23
- getDispatchUrl(): URL;
24
- /**
25
- * fetch method that will be triggered by the ApiClient. This method will:
26
- * - Set the proper origin for the request (pds or service)
27
- * - Add the proper auth headers to the request
28
- * - Handle session refreshes
29
- *
30
- * @note We define this as a method on the prototype instead of inlining the
31
- * function in the constructor for readability.
32
- */
33
- fetchHandler(url: string, reqInit: RequestInit): Promise<Response>;
34
- get did(): string | undefined;
35
- /**
36
- * Is there any active session?
37
- */
38
- get hasSession(): boolean;
39
- /**
40
- * Sets a WhatWG "fetch()" function to be used for making HTTP requests.
41
- */
42
- setFetch(fetch?: typeof globalThis.fetch): void;
43
- /**
44
- * Sets the "Persist Session" method which can be used to store access tokens
45
- * as they change.
46
- */
47
- setPersistSessionHandler(handler?: AtpPersistSessionHandler): void;
48
- /**
49
- * Create a new account and hydrate its session in this agent.
50
- */
51
- createAccount(opts: ComAtprotoServerCreateAccount.InputSchema): Promise<ComAtprotoServerCreateAccount.Response>;
52
- /**
53
- * Start a new session with this agent.
54
- */
55
- login(opts: AtpAgentLoginOpts): Promise<ComAtprotoServerCreateSession.Response>;
56
- /**
57
- * Resume a pre-existing session with this agent.
58
- */
59
- resumeSession(session: AtpSessionData): Promise<ComAtprotoServerGetSession.Response>;
60
- /**
61
- * Internal helper to refresh sessions
62
- * - Wraps the actual implementation in a promise-guard to ensure only
63
- * one refresh is attempted at a time.
64
- */
65
- refreshSession(): Promise<void>;
66
- /**
67
- * Internal helper to refresh sessions (actual behavior)
68
- */
69
- _refreshSessionInner(): Promise<void>;
70
- /**
71
- * Helper to update the pds endpoint dynamically.
72
- *
73
- * The session methods (create, resume, refresh) may respond with the user's
74
- * did document which contains the user's canonical PDS endpoint. That endpoint
75
- * may differ from the endpoint used to contact the server. We capture that
76
- * PDS endpoint and update the client to use that given endpoint for future
77
- * requests. (This helps ensure smooth migrations between PDSes, especially
78
- * when the PDSes are operated by a single org.)
79
- */
80
- private _updateApiEndpoint;
81
- }
82
- //# sourceMappingURL=atp-session-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atp-session-manager.d.ts","sourceRoot":"","sources":["../../src/session/atp-session-manager.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACf,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAMlD,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;IACrB,cAAc,CAAC,EAAE,wBAAwB,CAAA;IACzC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;IAC5C,UAAU,EAAE,GAAG,CAAA;IACf,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,cAAc,CAAA;IAE/B,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,cAAc,CAAC,CAA0B;IAEjD,OAAO,CAAC,qBAAqB,CAA2B;IAIxD,OAAO,CAAC,MAAM,CAYZ;gBAEU,OAAO,EAAE,wBAAwB;IAS7C,aAAa;IAIb,cAAc;IAId;;;;;;;;OAQG;IACG,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiExE,IAAI,GAAG,uBAEN;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED;;OAEG;IACH,QAAQ,CAAC,KAAK,0BAAmB;IAIjC;;;OAGG;IACH,wBAAwB,CAAC,OAAO,CAAC,EAAE,wBAAwB;IAI3D;;OAEG;IACG,aAAa,CACjB,IAAI,EAAE,6BAA6B,CAAC,WAAW,GAC9C,OAAO,CAAC,6BAA6B,CAAC,QAAQ,CAAC;IA2BlD;;OAEG;IACG,KAAK,CACT,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,6BAA6B,CAAC,QAAQ,CAAC;IAgClD;;OAEG;IACG,aAAa,CACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,0BAA0B,CAAC,QAAQ,CAAC;IAkD/C;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrC;;OAEG;IACG,oBAAoB;IAoC1B;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;CAS3B"}
@@ -1,370 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AtpSessionManager = void 0;
4
- const common_web_1 = require("@atproto/common-web");
5
- const xrpc_1 = require("@atproto/xrpc");
6
- const client_1 = require("../client");
7
- const session_manager_1 = require("./session-manager");
8
- const ReadableStream = globalThis.ReadableStream;
9
- /**
10
- * A {@link SessionManager} that uses legacy "com.atproto.server" endpoints to
11
- * manage sessions and route XRPC requests.
12
- */
13
- class AtpSessionManager extends session_manager_1.SessionManager {
14
- constructor(options) {
15
- super();
16
- Object.defineProperty(this, "serviceUrl", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: void 0
21
- });
22
- Object.defineProperty(this, "pdsUrl", {
23
- enumerable: true,
24
- configurable: true,
25
- writable: true,
26
- value: void 0
27
- }); // The PDS URL, driven by the did doc
28
- Object.defineProperty(this, "session", {
29
- enumerable: true,
30
- configurable: true,
31
- writable: true,
32
- value: void 0
33
- });
34
- Object.defineProperty(this, "fetch", {
35
- enumerable: true,
36
- configurable: true,
37
- writable: true,
38
- value: void 0
39
- });
40
- Object.defineProperty(this, "persistSession", {
41
- enumerable: true,
42
- configurable: true,
43
- writable: true,
44
- value: void 0
45
- });
46
- Object.defineProperty(this, "refreshSessionPromise", {
47
- enumerable: true,
48
- configurable: true,
49
- writable: true,
50
- value: void 0
51
- });
52
- // Private API client used to perform session management API calls on the
53
- // service endpoint.
54
- Object.defineProperty(this, "client", {
55
- enumerable: true,
56
- configurable: true,
57
- writable: true,
58
- value: new client_1.AtpClient({
59
- fetch: async (...args) => {
60
- // Note: we use a wrapping function here to make sure the value used is in
61
- // sync with the current state of the session manager (see
62
- // this.setFetch())
63
- return (0, this.fetch)(...args);
64
- },
65
- service: () => this.serviceUrl,
66
- headers: {
67
- authorization: () => this.session?.accessJwt ? `Bearer ${this.session.accessJwt}` : null,
68
- },
69
- })
70
- });
71
- this.fetch = options.fetch || globalThis.fetch;
72
- this.serviceUrl = new URL(options.service);
73
- this.setPersistSessionHandler(options.persistSession);
74
- }
75
- getServiceUrl() {
76
- return this.serviceUrl;
77
- }
78
- getDispatchUrl() {
79
- return this.pdsUrl || this.serviceUrl;
80
- }
81
- /**
82
- * fetch method that will be triggered by the ApiClient. This method will:
83
- * - Set the proper origin for the request (pds or service)
84
- * - Add the proper auth headers to the request
85
- * - Handle session refreshes
86
- *
87
- * @note We define this as a method on the prototype instead of inlining the
88
- * function in the constructor for readability.
89
- */
90
- async fetchHandler(url, reqInit) {
91
- // wait for any active session-refreshes to finish
92
- await this.refreshSessionPromise;
93
- const initialUri = new URL(url, this.getDispatchUrl());
94
- const initialReq = new Request(initialUri, reqInit);
95
- const initialToken = this.session?.accessJwt;
96
- if (!initialToken || initialReq.headers.has('authorization')) {
97
- return (0, this.fetch)(initialReq);
98
- }
99
- initialReq.headers.set('authorization', `Bearer ${initialToken}`);
100
- const initialRes = await (0, this.fetch)(initialReq);
101
- if (!this.session?.refreshJwt) {
102
- return initialRes;
103
- }
104
- const isExpiredToken = await isErrorResponse(initialRes, [400], ['ExpiredToken']);
105
- if (!isExpiredToken) {
106
- return initialRes;
107
- }
108
- try {
109
- await this.refreshSession();
110
- }
111
- catch {
112
- return initialRes;
113
- }
114
- if (reqInit?.signal?.aborted) {
115
- return initialRes;
116
- }
117
- // The stream was already consumed. We cannot retry the request. A solution
118
- // would be to tee() the input stream but that would bufferize the entire
119
- // stream in memory which can lead to memory starvation. Instead, we will
120
- // return the original response and let the calling code handle retries.
121
- if (ReadableStream && reqInit.body instanceof ReadableStream) {
122
- return initialRes;
123
- }
124
- // Return initial "ExpiredToken" response if the session was not refreshed.
125
- const updatedToken = this.session?.accessJwt;
126
- if (!updatedToken || updatedToken === initialToken) {
127
- return initialRes;
128
- }
129
- // Make sure the initial request is cancelled to avoid leaking resources
130
- // (NodeJS 👀): https://undici.nodejs.org/#/?id=garbage-collection
131
- await initialRes.body?.cancel();
132
- // We need to re-compute the URI in case the PDS endpoint has changed
133
- const updatedUri = new URL(url, this.getDispatchUrl());
134
- const updatedReq = new Request(updatedUri, reqInit);
135
- updatedReq.headers.set('authorization', `Bearer ${updatedToken}`);
136
- return await (0, this.fetch)(updatedReq);
137
- }
138
- get did() {
139
- return this.session?.did;
140
- }
141
- /**
142
- * Is there any active session?
143
- */
144
- get hasSession() {
145
- return !!this.session;
146
- }
147
- /**
148
- * Sets a WhatWG "fetch()" function to be used for making HTTP requests.
149
- */
150
- setFetch(fetch = globalThis.fetch) {
151
- this.fetch = fetch;
152
- }
153
- /**
154
- * Sets the "Persist Session" method which can be used to store access tokens
155
- * as they change.
156
- */
157
- setPersistSessionHandler(handler) {
158
- this.persistSession = handler?.bind(null);
159
- }
160
- /**
161
- * Create a new account and hydrate its session in this agent.
162
- */
163
- async createAccount(opts) {
164
- try {
165
- const res = await this.client.com.atproto.server.createAccount(opts);
166
- this.session = {
167
- accessJwt: res.data.accessJwt,
168
- refreshJwt: res.data.refreshJwt,
169
- handle: res.data.handle,
170
- did: res.data.did,
171
- email: opts.email,
172
- emailConfirmed: false,
173
- emailAuthFactor: false,
174
- active: true,
175
- };
176
- this._updateApiEndpoint(res.data.didDoc);
177
- return res;
178
- }
179
- catch (e) {
180
- this.session = undefined;
181
- throw e;
182
- }
183
- finally {
184
- if (this.session) {
185
- this.persistSession?.('create', this.session);
186
- }
187
- else {
188
- this.persistSession?.('create-failed', undefined);
189
- }
190
- }
191
- }
192
- /**
193
- * Start a new session with this agent.
194
- */
195
- async login(opts) {
196
- try {
197
- const res = await this.client.com.atproto.server.createSession({
198
- identifier: opts.identifier,
199
- password: opts.password,
200
- authFactorToken: opts.authFactorToken,
201
- });
202
- this.session = {
203
- accessJwt: res.data.accessJwt,
204
- refreshJwt: res.data.refreshJwt,
205
- handle: res.data.handle,
206
- did: res.data.did,
207
- email: res.data.email,
208
- emailConfirmed: res.data.emailConfirmed,
209
- emailAuthFactor: res.data.emailAuthFactor,
210
- active: res.data.active ?? true,
211
- status: res.data.status,
212
- };
213
- this._updateApiEndpoint(res.data.didDoc);
214
- return res;
215
- }
216
- catch (e) {
217
- this.session = undefined;
218
- throw e;
219
- }
220
- finally {
221
- if (this.session) {
222
- this.persistSession?.('create', this.session);
223
- }
224
- else {
225
- this.persistSession?.('create-failed', undefined);
226
- }
227
- }
228
- }
229
- /**
230
- * Resume a pre-existing session with this agent.
231
- */
232
- async resumeSession(session) {
233
- try {
234
- this.session = session;
235
- // For this particular call, we want this.fetchHandler() to be used in
236
- // order to refresh the session if needed. So let's create a new client
237
- // instance with the right fetchHandler instead of using this.client.
238
- const res = await new client_1.AtpClient(this.fetchHandler).com.atproto.server.getSession();
239
- if (res.data.did !== this.session.did) {
240
- throw new xrpc_1.XRPCError(xrpc_1.ResponseType.InvalidRequest, 'Invalid session', 'InvalidDID');
241
- }
242
- this.session.email = res.data.email;
243
- this.session.handle = res.data.handle;
244
- this.session.emailConfirmed = res.data.emailConfirmed;
245
- this.session.emailAuthFactor = res.data.emailAuthFactor;
246
- this.session.active = res.data.active ?? true;
247
- this.session.status = res.data.status;
248
- this._updateApiEndpoint(res.data.didDoc);
249
- this.persistSession?.('update', this.session);
250
- return res;
251
- }
252
- catch (e) {
253
- this.session = undefined;
254
- if (e instanceof xrpc_1.XRPCError) {
255
- /*
256
- * `ExpiredToken` and `InvalidToken` are handled in
257
- * `this_refreshSession`, and emit an `expired` event there.
258
- *
259
- * Everything else is handled here.
260
- */
261
- if ([1, 408, 425, 429, 500, 502, 503, 504, 522, 524].includes(e.status)) {
262
- this.persistSession?.('network-error', undefined);
263
- }
264
- else {
265
- this.persistSession?.('expired', undefined);
266
- }
267
- }
268
- else {
269
- this.persistSession?.('network-error', undefined);
270
- }
271
- throw e;
272
- }
273
- }
274
- /**
275
- * Internal helper to refresh sessions
276
- * - Wraps the actual implementation in a promise-guard to ensure only
277
- * one refresh is attempted at a time.
278
- */
279
- async refreshSession() {
280
- return (this.refreshSessionPromise || (this.refreshSessionPromise = this._refreshSessionInner().finally(() => {
281
- this.refreshSessionPromise = undefined;
282
- })));
283
- }
284
- /**
285
- * Internal helper to refresh sessions (actual behavior)
286
- */
287
- async _refreshSessionInner() {
288
- if (!this.session?.refreshJwt) {
289
- return;
290
- }
291
- try {
292
- const res = await this.client.com.atproto.server.refreshSession(undefined, { headers: { authorization: `Bearer ${this.session.refreshJwt}` } });
293
- // succeeded, update the session
294
- this.session = {
295
- ...this.session,
296
- accessJwt: res.data.accessJwt,
297
- refreshJwt: res.data.refreshJwt,
298
- handle: res.data.handle,
299
- did: res.data.did,
300
- };
301
- this._updateApiEndpoint(res.data.didDoc);
302
- this.persistSession?.('update', this.session);
303
- }
304
- catch (err) {
305
- if (err instanceof xrpc_1.XRPCError &&
306
- err.error &&
307
- ['ExpiredToken', 'InvalidToken'].includes(err.error)) {
308
- // failed due to a bad refresh token
309
- this.session = undefined;
310
- this.persistSession?.('expired', undefined);
311
- }
312
- // else: other failures should be ignored - the issue will
313
- // propagate in the _dispatch() second attempt to run
314
- // the request
315
- }
316
- }
317
- /**
318
- * Helper to update the pds endpoint dynamically.
319
- *
320
- * The session methods (create, resume, refresh) may respond with the user's
321
- * did document which contains the user's canonical PDS endpoint. That endpoint
322
- * may differ from the endpoint used to contact the server. We capture that
323
- * PDS endpoint and update the client to use that given endpoint for future
324
- * requests. (This helps ensure smooth migrations between PDSes, especially
325
- * when the PDSes are operated by a single org.)
326
- */
327
- _updateApiEndpoint(didDoc) {
328
- if ((0, common_web_1.isValidDidDoc)(didDoc)) {
329
- const endpoint = (0, common_web_1.getPdsEndpoint)(didDoc);
330
- this.pdsUrl = endpoint ? new URL(endpoint) : undefined;
331
- }
332
- else {
333
- // If the did doc is invalid, we clear the pdsUrl (should never happen)
334
- this.pdsUrl = undefined;
335
- }
336
- }
337
- }
338
- exports.AtpSessionManager = AtpSessionManager;
339
- function isErrorObject(v) {
340
- return xrpc_1.errorResponseBody.safeParse(v).success;
341
- }
342
- async function isErrorResponse(response, status, errorNames) {
343
- if (!status.includes(response.status))
344
- return false;
345
- // Some engines (react-native 👀) don't expose a response.body property...
346
- // if (!response.body) return false
347
- try {
348
- const json = await peekJson(response, 10 * 1024);
349
- return isErrorObject(json) && errorNames.includes(json.error);
350
- }
351
- catch (err) {
352
- return false;
353
- }
354
- }
355
- async function peekJson(response, maxSize = Infinity) {
356
- if (extractType(response) !== 'application/json')
357
- throw new Error('Not JSON');
358
- if (extractLength(response) > maxSize)
359
- throw new Error('Response too large');
360
- return response.clone().json();
361
- }
362
- function extractLength({ headers }) {
363
- return headers.get('Content-Length')
364
- ? Number(headers.get('Content-Length'))
365
- : NaN;
366
- }
367
- function extractType({ headers }) {
368
- return headers.get('Content-Type')?.split(';')[0]?.trim();
369
- }
370
- //# sourceMappingURL=atp-session-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atp-session-manager.js","sourceRoot":"","sources":["../../src/session/atp-session-manager.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AACnE,wCAKsB;AACtB,sCAKkB;AAMlB,uDAAkD;AAElD,MAAM,cAAc,GAAG,UAAU,CAAC,cAErB,CAAA;AAQb;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,gCAAc;IA0BnD,YAAY,OAAiC;QAC3C,KAAK,EAAE,CAAA;QA1BF;;;;;WAAe;QACf;;;;;WAAY,CAAC,qCAAqC;QAClD;;;;;WAAwB;QAEvB;;;;;WAA8B;QAC9B;;;;;WAAyC;QAEzC;;;;;WAAgD;QAExD,yEAAyE;QACzE,oBAAoB;QACZ;;;;mBAAS,IAAI,kBAAS,CAAC;gBAC7B,KAAK,EAAE,KAAK,EAAE,GAAG,IAAyC,EAAE,EAAE;oBAC5D,0EAA0E;oBAC1E,0DAA0D;oBAC1D,mBAAmB;oBACnB,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;gBACjC,CAAC;gBACD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU;gBAC9B,OAAO,EAAE;oBACP,aAAa,EAAE,GAAG,EAAE,CAClB,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI;iBACtE;aACF,CAAC;WAAA;QAKA,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;QAE9C,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC1C,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,cA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-handler';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./session-manager"), exports);
18
- __exportStar(require("./atp-session-manager"), exports);
19
- __exportStar(require("./stateless-session-handler"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,wDAAqC;AACrC,8DAA2C"}
@@ -1,10 +0,0 @@
1
- import { OAuthAgent } from '@atproto/oauth-client';
2
- import { SessionManager } from './session-manager';
3
- export declare class OAuthSessionManager extends SessionManager {
4
- readonly agent: OAuthAgent;
5
- constructor(agent: OAuthAgent);
6
- fetchHandler(url: string, init: RequestInit): Promise<Response>;
7
- getServiceUrl(): Promise<URL>;
8
- get did(): string;
9
- }
10
- //# sourceMappingURL=oauth-session-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-session-manager.d.ts","sourceRoot":"","sources":["../../src/session/oauth-session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACX,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,qBAAa,mBAAoB,SAAQ,cAAc;IACzC,QAAQ,CAAC,KAAK,EAAE,UAAU;gBAAjB,KAAK,EAAE,UAAU;IAIhC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IA0B/D,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC;IAInC,IAAI,GAAG,WAEN;CACF"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAuthSessionManager = void 0;
4
- const oauth_client_1 = require("@atproto/oauth-client");
5
- const xrpc_1 = require("@atproto/xrpc");
6
- const session_manager_1 = require("./session-manager");
7
- class OAuthSessionManager extends session_manager_1.SessionManager {
8
- constructor(agent) {
9
- super();
10
- Object.defineProperty(this, "agent", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: agent
15
- });
16
- }
17
- async fetchHandler(url, init) {
18
- try {
19
- return await this.agent.request(url, init);
20
- }
21
- catch (cause) {
22
- if (cause instanceof oauth_client_1.FetchResponseError) {
23
- throw new xrpc_1.XRPCError(cause.statusCode, undefined, cause.message, Object.fromEntries(cause.response.headers.entries()), { cause });
24
- }
25
- if (cause instanceof oauth_client_1.FetchError) {
26
- throw new xrpc_1.XRPCError(cause.statusCode, undefined, cause.message, undefined, { cause });
27
- }
28
- throw cause;
29
- }
30
- }
31
- async getServiceUrl() {
32
- return new URL(this.agent.serverMetadata.issuer);
33
- }
34
- get did() {
35
- return this.agent.sub;
36
- }
37
- }
38
- exports.OAuthSessionManager = OAuthSessionManager;
39
- //# sourceMappingURL=oauth-session-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-session-manager.js","sourceRoot":"","sources":["../../src/session/oauth-session-manager.ts"],"names":[],"mappings":";;;AAAA,wDAI8B;AAC9B,wCAAyC;AACzC,uDAAkD;AAElD,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,YAAqB,KAAiB;QACpC,KAAK,EAAE,CAAA;QADG;;;;mBAAS,KAAK;WAAY;IAEtC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,IAAiB;QAC/C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,iCAAkB,EAAE,CAAC;gBACxC,MAAM,IAAI,gBAAS,CACjB,KAAK,CAAC,UAAU,EAChB,SAAS,EACT,KAAK,CAAC,OAAO,EACb,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,EACpD,EAAE,KAAK,EAAE,CACV,CAAA;YACH,CAAC;YACD,IAAI,KAAK,YAAY,yBAAU,EAAE,CAAC;gBAChC,MAAM,IAAI,gBAAS,CACjB,KAAK,CAAC,UAAU,EAChB,SAAS,EACT,KAAK,CAAC,OAAO,EACb,SAAS,EACT,EAAE,KAAK,EAAE,CACV,CAAA;YACH,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IACvB,CAAC;CACF;AAtCD,kDAsCC"}
@@ -1,7 +0,0 @@
1
- export declare abstract class SessionManager {
2
- abstract did?: string;
3
- abstract fetchHandler(url: string, reqInit: RequestInit): Promise<Response>;
4
- /** @deprecated only used for a very particular use-case in the official Bluesky app */
5
- abstract getServiceUrl(): URL | PromiseLike<URL>;
6
- }
7
- //# sourceMappingURL=session-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/session/session-manager.ts"],"names":[],"mappings":"AAAA,8BAAsB,cAAc;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAE3E,uFAAuF;IACvF,QAAQ,CAAC,aAAa,IAAI,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;CACjD"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionManager = void 0;
4
- class SessionManager {
5
- }
6
- exports.SessionManager = SessionManager;
7
- //# sourceMappingURL=session-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../src/session/session-manager.ts"],"names":[],"mappings":";;;AAAA,MAAsB,cAAc;CAOnC;AAPD,wCAOC"}
@@ -1,18 +0,0 @@
1
- import { SessionManager } from './session-manager';
2
- export type StatelessSessionManagerOptions = {
3
- service: string | URL;
4
- headers?: {
5
- [_ in string]?: null | string;
6
- };
7
- fetch?: typeof globalThis.fetch;
8
- };
9
- export declare class StatelessSessionManager extends SessionManager {
10
- private fetch;
11
- readonly serviceUrl: URL;
12
- readonly headers: Map<string, string>;
13
- constructor({ service, headers, fetch, }: StatelessSessionManagerOptions);
14
- get did(): undefined;
15
- getServiceUrl(): Promise<URL>;
16
- fetchHandler(url: string, reqInit: RequestInit): Promise<Response>;
17
- }
18
- //# sourceMappingURL=stateless-session-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stateless-session-handler.d.ts","sourceRoot":"","sources":["../../src/session/stateless-session-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM;KAAE,CAAA;IAC3C,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC,CAAA;AAED,qBAAa,uBAAwB,SAAQ,cAAc;IACzD,OAAO,CAAC,KAAK,CAAyB;IAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAEzB,EACV,OAAO,EACP,OAAO,EACP,KAAwB,GACzB,EAAE,8BAA8B;IAiBjC,IAAI,GAAG,cAEN;IAEK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC;IAI7B,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;CAUzE"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatelessSessionManager = void 0;
4
- const session_manager_1 = require("./session-manager");
5
- class StatelessSessionManager extends session_manager_1.SessionManager {
6
- constructor({ service, headers, fetch = globalThis.fetch, }) {
7
- super();
8
- Object.defineProperty(this, "fetch", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: void 0
13
- });
14
- Object.defineProperty(this, "serviceUrl", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: void 0
19
- });
20
- Object.defineProperty(this, "headers", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: void 0
25
- });
26
- this.fetch = fetch;
27
- this.serviceUrl = new URL(service);
28
- this.headers = new Map(headers
29
- ? Object.entries(headers).filter((e) => e[1] != null)
30
- : headers);
31
- }
32
- get did() {
33
- return undefined;
34
- }
35
- async getServiceUrl() {
36
- return this.serviceUrl;
37
- }
38
- async fetchHandler(url, reqInit) {
39
- const fullUrl = new URL(url, await this.getServiceUrl());
40
- const headers = new Headers(reqInit.headers);
41
- for (const [key, value] of this.headers) {
42
- if (value != null)
43
- headers.set(key, value);
44
- }
45
- return (0, this.fetch)(fullUrl.toString(), { ...reqInit, headers });
46
- }
47
- }
48
- exports.StatelessSessionManager = StatelessSessionManager;
49
- //# sourceMappingURL=stateless-session-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stateless-session-handler.js","sourceRoot":"","sources":["../../src/session/stateless-session-handler.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAQlD,MAAa,uBAAwB,SAAQ,gCAAc;IAMzD,YAAY,EACV,OAAO,EACP,OAAO,EACP,KAAK,GAAG,UAAU,CAAC,KAAK,GACO;QAC/B,KAAK,EAAE,CAAA;QAVD;;;;;WAA8B;QAE7B;;;;;WAAe;QACf;;;;;WAA4B;QASnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAA;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CACpB,OAAO;YACL,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAC5B,CACE,CAAI,EACgC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CACtD;YACH,CAAC,CAAC,OAAO,CACZ,CAAA;IACH,CAAC;IAED,IAAI,GAAG;QACL,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,OAAoB;QAClD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,MAA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