@ewanc26/atproto 0.2.7 → 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/package.json +1 -1
- package/src/documents.ts +9 -24
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/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;
|