@ewanc26/atproto 0.1.0 → 0.2.1

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.
@@ -0,0 +1,3 @@
1
+ export { fetchAllRecords, fetchAllUserRecords } from './fetchAllRecords.js';
2
+ export type { FetchRecordsConfig, AtProtoRecord } from './fetchAllRecords.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pagination/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ export { fetchAllRecords, fetchAllUserRecords } from './fetchAllRecords.js';
@@ -0,0 +1,4 @@
1
+ import type { BlueskyPost } from './types.js';
2
+ export declare function fetchLatestBlueskyPost(did: string, fetchFn?: typeof fetch): Promise<BlueskyPost | null>;
3
+ export declare function fetchPostFromUri(did: string, uri: string, depth: number, fetchFn?: typeof fetch): Promise<BlueskyPost | null>;
4
+ //# sourceMappingURL=posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../src/posts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,YAAY,CAAC;AAExE,wBAAsB,sBAAsB,CAC3C,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAiD7B;AAED,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAqI7B"}
package/dist/posts.js ADDED
@@ -0,0 +1,176 @@
1
+ import { cache } from './cache.js';
2
+ import { withFallback } from './agents.js';
3
+ export async function fetchLatestBlueskyPost(did, fetchFn) {
4
+ const cacheKey = `blueskypost:latest:${did}`;
5
+ const cached = cache.get(cacheKey);
6
+ if (cached)
7
+ return cached;
8
+ try {
9
+ const feedResponse = await withFallback(did, async (agent) => agent.getAuthorFeed({ actor: did, limit: 5 }), false, fetchFn);
10
+ const feed = feedResponse.data.feed;
11
+ if (!feed.length)
12
+ return null;
13
+ const latestFeedItem = feed[0];
14
+ const latestPostData = latestFeedItem.post;
15
+ const isRepost = latestFeedItem.reason?.$type === 'app.bsky.feed.defs#reasonRepost';
16
+ let repostAuthor;
17
+ let repostCreatedAt;
18
+ if (isRepost && latestFeedItem.reason) {
19
+ const reason = latestFeedItem.reason;
20
+ repostAuthor = {
21
+ did: reason.by.did,
22
+ handle: reason.by.handle,
23
+ displayName: reason.by.displayName,
24
+ avatar: reason.by.avatar
25
+ };
26
+ repostCreatedAt = reason.indexedAt;
27
+ }
28
+ const post = await fetchPostFromUri(did, latestPostData.uri, 0, fetchFn);
29
+ if (!post)
30
+ return null;
31
+ if (isRepost) {
32
+ post.isRepost = true;
33
+ post.repostAuthor = repostAuthor;
34
+ post.repostCreatedAt = repostCreatedAt;
35
+ post.originalPost = { ...post };
36
+ }
37
+ cache.set(cacheKey, post);
38
+ return post;
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }
44
+ export async function fetchPostFromUri(did, uri, depth, fetchFn) {
45
+ if (depth >= 3)
46
+ return null;
47
+ try {
48
+ const threadResponse = await withFallback(did, async (agent) => agent.getPostThread({ uri, depth: 0 }), false, fetchFn);
49
+ if (!threadResponse.data.thread || !('post' in threadResponse.data.thread))
50
+ return null;
51
+ const postData = threadResponse.data.thread.post;
52
+ const value = postData.record;
53
+ const embed = postData.embed ?? null;
54
+ const author = {
55
+ did: postData.author.did,
56
+ handle: postData.author.handle,
57
+ displayName: postData.author.displayName,
58
+ avatar: postData.author.avatar
59
+ };
60
+ let imageUrls;
61
+ let imageAlts;
62
+ let hasImages = false;
63
+ let hasVideo = false;
64
+ let videoUrl;
65
+ let videoThumbnail;
66
+ let quotedPost;
67
+ let quotedPostUri;
68
+ let externalLink;
69
+ const facets = value.facets;
70
+ if (embed?.$type === 'app.bsky.embed.images#view' && Array.isArray(embed.images)) {
71
+ hasImages = true;
72
+ imageUrls = [];
73
+ imageAlts = [];
74
+ for (const img of embed.images) {
75
+ const imageUrl = img.fullsize || img.thumb;
76
+ if (imageUrl) {
77
+ imageUrls.push(imageUrl);
78
+ imageAlts.push(img.alt || '');
79
+ }
80
+ }
81
+ }
82
+ if (embed?.$type === 'app.bsky.embed.video#view') {
83
+ if (embed.playlist) {
84
+ hasVideo = true;
85
+ videoUrl = embed.playlist;
86
+ }
87
+ if (embed.thumbnail)
88
+ videoThumbnail = embed.thumbnail;
89
+ }
90
+ if (embed?.$type === 'app.bsky.embed.external#view' && embed.external) {
91
+ externalLink = {
92
+ uri: embed.external.uri,
93
+ title: embed.external.title,
94
+ description: embed.external.description,
95
+ thumb: embed.external.thumb
96
+ };
97
+ }
98
+ if (embed?.$type === 'app.bsky.embed.recordWithMedia#view') {
99
+ const media = embed.media;
100
+ if (media?.$type === 'app.bsky.embed.images#view' && Array.isArray(media.images)) {
101
+ hasImages = true;
102
+ imageUrls = [];
103
+ imageAlts = [];
104
+ for (const img of media.images) {
105
+ const imageUrl = img.fullsize || img.thumb;
106
+ if (imageUrl) {
107
+ imageUrls.push(imageUrl);
108
+ imageAlts.push(img.alt || '');
109
+ }
110
+ }
111
+ }
112
+ if (media?.$type === 'app.bsky.embed.video#view') {
113
+ if (media.playlist) {
114
+ hasVideo = true;
115
+ videoUrl = media.playlist;
116
+ }
117
+ if (media.thumbnail)
118
+ videoThumbnail = media.thumbnail;
119
+ }
120
+ if (media?.$type === 'app.bsky.embed.external#view' && media.external) {
121
+ externalLink = {
122
+ uri: media.external.uri,
123
+ title: media.external.title,
124
+ description: media.external.description,
125
+ thumb: media.external.thumb
126
+ };
127
+ }
128
+ const quotedRecord = embed.record?.record || embed.record;
129
+ if (quotedRecord?.uri) {
130
+ quotedPostUri = quotedRecord.uri;
131
+ quotedPost = (await fetchPostFromUri(did, quotedPostUri, depth + 1, fetchFn)) ?? undefined;
132
+ }
133
+ }
134
+ if (embed?.$type === 'app.bsky.embed.record#view') {
135
+ const quotedRecord = embed.record?.record || embed.record;
136
+ if (quotedRecord?.uri) {
137
+ quotedPostUri = quotedRecord.uri;
138
+ quotedPost = (await fetchPostFromUri(did, quotedPostUri, depth + 1, fetchFn)) ?? undefined;
139
+ }
140
+ }
141
+ let replyParent;
142
+ let replyRoot;
143
+ if (value.reply) {
144
+ if (value.reply.parent?.uri) {
145
+ replyParent = (await fetchPostFromUri(did, value.reply.parent.uri, depth + 1, fetchFn)) ?? undefined;
146
+ }
147
+ if (value.reply.root?.uri && value.reply.root.uri !== value.reply.parent?.uri) {
148
+ replyRoot = (await fetchPostFromUri(did, value.reply.root.uri, depth + 1, fetchFn)) ?? undefined;
149
+ }
150
+ }
151
+ return {
152
+ text: value.text,
153
+ createdAt: value.createdAt,
154
+ uri: postData.uri,
155
+ author,
156
+ likeCount: postData.likeCount || 0,
157
+ repostCount: postData.repostCount || 0,
158
+ replyCount: postData.replyCount,
159
+ hasImages,
160
+ imageUrls,
161
+ imageAlts,
162
+ hasVideo,
163
+ videoUrl,
164
+ videoThumbnail,
165
+ quotedPostUri,
166
+ quotedPost,
167
+ facets,
168
+ externalLink,
169
+ replyParent,
170
+ replyRoot
171
+ };
172
+ }
173
+ catch {
174
+ return null;
175
+ }
176
+ }
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Type definitions for AT Protocol services
3
+ * Identical to src/lib/services/atproto/types.ts — no SvelteKit dependencies.
4
+ */
5
+ export interface ProfileData {
6
+ did: string;
7
+ handle: string;
8
+ displayName?: string;
9
+ description?: string;
10
+ avatar?: string;
11
+ banner?: string;
12
+ followersCount?: number;
13
+ followsCount?: number;
14
+ postsCount?: number;
15
+ pronouns?: string;
16
+ }
17
+ export interface StatusData {
18
+ text: string;
19
+ createdAt: string;
20
+ }
21
+ export interface Technology {
22
+ name: string;
23
+ url?: string;
24
+ description?: string;
25
+ }
26
+ export interface License {
27
+ name: string;
28
+ url?: string;
29
+ }
30
+ export interface BasedOnItem {
31
+ section?: string;
32
+ name?: string;
33
+ url?: string;
34
+ description?: string;
35
+ type?: string;
36
+ }
37
+ export interface RelatedService {
38
+ section?: string;
39
+ name?: string;
40
+ url?: string;
41
+ description?: string;
42
+ relationship?: string;
43
+ }
44
+ export interface Repository {
45
+ platform?: string;
46
+ url: string;
47
+ type?: string;
48
+ description?: string;
49
+ }
50
+ export interface Credit {
51
+ section?: string;
52
+ name?: string;
53
+ type: string;
54
+ url?: string;
55
+ author?: string;
56
+ license?: License;
57
+ description?: string;
58
+ }
59
+ export interface SectionLicense {
60
+ section?: string;
61
+ name?: string;
62
+ url?: string;
63
+ }
64
+ export interface SiteInfoData {
65
+ technologyStack?: Technology[];
66
+ privacyStatement?: string;
67
+ openSourceInfo?: {
68
+ description?: string;
69
+ license?: License;
70
+ basedOn?: BasedOnItem[];
71
+ relatedServices?: RelatedService[];
72
+ repositories?: Repository[];
73
+ };
74
+ credits?: Credit[];
75
+ additionalInfo?: {
76
+ websiteBirthYear?: number;
77
+ purpose?: string;
78
+ sectionLicense?: SectionLicense[];
79
+ };
80
+ }
81
+ export interface LinkCard {
82
+ url: string;
83
+ text: string;
84
+ emoji: string;
85
+ }
86
+ export interface LinkData {
87
+ cards: LinkCard[];
88
+ }
89
+ export interface BlogPost {
90
+ title: string;
91
+ url: string;
92
+ createdAt: string;
93
+ platform: 'standard.site';
94
+ description?: string;
95
+ rkey: string;
96
+ publicationName?: string;
97
+ publicationRkey?: string;
98
+ tags?: string[];
99
+ coverImage?: string;
100
+ textContent?: string;
101
+ updatedAt?: string;
102
+ }
103
+ export interface BlogPostsData {
104
+ posts: BlogPost[];
105
+ }
106
+ export interface Facet {
107
+ index: {
108
+ byteStart: number;
109
+ byteEnd: number;
110
+ };
111
+ features: Array<{
112
+ $type: string;
113
+ uri?: string;
114
+ did?: string;
115
+ tag?: string;
116
+ }>;
117
+ }
118
+ export interface ExternalLink {
119
+ uri: string;
120
+ title: string;
121
+ description?: string;
122
+ thumb?: string;
123
+ }
124
+ export interface PostAuthor {
125
+ did: string;
126
+ handle: string;
127
+ displayName?: string;
128
+ avatar?: string;
129
+ pronouns?: string;
130
+ }
131
+ export interface BlueskyPost {
132
+ text: string;
133
+ createdAt: string;
134
+ uri: string;
135
+ author: PostAuthor;
136
+ likeCount?: number;
137
+ repostCount?: number;
138
+ replyCount?: number;
139
+ hasImages: boolean;
140
+ imageUrls?: string[];
141
+ imageAlts?: string[];
142
+ hasVideo?: boolean;
143
+ videoUrl?: string;
144
+ videoThumbnail?: string;
145
+ quotedPostUri?: string;
146
+ quotedPost?: BlueskyPost;
147
+ facets?: Facet[];
148
+ externalLink?: ExternalLink;
149
+ replyParent?: BlueskyPost;
150
+ replyRoot?: BlueskyPost;
151
+ isRepost?: boolean;
152
+ repostAuthor?: PostAuthor;
153
+ repostCreatedAt?: string;
154
+ originalPost?: BlueskyPost;
155
+ }
156
+ export interface ResolvedIdentity {
157
+ did: string;
158
+ pds: string;
159
+ }
160
+ export interface CacheEntry<T> {
161
+ data: T;
162
+ timestamp: number;
163
+ }
164
+ export interface MusicArtist {
165
+ artistName: string;
166
+ artistMbId?: string;
167
+ }
168
+ export interface MusicStatusData {
169
+ trackName: string;
170
+ artists: MusicArtist[];
171
+ releaseName?: string;
172
+ playedTime: string;
173
+ originUrl?: string;
174
+ recordingMbId?: string;
175
+ releaseMbId?: string;
176
+ isrc?: string;
177
+ duration?: number;
178
+ musicServiceBaseDomain?: string;
179
+ submissionClientAgent?: string;
180
+ $type: 'fm.teal.alpha.actor.status' | 'fm.teal.alpha.feed.play';
181
+ expiry?: string;
182
+ artwork?: {
183
+ ref?: {
184
+ $link: string;
185
+ };
186
+ mimeType?: string;
187
+ size?: number;
188
+ };
189
+ artworkUrl?: string;
190
+ }
191
+ export interface KibunStatusData {
192
+ text: string;
193
+ emoji: string;
194
+ createdAt: string;
195
+ $type: 'social.kibun.status';
196
+ }
197
+ export interface TangledRepo {
198
+ uri: string;
199
+ name: string;
200
+ description?: string;
201
+ knot: string;
202
+ createdAt: string;
203
+ labels?: string[];
204
+ source?: string;
205
+ spindle?: string;
206
+ }
207
+ export interface TangledReposData {
208
+ repos: TangledRepo[];
209
+ }
210
+ export interface StandardSiteThemeColor {
211
+ r: number;
212
+ g: number;
213
+ b: number;
214
+ a?: number;
215
+ }
216
+ export interface StandardSiteBasicTheme {
217
+ background: StandardSiteThemeColor;
218
+ foreground: StandardSiteThemeColor;
219
+ accent: StandardSiteThemeColor;
220
+ accentForeground: StandardSiteThemeColor;
221
+ }
222
+ export interface StandardSitePreferences {
223
+ showInDiscover?: boolean;
224
+ showComments?: boolean;
225
+ showMentions?: boolean;
226
+ showPrevNext?: boolean;
227
+ showRecommends?: boolean;
228
+ }
229
+ export interface StandardSitePublication {
230
+ name: string;
231
+ rkey: string;
232
+ uri: string;
233
+ url: string;
234
+ description?: string;
235
+ icon?: string;
236
+ basicTheme?: StandardSiteBasicTheme;
237
+ preferences?: StandardSitePreferences;
238
+ }
239
+ export interface StandardSitePublicationsData {
240
+ publications: StandardSitePublication[];
241
+ }
242
+ export interface StandardSiteDocument {
243
+ title: string;
244
+ rkey: string;
245
+ uri: string;
246
+ url: string;
247
+ site: string;
248
+ path?: string;
249
+ description?: string;
250
+ coverImage?: string;
251
+ content?: any;
252
+ textContent?: string;
253
+ bskyPostRef?: {
254
+ uri: string;
255
+ cid: string;
256
+ };
257
+ tags?: string[];
258
+ publishedAt: string;
259
+ updatedAt?: string;
260
+ publicationName?: string;
261
+ publicationRkey?: string;
262
+ preferences?: StandardSitePreferences;
263
+ }
264
+ export interface StandardSiteDocumentsData {
265
+ documents: StandardSiteDocument[];
266
+ }
267
+ //# sourceMappingUR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MAAM,CAAA;KAAE,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IACzC,SAAS,EAAE,oBAAoB,EAAE,CAAC;CAClC"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for AT Protocol services
3
+ * Identical to src/lib/services/atproto/types.ts — no SvelteKit dependencies.
4
+ */
5
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ewanc26/atproto",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "AT Protocol service layer extracted from ewancroft.uk",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,18 +12,23 @@
12
12
  },
13
13
  "main": "./dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
- "publishConfig": { "access": "public" },
16
- "files": ["dist", "src"],
17
- "scripts": {
18
- "build": "tsc --project tsconfig.json",
19
- "dev": "tsc --project tsconfig.json --watch",
20
- "check": "tsc --noEmit"
15
+ "publishConfig": {
16
+ "access": "public"
21
17
  },
18
+ "files": [
19
+ "dist",
20
+ "src"
21
+ ],
22
22
  "peerDependencies": {
23
23
  "@atproto/api": ">=0.13.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@atproto/api": "^0.18.1",
27
27
  "typescript": "^5.9.3"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc --project tsconfig.json",
31
+ "dev": "tsc --project tsconfig.json --watch",
32
+ "check": "tsc --noEmit"
28
33
  }
29
- }
34
+ }
package/src/documents.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  StandardSiteDocumentsData,
9
9
  StandardSiteBasicTheme,
10
10
  StandardSiteThemeColor,
11
+ StandardSitePreferences,
11
12
  BlogPost
12
13
  } from './types.js';
13
14
 
@@ -23,6 +24,7 @@ interface DocumentRecord {
23
24
  tags?: string[];
24
25
  publishedAt: string;
25
26
  updatedAt?: string;
27
+ preferences?: StandardSitePreferences;
26
28
  }
27
29
 
28
30
  interface PublicationRecord {
@@ -36,7 +38,7 @@ interface PublicationRecord {
36
38
  accent: StandardSiteThemeColor;
37
39
  accentForeground: StandardSiteThemeColor;
38
40
  };
39
- preferences?: { showInDiscover?: boolean };
41
+ preferences?: StandardSitePreferences;
40
42
  }
41
43
 
42
44
  async function getBlobUrl(
@@ -112,6 +114,16 @@ export async function fetchPublications(
112
114
  };
113
115
  }
114
116
 
117
+ const preferences: StandardSitePreferences | undefined = pubValue.preferences
118
+ ? {
119
+ showInDiscover: pubValue.preferences.showInDiscover,
120
+ showComments: pubValue.preferences.showComments,
121
+ showMentions: pubValue.preferences.showMentions,
122
+ showPrevNext: pubValue.preferences.showPrevNext,
123
+ showRecommends: pubValue.preferences.showRecommends
124
+ }
125
+ : undefined;
126
+
115
127
  publications.push({
116
128
  name: pubValue.name,
117
129
  rkey,
@@ -120,7 +132,7 @@ export async function fetchPublications(
120
132
  description: pubValue.description,
121
133
  icon: pubValue.icon ? await getBlobUrl(did, pubValue.icon, fetchFn) : undefined,
122
134
  basicTheme,
123
- preferences: pubValue.preferences
135
+ preferences
124
136
  });
125
137
  }
126
138
 
@@ -201,7 +213,8 @@ export async function fetchDocuments(
201
213
  publishedAt: docValue.publishedAt,
202
214
  updatedAt: docValue.updatedAt,
203
215
  publicationName: publication?.name,
204
- publicationRkey
216
+ publicationRkey,
217
+ preferences: docValue.preferences
205
218
  });
206
219
  }
207
220
 
package/src/types.ts CHANGED
@@ -233,6 +233,14 @@ export interface StandardSiteBasicTheme {
233
233
  accentForeground: StandardSiteThemeColor;
234
234
  }
235
235
 
236
+ export interface StandardSitePreferences {
237
+ showInDiscover?: boolean;
238
+ showComments?: boolean;
239
+ showMentions?: boolean;
240
+ showPrevNext?: boolean;
241
+ showRecommends?: boolean;
242
+ }
243
+
236
244
  export interface StandardSitePublication {
237
245
  name: string;
238
246
  rkey: string;
@@ -241,7 +249,7 @@ export interface StandardSitePublication {
241
249
  description?: string;
242
250
  icon?: string;
243
251
  basicTheme?: StandardSiteBasicTheme;
244
- preferences?: { showInDiscover?: boolean };
252
+ preferences?: StandardSitePreferences;
245
253
  }
246
254
 
247
255
  export interface StandardSitePublicationsData {
@@ -265,6 +273,7 @@ export interface StandardSiteDocument {
265
273
  updatedAt?: string;
266
274
  publicationName?: string;
267
275
  publicationRkey?: string;
276
+ preferences?: StandardSitePreferences;
268
277
  }
269
278
 
270
279
  export interface StandardSiteDocumentsData {