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
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@profullstack/nichedb",
"version": "0.57.0",
"version": "0.58.0",
"description": "CLI and MCP bridge for NicheDB: browse collections, manage sources and feeds, search items, from any deployment",
"type": "module",
"main": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { homedir, tmpdir } from 'node:os';
import { join } from 'node:path';
import { createInterface } from 'node:readline';

export const VERSION = '0.57.0';
export const VERSION = '0.58.0';
const GEO_FLAGS = ['lat', 'long', 'radius', 'unit', 'bbox', 'sort', 'offset'];
const DEFAULT_API = process.env.NICHEDB_API ?? 'https://nichedb.dev';
const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'nichedb');
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/web",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"scripts": {
Expand Down
22 changes: 22 additions & 0 deletions apps/web/src/lib/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ const words = (list, max, len = 40) =>
.filter(Boolean)
.slice(0, max);

const positive = (v) => (Number.isInteger(v) && v > 0 && v < 100_000 ? v : null);
/** A list of media references, each with a public address, at most `max`. */
const mediaRefs = (list, max, shape) =>
(Array.isArray(list) ? list : [])
.filter((m) => m && typeof m === 'object')
.map(shape)
.filter((m) => m.url)
.slice(0, max);

/**
* One pushed record as the row it becomes, or the reason it is refused.
*
Expand Down Expand Up @@ -225,6 +234,19 @@ export function crawledItem(entry, { now = new Date() } = {}) {
rendered: enrichment.rendered === true,
depth: Number.isFinite(enrichment.depth) ? enrichment.depth : null,
crawler: clip(enrichment.crawler, 80) || null,
// What the page shows, by reference (the crawler never stores the files).
images: mediaRefs(enrichment.images, 20, (m) => ({
url: publicWebUrl(m.url),
alt: clip(m.alt, 300),
width: positive(m.width),
height: positive(m.height),
})),
videos: mediaRefs(enrichment.videos, 10, (m) => ({
url: publicWebUrl(m.url),
title: clip(m.title, 300),
thumbnail: m.thumbnail ? publicWebUrl(m.thumbnail) : null,
provider: clip(m.provider, 40) || null,
})),
};
const row = normaliseItem({
...item,
Expand Down
24 changes: 24 additions & 0 deletions apps/web/src/routes/sites.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,19 @@ describe('records a crawler pushes', () => {
rendered: true,
hash: 'abc123',
crawler: 'pitbot/0.1',
images: [
{ url: 'https://crawled.example/dome.jpg', alt: 'Brick dome', width: 800, height: -1 },
{ url: 'http://127.0.0.1/secret.png', alt: 'private' },
'not an object',
],
videos: [
{
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
title: 'Firing it',
thumbnail: 'https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg',
provider: 'youtube',
},
],
},
};

Expand Down Expand Up @@ -352,6 +365,17 @@ describe('records a crawler pushes', () => {
expect(row.tags).toContain('rendered');
expect(row.contentHash).toBe('crawl:abc123');
expect(row.data.enrichment.words).toBe(812);
expect(row.data.enrichment.images).toEqual([
{ url: 'https://crawled.example/dome.jpg', alt: 'Brick dome', width: 800, height: null },
]);
expect(row.data.enrichment.videos).toEqual([
{
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
title: 'Firing it',
thumbnail: 'https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg',
provider: 'youtube',
},
]);
});

test('an empty or oversized batch is refused whole', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/worker",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "niche-db",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"description": "An open platform for large, ever-growing databases of real-time data: sources in, feeds out. Web, API, CLI and MCP on one Postgres.",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/adapters",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/auth",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/config",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/core",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/db",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/enrichers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/enrichers",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/knowledge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/knowledge",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/notify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/notify",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/payments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/payments",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/premium/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/premium",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/queue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nichedb/queue",
"version": "0.57.0",
"version": "0.58.0",
"private": true,
"type": "module",
"exports": {
Expand Down
Loading