![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
A Minipub subproject.
Carefully packaged so that it can be used from either newer-style ESM-based or older-style CommonJS-based Node projects.
Written using Deno, so also can be used without this NPM package at all (see Deno example below).
replies
property)See the API docs in threadcap.ts for now.
These are also used to generate TypeScript typings for this NPM package, so you'll get them as hover documentation in your IDE.
Installation:
npm install threadcap
npm install node-fetch # you'll need a fetch implementation
example.mjs
import { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher } from 'threadcap';
import fetch from 'node-fetch';
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
Installation:
npm install threadcap
npm install node-fetch@2 # you'll need a commonjs-based fetch implementation
example.js
const { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher } = require('threadcap');
const fetch = require('node-fetch');
async function run() {
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
}
run(); // no top-level await when using CommonJS
You don't need this NPM package or to install anything, just remote-import threadcap.ts
from the source repo
example.ts
import { makeThreadcap, InMemoryCache, updateThreadcap, makeRateLimitedFetcher, Callbacks } from 'https://raw.githubusercontent.com/skymethod/minipub/v0.1.1/src/threadcap/threadcap.ts';
const userAgent = 'my-podcast-app/1.0';
const cache = new InMemoryCache();
const fetcher = makeRateLimitedFetcher(fetch); // respect any rate-limits defined by remote hosts
// initialize the threadcap
const threadcap = await makeThreadcap('https://example.social/users/alice/statuses/123456123456123456', { userAgent, cache, fetcher });
// update the threadcap, process all replies
const callbacks: Callbacks = {
onEvent: e => {
if (e.kind === 'node-processed' && e.part === 'comment') {
console.log(`Processed ${e.nodeId}`);
// threadcap is now updated with a new comment, update your UI incrementally
}
}
}
await updateThreadcap(threadcap, { updateTime: new Date().toISOString(), userAgent, cache, fetcher, callbacks });
// final threadcap includes the comment/commenter info for the root post and all replies
console.log(JSON.stringify(threadcap, undefined, 2));
FAQs
Threadcap helps you take and update snapshots of a public ActivityPub comment thread, given a root post url.
The npm package threadcap receives a total of 0 weekly downloads. As such, threadcap popularity was classified as not popular.
We found that threadcap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.