@ewanc26/atproto 0.2.6 → 0.2.8
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/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +12 -17
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +25 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/documents.ts +9 -24
- package/src/fetch.ts +29 -28
- package/src/index.ts +1 -1
package/dist/documents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../src/documents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEX,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EAIzB,QAAQ,EACR,MAAM,YAAY,CAAC;AAiEpB,wBAAsB,iBAAiB,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,4BAA4B,CAAC,CAwDvC;AAED,wBAAsB,cAAc,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,yBAAyB,CAAC,CAuEpC;AAED,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,MAAM,EACX,KAAK,SAAI,EACT,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAGjC;AAED,wBAAsB,cAAc,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAiBhC"}
|
package/dist/documents.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cache } from './cache.js';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveIdentity } from './agents.js';
|
|
3
3
|
import { buildPdsBlobUrl } from './media.js';
|
|
4
|
+
import { fetchAllRecords } from './pagination/index.js';
|
|
4
5
|
async function getBlobUrl(did, blob, fetchFn) {
|
|
5
6
|
try {
|
|
6
7
|
const cid = blob.ref?.$link || blob.cid;
|
|
@@ -34,14 +35,11 @@ export async function fetchPublications(did, fetchFn) {
|
|
|
34
35
|
return cached;
|
|
35
36
|
const publications = [];
|
|
36
37
|
try {
|
|
37
|
-
const publicationsRecords = await
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
return response.data.records;
|
|
44
|
-
}, true, fetchFn);
|
|
38
|
+
const publicationsRecords = await fetchAllRecords({
|
|
39
|
+
repo: did,
|
|
40
|
+
collection: 'site.standard.publication',
|
|
41
|
+
fetchFn
|
|
42
|
+
});
|
|
45
43
|
for (const pubRecord of publicationsRecords) {
|
|
46
44
|
const pubValue = pubRecord.value;
|
|
47
45
|
const rkey = pubRecord.uri.split('/').pop() || '';
|
|
@@ -94,14 +92,11 @@ export async function fetchDocuments(did, fetchFn) {
|
|
|
94
92
|
for (const pub of publicationsData.publications) {
|
|
95
93
|
publicationsMap.set(pub.uri, pub);
|
|
96
94
|
}
|
|
97
|
-
const documentsRecords = await
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
return response.data.records;
|
|
104
|
-
}, true, fetchFn);
|
|
95
|
+
const documentsRecords = await fetchAllRecords({
|
|
96
|
+
repo: did,
|
|
97
|
+
collection: 'site.standard.document',
|
|
98
|
+
fetchFn
|
|
99
|
+
});
|
|
105
100
|
for (const docRecord of documentsRecords) {
|
|
106
101
|
const docValue = docRecord.value;
|
|
107
102
|
const rkey = docRecord.uri.split('/').pop() || '';
|
package/dist/fetch.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare function fetchSiteInfo(did: string, fetchFn?: typeof fetch): Prom
|
|
|
4
4
|
export declare function fetchLinks(did: string, fetchFn?: typeof fetch): Promise<LinkData | null>;
|
|
5
5
|
export declare function fetchMusicStatus(did: string, fetchFn?: typeof fetch): Promise<MusicStatusData | null>;
|
|
6
6
|
export declare function fetchKibunStatus(did: string, fetchFn?: typeof fetch): Promise<KibunStatusData | null>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function fetchRecentPopfeedReviews(did: string, limit?: number, fetchFn?: typeof fetch): Promise<PopfeedReview[]>;
|
|
8
8
|
export declare function fetchTangledRepos(did: string, fetchFn?: typeof fetch): Promise<TangledReposData | null>;
|
|
9
9
|
//# sourceMappingURL=fetch.d.ts.map
|
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,eAAe,EAEf,gBAAgB,EAChB,aAAa,EAGb,MAAM,YAAY,CAAC;AAEpB,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAgD5F;AAED,wBAAsB,aAAa,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgC9B;AAED,wBAAsB,UAAU,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA2B1B;AAED,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAkIjC;AAED,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAmCjC;AAED,wBAAsB,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,eAAe,EAEf,gBAAgB,EAChB,aAAa,EAGb,MAAM,YAAY,CAAC;AAEpB,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAgD5F;AAED,wBAAsB,aAAa,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgC9B;AAED,wBAAsB,UAAU,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA2B1B;AAED,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAkIjC;AAED,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAmCjC;AAED,wBAAsB,yBAAyB,CAC9C,GAAG,EAAE,MAAM,EACX,KAAK,SAAI,EACT,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC,CAgD1B;AAED,wBAAsB,iBAAiB,CACtC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA2ClC"}
|
package/dist/fetch.js
CHANGED
|
@@ -240,8 +240,8 @@ export async function fetchKibunStatus(did, fetchFn) {
|
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
export async function
|
|
244
|
-
const cacheKey = `popfeed-
|
|
243
|
+
export async function fetchRecentPopfeedReviews(did, limit = 5, fetchFn) {
|
|
244
|
+
const cacheKey = `popfeed-reviews:${did}:${limit}`;
|
|
245
245
|
const cached = cache.get(cacheKey);
|
|
246
246
|
if (cached)
|
|
247
247
|
return cached;
|
|
@@ -250,36 +250,37 @@ export async function fetchLatestPopfeedReview(did, fetchFn) {
|
|
|
250
250
|
const response = await agent.com.atproto.repo.listRecords({
|
|
251
251
|
repo: did,
|
|
252
252
|
collection: 'social.popfeed.feed.review',
|
|
253
|
-
limit
|
|
253
|
+
limit
|
|
254
254
|
});
|
|
255
255
|
return response.data.records;
|
|
256
256
|
}, true, fetchFn);
|
|
257
257
|
if (!records?.length)
|
|
258
|
-
return
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
258
|
+
return [];
|
|
259
|
+
const data = records.map((record) => {
|
|
260
|
+
const value = record.value;
|
|
261
|
+
const rkey = record.uri.split('/').pop() ?? record.uri;
|
|
262
|
+
return {
|
|
263
|
+
rkey,
|
|
264
|
+
uri: record.uri,
|
|
265
|
+
title: value.title,
|
|
266
|
+
creativeWorkType: value.creativeWorkType,
|
|
267
|
+
rating: value.rating,
|
|
268
|
+
text: value.text,
|
|
269
|
+
posterUrl: value.posterUrl,
|
|
270
|
+
mainCredit: value.mainCredit,
|
|
271
|
+
mainCreditRole: value.mainCreditRole,
|
|
272
|
+
genres: value.genres,
|
|
273
|
+
tags: value.tags,
|
|
274
|
+
createdAt: value.createdAt,
|
|
275
|
+
containsSpoilers: value.containsSpoilers,
|
|
276
|
+
isRevisit: value.isRevisit
|
|
277
|
+
};
|
|
278
|
+
});
|
|
278
279
|
cache.set(cacheKey, data);
|
|
279
280
|
return data;
|
|
280
281
|
}
|
|
281
282
|
catch {
|
|
282
|
-
return
|
|
283
|
+
return [];
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
export async function fetchTangledRepos(did, fetchFn) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PopfeedReview, PopfeedCreativeWorkType, PopfeedMainCreditRole, ProfileData, StatusData, SiteInfoData, LinkData, LinkCard, BlueskyPost, BlogPost, BlogPostsData, PostAuthor, ExternalLink, Facet, Technology, License, BasedOnItem, RelatedService, Repository, Credit, SectionLicense, ResolvedIdentity, CacheEntry, MusicStatusData, MusicArtist, KibunStatusData, TangledRepo, TangledReposData, StandardSitePublication, StandardSitePublicationsData, StandardSiteDocument, StandardSiteDocumentsData, StandardSiteBasicTheme, StandardSiteThemeColor } from './types.js';
|
|
2
|
-
export { fetchProfile, fetchSiteInfo, fetchLinks, fetchMusicStatus, fetchKibunStatus, fetchTangledRepos,
|
|
2
|
+
export { fetchProfile, fetchSiteInfo, fetchLinks, fetchMusicStatus, fetchKibunStatus, fetchTangledRepos, fetchRecentPopfeedReviews } from './fetch.js';
|
|
3
3
|
export { fetchPublications, fetchDocuments, fetchRecentDocuments, fetchBlogPosts } from './documents.js';
|
|
4
4
|
export { fetchLatestBlueskyPost, fetchPostFromUri } from './posts.js';
|
|
5
5
|
export { buildPdsBlobUrl, extractCidFromImageObject, extractImageUrlsFromValue } from './media.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACX,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,YAAY,EACZ,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACX,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,YAAY,EACZ,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAErJ,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Key API difference from the app's src/lib/services/atproto:
|
|
3
3
|
// All functions that previously read PUBLIC_ATPROTO_DID from the environment
|
|
4
4
|
// now accept `did: string` as their first argument.
|
|
5
|
-
export { fetchProfile, fetchSiteInfo, fetchLinks, fetchMusicStatus, fetchKibunStatus, fetchTangledRepos,
|
|
5
|
+
export { fetchProfile, fetchSiteInfo, fetchLinks, fetchMusicStatus, fetchKibunStatus, fetchTangledRepos, fetchRecentPopfeedReviews } from './fetch.js';
|
|
6
6
|
export { fetchPublications, fetchDocuments, fetchRecentDocuments, fetchBlogPosts } from './documents.js';
|
|
7
7
|
export { fetchLatestBlueskyPost, fetchPostFromUri } from './posts.js';
|
|
8
8
|
export { buildPdsBlobUrl, extractCidFromImageObject, extractImageUrlsFromValue } from './media.js';
|
package/package.json
CHANGED
package/src/documents.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cache } from './cache.js';
|
|
2
2
|
import { withFallback, resolveIdentity } from './agents.js';
|
|
3
3
|
import { buildPdsBlobUrl } from './media.js';
|
|
4
|
+
import { fetchAllRecords } from './pagination/index.js';
|
|
4
5
|
import type {
|
|
5
6
|
StandardSitePublication,
|
|
6
7
|
StandardSitePublicationsData,
|
|
@@ -86,19 +87,11 @@ export async function fetchPublications(
|
|
|
86
87
|
const publications: StandardSitePublication[] = [];
|
|
87
88
|
|
|
88
89
|
try {
|
|
89
|
-
const publicationsRecords = await
|
|
90
|
-
did,
|
|
91
|
-
|
|
92
|
-
const response = await agent.com.atproto.repo.listRecords({
|
|
93
|
-
repo: did,
|
|
94
|
-
collection: 'site.standard.publication',
|
|
95
|
-
limit: 100
|
|
96
|
-
});
|
|
97
|
-
return response.data.records;
|
|
98
|
-
},
|
|
99
|
-
true,
|
|
90
|
+
const publicationsRecords = await fetchAllRecords({
|
|
91
|
+
repo: did,
|
|
92
|
+
collection: 'site.standard.publication',
|
|
100
93
|
fetchFn
|
|
101
|
-
);
|
|
94
|
+
});
|
|
102
95
|
|
|
103
96
|
for (const pubRecord of publicationsRecords) {
|
|
104
97
|
const pubValue = pubRecord.value as unknown as PublicationRecord;
|
|
@@ -161,19 +154,11 @@ export async function fetchDocuments(
|
|
|
161
154
|
publicationsMap.set(pub.uri, pub);
|
|
162
155
|
}
|
|
163
156
|
|
|
164
|
-
const documentsRecords = await
|
|
165
|
-
did,
|
|
166
|
-
|
|
167
|
-
const response = await agent.com.atproto.repo.listRecords({
|
|
168
|
-
repo: did,
|
|
169
|
-
collection: 'site.standard.document',
|
|
170
|
-
limit: 100
|
|
171
|
-
});
|
|
172
|
-
return response.data.records;
|
|
173
|
-
},
|
|
174
|
-
true,
|
|
157
|
+
const documentsRecords = await fetchAllRecords({
|
|
158
|
+
repo: did,
|
|
159
|
+
collection: 'site.standard.document',
|
|
175
160
|
fetchFn
|
|
176
|
-
);
|
|
161
|
+
});
|
|
177
162
|
|
|
178
163
|
for (const docRecord of documentsRecords) {
|
|
179
164
|
const docValue = docRecord.value as unknown as DocumentRecord;
|
package/src/fetch.ts
CHANGED
|
@@ -309,12 +309,13 @@ export async function fetchKibunStatus(
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
export async function
|
|
312
|
+
export async function fetchRecentPopfeedReviews(
|
|
313
313
|
did: string,
|
|
314
|
+
limit = 5,
|
|
314
315
|
fetchFn?: typeof fetch
|
|
315
|
-
): Promise<PopfeedReview
|
|
316
|
-
const cacheKey = `popfeed-
|
|
317
|
-
const cached = cache.get<PopfeedReview>(cacheKey);
|
|
316
|
+
): Promise<PopfeedReview[]> {
|
|
317
|
+
const cacheKey = `popfeed-reviews:${did}:${limit}`;
|
|
318
|
+
const cached = cache.get<PopfeedReview[]>(cacheKey);
|
|
318
319
|
if (cached) return cached;
|
|
319
320
|
|
|
320
321
|
try {
|
|
@@ -324,7 +325,7 @@ export async function fetchLatestPopfeedReview(
|
|
|
324
325
|
const response = await agent.com.atproto.repo.listRecords({
|
|
325
326
|
repo: did,
|
|
326
327
|
collection: 'social.popfeed.feed.review',
|
|
327
|
-
limit
|
|
328
|
+
limit
|
|
328
329
|
});
|
|
329
330
|
return response.data.records;
|
|
330
331
|
},
|
|
@@ -332,33 +333,33 @@ export async function fetchLatestPopfeedReview(
|
|
|
332
333
|
fetchFn
|
|
333
334
|
);
|
|
334
335
|
|
|
335
|
-
if (!records?.length) return
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
};
|
|
336
|
+
if (!records?.length) return [];
|
|
337
|
+
|
|
338
|
+
const data: PopfeedReview[] = records.map((record) => {
|
|
339
|
+
const value = record.value as any;
|
|
340
|
+
const rkey = record.uri.split('/').pop() ?? record.uri;
|
|
341
|
+
return {
|
|
342
|
+
rkey,
|
|
343
|
+
uri: record.uri,
|
|
344
|
+
title: value.title,
|
|
345
|
+
creativeWorkType: value.creativeWorkType as PopfeedCreativeWorkType,
|
|
346
|
+
rating: value.rating,
|
|
347
|
+
text: value.text,
|
|
348
|
+
posterUrl: value.posterUrl,
|
|
349
|
+
mainCredit: value.mainCredit,
|
|
350
|
+
mainCreditRole: value.mainCreditRole as PopfeedMainCreditRole | undefined,
|
|
351
|
+
genres: value.genres,
|
|
352
|
+
tags: value.tags,
|
|
353
|
+
createdAt: value.createdAt,
|
|
354
|
+
containsSpoilers: value.containsSpoilers,
|
|
355
|
+
isRevisit: value.isRevisit
|
|
356
|
+
};
|
|
357
|
+
});
|
|
357
358
|
|
|
358
359
|
cache.set(cacheKey, data);
|
|
359
360
|
return data;
|
|
360
361
|
} catch {
|
|
361
|
-
return
|
|
362
|
+
return [];
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
|