-
-
Notifications
You must be signed in to change notification settings - Fork 102
Add initial backfill package #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sij411
wants to merge
8
commits into
fedify-dev:feat/backfill
Choose a base branch
from
sij411:feat/backfill
base: feat/backfill
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+942
−0
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b34d840
Add @fedify/backfill
sij411 1e7bd34
Add backfill API surface
sij411 6970c15
Implement context collection backfill
sij411 392730b
Document backfill API usage
sij411 ff8f75f
Clean up backfill lockfile changes
sij411 a9cb0db
Address backfill review feedback
sij411 cdcb066
Normalize backfill test entry paths
sij411 3f87eaa
Guard string interval without Temporal
sij411 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| }, | ||
| "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" | ||
| } | ||
| } | ||
|
sij411 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.