Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/adapters/src/outreachgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export const outreachgraph = defineAdapter({
const item = directoryItem(row, base);
if (item) items.push(item);
else skipped += 1;
if (typeof row?.updated === 'string' && (!newest || row.updated > newest)) newest = row.updated;
if (typeof row?.updated === 'string' && (!newest || row.updated > newest))
newest = row.updated;
}
const next = typeof doc?.next === 'string' && doc.next ? doc.next : null;
if (!next || rows.length === 0) {
Expand All @@ -207,11 +208,15 @@ export const outreachgraph = defineAdapter({
cursor = next;
}
const counts = KINDS.map((k) => `${items.filter((i) => i.kind === k).length} ${k}`).join(', ');
log(`${pages} pages: ${counts}${skipped ? `, ${skipped} skipped` : ''}${reachedEnd ? '' : ', resuming next run'}`);
log(
`${pages} pages: ${counts}${skipped ? `, ${skipped} skipped` : ''}${reachedEnd ? '' : ', resuming next run'}`,
);
// Reached the end: from now on only what changed since the newest row seen
// (>= on the far side, so a row sharing that instant is read again, not lost).
// Cut short by the cap, the deadline or a failed page: carry on from here.
const next = reachedEnd ? { base, since: newest, resume: null } : { base, since, resume: cursor };
const next = reachedEnd
? { base, since: newest, resume: null }
: { base, since, resume: cursor };
return {
items,
cursor: next,
Expand Down
5 changes: 4 additions & 1 deletion test/directory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ describe('OutreachGraph public directory: the adapter', () => {
json: async (url) => {
asked.push(url);
const n = asked.length;
return { items: [{ ...company, id: `co_${n}`, updated: `2026-10-0${n}T00:00:00.000Z` }], next: `c${n}` };
return {
items: [{ ...company, id: `co_${n}`, updated: `2026-10-0${n}T00:00:00.000Z` }],
next: `c${n}`,
};
},
};
const first = await outreachgraph.pull({
Expand Down
Loading