openvibers/openvibe.sdk Commits

Add ov.community.feed and ov.community.posts.create (0.113.0) (#162)

OP OpenVibers committed 4 days ago · b53303fe83 · 10 files, +99 −13

* Add Design glyph API client

* Add Shoes product SDK client

* openvibe-sdk/report: me, person and publish (0.108.0)

* Add the Feed and status posts to the Community client

* Merge origin/main into the Community feed client branch

* Merge remote-tracking branch 'origin/main' into feature/icon-sdk

# Conflicts:
#	esm/index.mjs
#	test/pack.test.js

* Release 0.110.0

* Keep STATUS.json at the release version

* Merge origin/main into the Community feed client branch

* Merge remote-tracking branch 'origin/main' into feature/icon-sdk

# Conflicts:
#	CHANGELOG.md
#	README.md
#	STATUS.json
#	browser/openvibe-sdk.mjs
#	package-lock.json
#	package.json
#	src/core/index.js

* Type a go-live that is over as a stream card

* Merge remote-tracking branch 'origin/feature/icon-sdk' into shoes-sdk-1109

# Conflicts:
#	esm/index.mjs

* Release 0.111.0

* Merge remote-tracking branch 'origin/shoes-sdk-1109' into me-stats-sdk

# Conflicts:
#	CHANGELOG.md
#	package-lock.json
#	package.json

* Release 0.112.0

* Merge remote-tracking branch 'origin/me-stats-sdk' into feed-sdk-1109

# Conflicts:
#	CHANGELOG.md
#	README.md
#	STATUS.json
#	browser/openvibe-sdk.mjs
#	package-lock.json
#	package.json
#	src/core/index.js

* Release 0.113.0

* Add shoes to the browser-blocked subpath list

* Merge remote-tracking branch 'origin/shoes-sdk-1109' into me-stats-sdk

* Merge remote-tracking branch 'origin/me-stats-sdk' into feed-sdk-1109

* Merge main (the release below is in it)

Changes

ddiff --git a/CHANGELOG.md b/CHANGELOG.md
iindex c791747..6ce558a 100644
---- a/CHANGELOG.md
++++ b/CHANGELOG.md
@@@ -1,5 +1,11 @@
# Changelog
++## 0.113.0 — 2026-11-09
++
++- Add the Feed and status posts to `openvibe-sdk/community`: `feed({ kind, site, q, following, cursor, limit })` reads
++ Community's `GET /api/v1/feed` (one stream over Pulse from every OpenVibe site) and `posts.create({ text, pictures })`
++ posts up to four Media pictures with required alt text, in the Feed at once.
++
## 0.112.0 — 2026-11-09
- Add the person's stats to `openvibe-sdk/report`: `report.me({ days })` (GET `/api/v1/me/stats`, the signed-in person's own numbers), `report.person(username)` (GET `/api/v1/u/:name/stats`, only the sections they published) and `report.publish({ sites, activity, made, ai, money }, { days })` (PUT `/api/v1/me/stats/published`, all five switches named). The answers are `report.me-stats@1`; a source that does not answer leaves its section out, never a zero. `me` and `publish` need the person's own session token; `person` is public and is a 404 when nothing is published.
ddiff --git a/README.md b/README.md
iindex b218aa3..71f835f 100644
---- a/README.md
++++ b/README.md
@@@ -2,7 +2,7 @@
> Supported browser and server clients for the OpenVibe platform.
--**Status:** alpha, v0.112.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
++**Status:** alpha, v0.113.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
**Plan:** OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30.
**License:** MIT ([LICENSE](LICENSE)). This package is a library that apps outside the network embed, so it uses MIT. The OpenVibe services themselves stay AGPL-3.0.
@@@ -11,7 +11,7 @@
After v0.97.1 is tagged:
```bash
--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.112.0
++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.113.0
```
It has no runtime dependencies. It needs Node ≥ 20, or any browser with `fetch`, Web Crypto and `TextDecoder`. There is no build step. The package is CommonJS with ESM entry points (`import` works). Each subpath has its own `.d.ts`. For a page with no bundler, `browser/openvibe-sdk.mjs` is one self-contained ES module of the browser-safe subpaths (see [Browser without a bundler](#browser-without-a-bundler)). It does not depend on `openvibe-contracts` at runtime: it copies the contract types it uses (from the temporary Contracts sharing branch, a devDependency the tests check them against).
ddiff --git a/STATUS.json b/STATUS.json
iindex 20592e9..07925ab 100644
---- a/STATUS.json
++++ b/STATUS.json
@@@ -3,7 +3,7 @@
"stage": "alpha",
"code": true,
"wave": "W2",
-- "version": "0.112.0",
++ "version": "0.113.0",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30",
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
ddiff --git a/browser/openvibe-sdk.mjs b/browser/openvibe-sdk.mjs
iindex 4722735..afe4e64 100644
---- a/browser/openvibe-sdk.mjs
++++ b/browser/openvibe-sdk.mjs
@@@ -1,4 +1,4 @@
--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.112.0, MIT). Do not edit.
++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.113.0, MIT). Do not edit.
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// (auth, locker, registry, trust, modules, realtime, media, cam, community, homeFeed, bot, search, bench, meme, vision, themes, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
@@@ -52,7 +52,7 @@ const { paginate, offsetPager } = __load(7);
const semver = __load(6);
/** The package version (test/version.test.js keeps it equal to package.json). */
--const SDK_VERSION = '0.112.0';
++const SDK_VERSION = '0.113.0';
module.exports = {
createClient,
@@@ -3332,8 +3332,9 @@ function (module, exports) {
* staff: true -> X-OV-Staff: 1 (the acting person is staff; needs .moderate)
* Community ignores X-OV-* headers from browsers.
*
-- * TODO: comments on other content, the forum and Pulse APIs are being added to Community now and
-- * are not wrapped yet; paste comments are.
++ * The Feed and status posts are here too: feed() reads GET /api/v1/feed (one stream from Pulse across every
++ * OpenVibe site) and posts.create() posts text with up to four pictures. Comments on other content, the rest of
++ * the forum and Pulse's service API are not wrapped yet; paste comments are.
*/
const { isOpenVibeError } = __load(3);
const { isActingSubjectId } = __load(5);
@@@ -3421,8 +3422,23 @@ function createCommunityClient(client, defaults = {}) {
},
};
++ const feed = (query = {}, o = {}) => call({
++ path: '/api/v1/feed',
++ query: { kind: query.kind, site: query.site, q: query.q, cursor: query.cursor, limit: query.limit,
++ following: query.following === true || query.following === 1 ? '1' : undefined },
++ }, o);
++ const posts = {
++ /**
++ * A status post in the Feed at once: { text, pictures?: [{ media_id, alt }] } (at most four, alt required,
++ * each media_id a Media object the person owns). -> { id, post_id, text, url, pictures, created_at }
++ */
++ create: (input = {}, o = {}) => call({ method: 'POST', path: '/api/v1/posts', json: input, ...once }, o),
++ };
++
return {
pastes,
++ feed,
++ posts,
/** The same client acting for someone else: as('usr_…') or as({ actingSubject, origin, sourceRef, staff }). */
as(who) {
const next = typeof who === 'string' ? { actingSubject: who } : { ...who };
ddiff --git a/package-lock.json b/package-lock.json
iindex 6c284b5..9f33921 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -1,12 +1,12 @@
{
"name": "openvibe-sdk",
-- "version": "0.112.0",
++ "version": "0.113.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openvibe-sdk",
-- "version": "0.112.0",
++ "version": "0.113.0",
"license": "MIT",
"bin": {
"openvibe-download": "bin/openvibe-download.js"
ddiff --git a/package.json b/package.json
iindex 30f4464..fdb2366 100644
---- a/package.json
++++ b/package.json
@@@ -1,6 +1,6 @@
{
"name": "openvibe-sdk",
-- "version": "0.112.0",
++ "version": "0.113.0",
"description": "Supported browser and server clients for the OpenVibe platform: auth (incl. developer apps), registry discovery, identity, user modules, events, realtime, media, community, Bot robots, search, chat, AI runs, Tools (registry, run API and jobs), VIP memberships and developer projects, the async PostgreSQL data layer (db) and the Valkey cache, limits store, queue and pub/sub, with deadlines, safe retries, problem errors and trace propagation.",
"main": "index.js",
"types": "types/index.d.ts",
ddiff --git a/src/community.js b/src/community.js
iindex 3f63401..bb97fe8 100644
---- a/src/community.js
++++ b/src/community.js
@@@ -13,8 +13,9 @@
* staff: true -> X-OV-Staff: 1 (the acting person is staff; needs .moderate)
* Community ignores X-OV-* headers from browsers.
*
-- * TODO: comments on other content, the forum and Pulse APIs are being added to Community now and
-- * are not wrapped yet; paste comments are.
++ * The Feed and status posts are here too: feed() reads GET /api/v1/feed (one stream from Pulse across every
++ * OpenVibe site) and posts.create() posts text with up to four pictures. Comments on other content, the rest of
++ * the forum and Pulse's service API are not wrapped yet; paste comments are.
*/
const { isOpenVibeError } = require('./core/errors');
const { isActingSubjectId } = require('./core/ids');
@@@ -102,8 +103,23 @@ function createCommunityClient(client, defaults = {}) {
},
};
++ const feed = (query = {}, o = {}) => call({
++ path: '/api/v1/feed',
++ query: { kind: query.kind, site: query.site, q: query.q, cursor: query.cursor, limit: query.limit,
++ following: query.following === true || query.following === 1 ? '1' : undefined },
++ }, o);
++ const posts = {
++ /**
++ * A status post in the Feed at once: { text, pictures?: [{ media_id, alt }] } (at most four, alt required,
++ * each media_id a Media object the person owns). -> { id, post_id, text, url, pictures, created_at }
++ */
++ create: (input = {}, o = {}) => call({ method: 'POST', path: '/api/v1/posts', json: input, ...once }, o),
++ };
++
return {
pastes,
++ feed,
++ posts,
/** The same client acting for someone else: as('usr_…') or as({ actingSubject, origin, sourceRef, staff }). */
as(who) {
const next = typeof who === 'string' ? { actingSubject: who } : { ...who };
ddiff --git a/src/core/index.js b/src/core/index.js
iindex 6a941be..1ac893e 100644
---- a/src/core/index.js
++++ b/src/core/index.js
@@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
const semver = require('./semver');
/** The package version (test/version.test.js keeps it equal to package.json). */
--const SDK_VERSION = '0.112.0';
++const SDK_VERSION = '0.113.0';
module.exports = {
createClient,
ddiff --git a/test/community.test.js b/test/community.test.js
iindex 61c30e6..de98869 100644
---- a/test/community.test.js
++++ b/test/community.test.js
@@@ -117,4 +117,27 @@ run([
assert.deepEqual(slugs, ['s1', 's2', 's3', 's4', 's5']);
await srv.close();
}],
++
++ ['the Feed and a status post: query, alt pictures in the body, acting subject, never retried', async () => {
++ const srv = await echo();
++ const community = createCommunityClient(createClient({ baseUrls: { community: srv.url } }), { actingSubject: USR });
++ const body = await community.feed({ kind: 'wiki', site: 'wiki', q: 'cats', following: true, cursor: 'abc', limit: 10 });
++ assert.deepEqual(body, { ok: true });
++ let r = srv.requests[0];
++ assert.equal(r.method, 'GET');
++ const url = new URL(r.url, 'http://x');
++ assert.equal(url.pathname, '/api/v1/feed');
++ assert.deepEqual(Object.fromEntries(url.searchParams), { kind: 'wiki', site: 'wiki', q: 'cats', cursor: 'abc', limit: '10', following: '1' });
++ assert.equal(hdr(r, 'X-OV-Subject'), USR);
++ const media = 'med_01JAB2C3D4E5F6G7H8J9K0MNPQ';
++ await community.posts.create({ text: 'Look', pictures: [{ media_id: media, alt: 'A white cat' }] });
++ r = srv.requests[1];
++ assert.equal(r.method, 'POST');
++ assert.equal(r.url, '/api/v1/posts');
++ assert.deepEqual(JSON.parse(r.body), { text: 'Look', pictures: [{ media_id: media, alt: 'A white cat' }] });
++ assert.equal(hdr(r, 'idempotency-key'), undefined, 'a post is a write Community does not dedupe');
++ await community.posts.create({ text: 'Plain' });
++ assert.deepEqual(JSON.parse(srv.requests[2].body), { text: 'Plain' });
++ await srv.close();
++ }],
]);
ddiff --git a/types/community.d.ts b/types/community.d.ts
iindex fe7147e..e024e8e 100644
---- a/types/community.d.ts
++++ b/types/community.d.ts
@@@ -33,8 +33,33 @@ export interface PastesApi {
delete(slug: string, commentId: string | number, opts?: CallOptions): Promise<unknown>;
};
}
++export type FeedKind = 'live' | 'stream' | 'clip' | 'video' | 'pic' | 'post' | 'meme' | 'game' | 'update' | 'wiki' | 'quest' | 'chat' | 'event' | 'member';
++export interface FeedQuery { kind?: FeedKind; site?: string; q?: string; following?: boolean | 1; cursor?: string; limit?: number; }
++export interface FeedItem {
++ id: string;
++ kind: FeedKind;
++ url: string;
++ title: string;
++ text: string;
++ at: string | null;
++ site: string;
++ site_name: string;
++ actor: { name: string | null; avatar: string | null } | null;
++ media: { thumb: string; ratio: number; length?: number } | null;
++ counts: { views?: number; likes?: number; comments?: number };
++ label?: 'Trending' | 'AI' | 'System';
++}
++export interface CreatePostInput {
++ text: string;
++ pictures?: Array<{ media_id: string; alt: string }>;
++}
++export interface PostsApi {
++ create(input: CreatePostInput, opts?: CallOptions): Promise<{ id: number; post_id: number; text: string; url: string; pictures: Array<{ media_id: string; alt: string | null; url?: string }>; created_at: string }>;
++}
export interface CommunityClient {
pastes: PastesApi;
++ feed(query?: FeedQuery, opts?: CallOptions): Promise<{ items: FeedItem[]; next_cursor: string | null }>;
++ posts: PostsApi;
as(who: string | ActingOptions): CommunityClient;
headers(): Record<string, string>;
}