Skip to content
Open
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
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"workspace": [
"./packages/amqp",
"./packages/astro",
"./packages/backfill",
"./packages/cfworkers",
"./packages/cli",
"./packages/debugger",
Expand Down
79 changes: 79 additions & 0 deletions packages/backfill/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!-- deno-fmt-ignore-file -->

@fedify/backfill: ActivityPub backfill for Fedify
=================================================

[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![Follow @fedify@hollo.social][@fedify@hollo.social badge]][@fedify@hollo.social]

*This package is available since Fedify 2.3.0.*

This package provides ActivityPub conversation backfill support for the
[Fedify] ecosystem. It can retrieve post-like objects from a seed object's
context collection, following the direct FEP-f228-style path where the
context dereferences to a `Collection`, `OrderedCollection`, `CollectionPage`,
or `OrderedCollectionPage`.

[JSR badge]: https://jsr.io/badges/@fedify/backfill
[JSR]: https://jsr.io/@fedify/backfill
[npm badge]: https://img.shields.io/npm/v/@fedify/backfill?logo=npm
[npm]: https://www.npmjs.com/package/@fedify/backfill
[@fedify@hollo.social badge]: https://fedi-badge.deno.dev/@fedify@hollo.social/followers.svg
[@fedify@hollo.social]: https://hollo.social/@fedify
[Fedify]: https://fedify.dev/


Installation
------------

::: code-group

~~~~ sh [Deno]
deno add jsr:@fedify/backfill
~~~~

~~~~ sh [npm]
npm add @fedify/backfill
~~~~

~~~~ sh [pnpm]
pnpm add @fedify/backfill
~~~~

~~~~ sh [Yarn]
yarn add @fedify/backfill
~~~~

~~~~ sh [Bun]
bun add @fedify/backfill
~~~~

:::


Usage
-----

The `backfill()` function accepts a backfill context, a seed object, and
traversal options:

~~~~ typescript
import { backfill } from "@fedify/backfill";
import { lookupObject } from "@fedify/vocab";

const documentLoader = (iri: URL, options?: { signal?: AbortSignal }) =>
lookupObject(iri, { signal: options?.signal });

for await (
const item of backfill({ documentLoader }, note, {
maxItems: 20,
maxRequests: 50,
})
) {
console.log(item.id?.href);
}
~~~~

The seed object itself is not yielded. If it appears in the discovered
collection, it is skipped by ID.
22 changes: 22 additions & 0 deletions packages/backfill/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@fedify/backfill",
"version": "2.3.0",
"license": "MIT",
"exports": {
".": "./src/mod.ts"
},
Comment thread
sij411 marked this conversation as resolved.
"exclude": [
"dist/",
"node_modules/"
],
"publish": {
"exclude": [
"**/*.test.ts",
"tsdown.config.ts"
]
},
"tasks": {
"check": "deno fmt --check && deno lint && deno check src/**/*.ts",
"test": "deno test"
}
}
Comment thread
sij411 marked this conversation as resolved.
68 changes: 68 additions & 0 deletions packages/backfill/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@fedify/backfill",
"version": "2.3.0",
"description": "ActivityPub backfill support for Fedify",
"keywords": [
"Fedify",
"ActivityPub",
"Fediverse",
"Backfill"
],
"author": {
"name": "Jiwon Kwon",
"email": "work@kwonjiwon.org"
},
"homepage": "https://fedify.dev/",
"repository": {
"type": "git",
"url": "git+https://github.com/fedify-dev/fedify.git",
"directory": "packages/backfill"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/fedify-dev/fedify/issues"
},
"funding": [
"https://opencollective.com/fedify",
"https://github.com/sponsors/dahlia"
],
"type": "module",
"main": "./dist/mod.cjs",
"module": "./dist/mod.js",
"types": "./dist/mod.d.ts",
"exports": {
".": {
"types": {
"import": "./dist/mod.d.ts",
"require": "./dist/mod.d.cts",
"default": "./dist/mod.d.ts"
},
"import": "./dist/mod.js",
"require": "./dist/mod.cjs",
"default": "./dist/mod.js"
},
"./package.json": "./package.json"
},
"files": [
"dist/",
"package.json",
"README.md"
],
"dependencies": {
"@fedify/vocab": "workspace:*"
},
"devDependencies": {
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build:self": "tsdown",
"build": "pnpm --filter @fedify/backfill... run build:self",
"prepack": "pnpm build",
"prepublish": "pnpm build",
"pretest": "pnpm build",
"test": "cd dist/ && node --test",
"pretest:bun": "pnpm build",
"test:bun": "cd dist/ && bun test --timeout 60000"
}
}
Loading