openvibers/openvibe.sdk Commits
ov.meme: templates, render and get for the maker (#172)
Changes
@@@ -1,5 +1,9 @@# Changelog++## 0.130.0 (2026-11-09)++++- openvibe-sdk/meme: ov.meme.templates(), .render() (PNG, GIF or MP4) and .get()++## 0.129.0 — 2026-11-09- `openvibe-sdk/git` (G2): changes and review — `changes.list/get/create/comment/approve/merge/close/summary`,@@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags> Supported browser and server clients for the OpenVibe platform.--**Status:** alpha, v0.129.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.130.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.@@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tagsAfter v0.97.1 is tagged:```bash--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.129.0++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.130.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).@@@ -688,6 +688,22 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ developconst round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });await exchange.arena.vote(round.id, 'left');```++## Meme encyclopedia and renderer++++Search cited meme entries, read source and remix timelines, list reusable templates, and render a caption to raw image/video bytes:++++```js++const ov = require('openvibe-sdk');++const client = ov.createClient();++const memes = ov.meme.createMemeClient(client);++const { entries } = await memes.search({ scope: 'internet', q: 'Doge' });++const { templates } = await memes.templates();++const png = await memes.render({ template_id: templates[0].id, lines: ['Much quality', 'such tiny SDK'] });++// png.bytes is an ArrayBuffer; png.contentType is image/png (or image/gif / video/mp4).++```++++See [the Meme client](docs/meme.md) for the render options and response details.++## Camera settingsCamera choices can be read or saved on behalf of a signed-in person with `ov.cam.settings.get({ token })` and@@@ -3,7 +3,7 @@"stage": "alpha","code": true,"wave": "W2",-- "version": "0.129.0",++ "version": "0.130.0","plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730","deployed": false,"deployment": "none: a package released as git tags; services and apps pin a tag",@@@ -1,4 +1,4 @@--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.129.0, MIT). Do not edit.++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.130.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, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity./* eslint-disable */@@@ -56,7 +56,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.129.0';++const SDK_VERSION = '0.130.0';module.exports = {createClient,@@@ -4058,10 +4058,25 @@ function createMemeClient(client, defaults = {}) {}) }, o),/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),++ /** GET /api/v1/entries/:slug — the same read under the product's `get` name. */++ get: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),++ /** GET /api/v1/templates — reusable templates and their image licences. */++ templates: (o = {}) => call({ path: '/api/v1/templates' }, o),++ /** POST /api/v1/render — raw PNG, GIF, or MP4 bytes from a licensed template and caption. */++ async render(input = {}, o = {}) {++ const templateId = String(input.template_id || input.templateId || '').trim();++ if (!templateId) throw new TypeError('render: template_id is required');++ if (!Array.isArray(input.lines) || input.lines.length < 1 || input.lines.length > 4 || input.lines.some((line) => typeof line !== 'string' || line.length > 120)) throw new TypeError('render: lines must contain 1–4 strings of at most 120 characters');++ const body = { template_id: templateId, lines: input.lines };++ if (input.format != null) body.format = input.format;++ if (input.editor != null) body.editor = input.editor;++ const response = await client.request({ method: 'POST', path: '/api/v1/render', service: 'meme', baseUrl: defaults.baseUrl, audience: 'openvibe.meme', responseType: 'arrayBuffer', json: body, signal: o.signal });++ return { bytes: response.data, contentType: response.headers.get('content-type') || 'application/octet-stream' };++ },/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */analyze: (input = {}, o = {}) => {const url = input.url == null ? null : String(input.url);nnew file mode 100644@@@ -0,0 +1,22 @@++# Meme client++++`openvibe-sdk/meme` exposes the public OpenVibe.Meme API. It works in Node and browsers; public reads do not need a token, while render writes use the token from the core client.++++```js++const ov = require('openvibe-sdk');++const client = ov.createClient();++const meme = ov.meme.createMemeClient(client);++++const { entries } = await meme.search({ scope: 'internet', q: 'Distracted Boyfriend' });++const entry = await meme.get(entries[0].slug); // entry() is the same read++const { templates } = await meme.templates();++const rendered = await meme.render({++ template_id: templates[0].id,++ lines: ['new format', 'same old bug'],++ format: 'png',++ editor: { font_style: 'impact', font_size: 30, crop_x: 50, crop_y: 50 },++});++// rendered.bytes is an ArrayBuffer; rendered.contentType is image/png.++```++++`search(query)` accepts the same scope, text, kind, label, status, sort and usage-window filters as the HTTP API. `get(slug)` (or its older name, `entry(slug)`) reads one entry. `templates()` returns the reusable formats and their source/licence details. `render(input)` accepts one to four lines (up to 120 characters each), `png`, `gif` or `mp4`, and optional editor state; it returns `{ bytes, contentType }` without decoding the response as JSON. A render is a signed-in write and can fail with the API's problem response for an unavailable template, rejected caption, or missing sign-in.@@@ -1,12 +1,12 @@{"name": "openvibe-sdk",-- "version": "0.129.0",++ "version": "0.130.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openvibe-sdk",-- "version": "0.129.0",++ "version": "0.130.0","license": "MIT","bin": {"openvibe-download": "bin/openvibe-download.js"@@@ -1,6 +1,6 @@{"name": "openvibe-sdk",-- "version": "0.129.0",++ "version": "0.130.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",@@@ -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.129.0';++const SDK_VERSION = '0.130.0';module.exports = {createClient,@@@ -34,10 +34,25 @@ function createMemeClient(client, defaults = {}) {}) }, o),/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),++ /** GET /api/v1/entries/:slug — the same read under the product's `get` name. */++ get: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),++ /** GET /api/v1/templates — reusable templates and their image licences. */++ templates: (o = {}) => call({ path: '/api/v1/templates' }, o),++ /** POST /api/v1/render — raw PNG, GIF, or MP4 bytes from a licensed template and caption. */++ async render(input = {}, o = {}) {++ const templateId = String(input.template_id || input.templateId || '').trim();++ if (!templateId) throw new TypeError('render: template_id is required');++ if (!Array.isArray(input.lines) || input.lines.length < 1 || input.lines.length > 4 || input.lines.some((line) => typeof line !== 'string' || line.length > 120)) throw new TypeError('render: lines must contain 1–4 strings of at most 120 characters');++ const body = { template_id: templateId, lines: input.lines };++ if (input.format != null) body.format = input.format;++ if (input.editor != null) body.editor = input.editor;++ const response = await client.request({ method: 'POST', path: '/api/v1/render', service: 'meme', baseUrl: defaults.baseUrl, audience: 'openvibe.meme', responseType: 'arrayBuffer', json: body, signal: o.signal });++ return { bytes: response.data, contentType: response.headers.get('content-type') || 'application/octet-stream' };++ },/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */analyze: (input = {}, o = {}) => {const url = input.url == null ? null : String(input.url);@@@ -13,6 +13,8 @@ async function memeServer() {if (u.pathname === '/api/v1/entries/doge/revisions') return send(res, 200, { slug: 'doge', count: 0, revisions: [] });if (u.pathname === '/api/v1/entries/missing') return problem(res, 404, 'meme.not_found', 'No such meme.');if (u.pathname === '/api/v1/trends') return send(res, 200, { window: 'week', rising: [], templates: [], entries: [], subreddits: [] });++ if (u.pathname === '/api/v1/templates') return send(res, 200, { count: 1, templates: [{ id: 'tpl_classic', name: 'Classic', license: 'OpenVibe' }] });++ if (u.pathname === '/api/v1/render' && req.method === 'POST') { res.statusCode = 200; res.setHeader('content-type', 'image/png'); res.end(Buffer.from('fake-png')); return; }if (u.pathname === '/api/v1/analyze') return send(res, 200, { id: 'anl_1', template: { name: 'Doge' }, labels: ['language'] });if (u.pathname === '/api/v1/research' && req.method === 'POST') return send(res, 202, { id: 'rsc_1', topic: 'Doge', status: 'queued' });if (u.pathname === '/api/v1/research/rsc_1' && req.method === 'GET') return send(res, 200, { id: 'rsc_1', status: 'succeeded', sources: [] });@@@ -41,8 +43,14 @@ run([assert.equal(searchReq.searchParams.get('limit'), '5');assert.equal((await meme.entry('doge')).origin.url, 'https://example.com/doge');++ assert.equal((await meme.get('doge')).origin.url, 'https://example.com/doge');assert.equal((await meme.revisions('doge')).count, 0);assert.equal((await meme.trends({ window: 'week' })).window, 'week');++ assert.equal((await meme.templates()).templates[0].id, 'tpl_classic');++ const rendered = await meme.render({ template_id: 'tpl_classic', lines: ['hello'], format: 'png', editor: { font_style: 'modern' } });++ assert.equal(rendered.contentType, 'image/png');++ assert.equal(Buffer.from(rendered.bytes).toString(), 'fake-png');++ assert.deepEqual(JSON.parse(srv.requests.at(-1).body.toString('utf8')), { template_id: 'tpl_classic', lines: ['hello'], format: 'png', editor: { font_style: 'modern' } });assert.equal((await meme.analyze({ url: 'https://example.com/doge.png' })).id, 'anl_1');assert.equal((await meme.analyze({ mediaId: 'med_1' })).id, 'anl_1');const analyzeBody = JSON.parse(srv.requests.at(-1).body.toString('utf8'));@@@ -66,6 +74,7 @@ run([assert.throws(() => meme.analyze({}), TypeError);assert.throws(() => meme.analyze({ url: 'https://x.test/a.png', media_id: 'med_1' }), TypeError);assert.throws(() => meme.generate({}), TypeError);++ await assert.rejects(() => meme.render({ template_id: 'tpl_classic', lines: [] }), TypeError);assert.equal(srv.requests.length, 0, 'no request left the client for a bad input');await assert.rejects(() => meme.entry('missing'), (err) => err instanceof OpenVibeError && err.status === 404 && err.code === 'meme.not_found');} finally { await srv.close(); }@@@ -2,6 +2,15 @@ import type { OpenVibeClient } from './core';export interface MemeOptions { signal?: AbortSignal; }export interface MemeDefaults extends MemeOptions { baseUrl?: string; }++export interface MemeTemplate { id: string; name: string; image_url: string; box_count: number; source: string; license: string; credit?: string; source_url?: string; layout?: Record<string, unknown>; captions?: number; uses_today?: number; }++export interface MemeRenderInput {++ template_id?: string;++ templateId?: string;++ lines: string[];++ format?: 'png' | 'gif' | 'mp4';++ editor?: Record<string, unknown>;++}++export interface MemeRenderOutput { bytes: ArrayBuffer; contentType: string; }export type MemeScope = 'openvibe' | 'internet';export type MemeStatus = 'rising' | 'peaked' | 'classic' | 'dead';@@@ -174,8 +183,12 @@ export interface MemeGenerateResult {export interface MemeClient {search(query?: MemeSearchQuery): Promise<MemeSearchResult>;entry(slug: string, opts?: MemeOptions): Promise<MemeEntryDetail>;++ /** The same read as entry(), under the product's `get` name. */++ get(slug: string, opts?: MemeOptions): Promise<MemeEntryDetail>;revisions(slug: string, opts?: MemeOptions): Promise<{ slug: string; count: number; revisions: MemeRevision[] }>;trends(opts?: { window?: 'day' | 'week'; limit?: number } & MemeOptions): Promise<MemeTrends>;++ templates(opts?: MemeOptions): Promise<{ count: number; templates: MemeTemplate[] }>;++ render(input: MemeRenderInput, opts?: MemeOptions): Promise<MemeRenderOutput>;analyze(input: MemeAnalysisInput, opts?: MemeOptions): Promise<MemeAnalysis>;research(topic: string, opts?: MemeOptions): Promise<MemeResearch>;researchGet(id: string, opts?: MemeOptions): Promise<MemeResearch>;
@@ -1,5 +1,9 @@
@@ -1,5 +1,9 @@
# Changelog
# Changelog
+## 0.130.0 (2026-11-09)
+
+- openvibe-sdk/meme: ov.meme.templates(), .render() (PNG, GIF or MP4) and .get()
+
## 0.129.0 — 2026-11-09
## 0.129.0 — 2026-11-09
- `openvibe-sdk/git` (G2): changes and review — `changes.list/get/create/comment/approve/merge/close/summary`,
- `openvibe-sdk/git` (G2): changes and review — `changes.list/get/create/comment/approve/merge/close/summary`,
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
> Supported browser and server clients for the OpenVibe platform.
> Supported browser and server clients for the OpenVibe platform.
-**Status:** alpha, v0.129.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.130.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.
**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.
**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.
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
After v0.97.1 is tagged:
After v0.97.1 is tagged:
```bash
```bash
-npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.129.0
+npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.130.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).
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).
@@ -688,6 +688,22 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ develop
@@ -688,6 +688,22 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ develop
const round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });
const round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });
await exchange.arena.vote(round.id, 'left');
await exchange.arena.vote(round.id, 'left');
```
```
+## Meme encyclopedia and renderer
+
+Search cited meme entries, read source and remix timelines, list reusable templates, and render a caption to raw image/video bytes:
+
+```js
+const ov = require('openvibe-sdk');
+const client = ov.createClient();
+const memes = ov.meme.createMemeClient(client);
+const { entries } = await memes.search({ scope: 'internet', q: 'Doge' });
+const { templates } = await memes.templates();
+const png = await memes.render({ template_id: templates[0].id, lines: ['Much quality', 'such tiny SDK'] });
+// png.bytes is an ArrayBuffer; png.contentType is image/png (or image/gif / video/mp4).
+```
+
+See [the Meme client](docs/meme.md) for the render options and response details.
+
## Camera settings
## Camera settings
Camera choices can be read or saved on behalf of a signed-in person with `ov.cam.settings.get({ token })` and
Camera choices can be read or saved on behalf of a signed-in person with `ov.cam.settings.get({ token })` and
@@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
"stage": "alpha",
"stage": "alpha",
"code": true,
"code": true,
"wave": "W2",
"wave": "W2",
- "version": "0.129.0",
+ "version": "0.130.0",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730",
"deployed": false,
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
"deployment": "none: a package released as git tags; services and apps pin a tag",
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
-// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.129.0, MIT). Do not edit.
+// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.130.0, MIT). Do not edit.
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// 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, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
// (auth, locker, registry, trust, modules, realtime, media, cam, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
/* eslint-disable */
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
const semver = __load(6);
const semver = __load(6);
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.129.0';
+const SDK_VERSION = '0.130.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -4058,10 +4058,25 @@ function createMemeClient(client, defaults = {}) {
@@ -4058,10 +4058,25 @@ function createMemeClient(client, defaults = {}) {
}) }, o),
}) }, o),
/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */
/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */
entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
+ /** GET /api/v1/entries/:slug — the same read under the product's `get` name. */
+ get: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */
/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */
revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),
revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),
/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */
/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */
trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),
trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),
+ /** GET /api/v1/templates — reusable templates and their image licences. */
+ templates: (o = {}) => call({ path: '/api/v1/templates' }, o),
+ /** POST /api/v1/render — raw PNG, GIF, or MP4 bytes from a licensed template and caption. */
+ async render(input = {}, o = {}) {
+ const templateId = String(input.template_id || input.templateId || '').trim();
+ if (!templateId) throw new TypeError('render: template_id is required');
+ if (!Array.isArray(input.lines) || input.lines.length < 1 || input.lines.length > 4 || input.lines.some((line) => typeof line !== 'string' || line.length > 120)) throw new TypeError('render: lines must contain 1–4 strings of at most 120 characters');
+ const body = { template_id: templateId, lines: input.lines };
+ if (input.format != null) body.format = input.format;
+ if (input.editor != null) body.editor = input.editor;
+ const response = await client.request({ method: 'POST', path: '/api/v1/render', service: 'meme', baseUrl: defaults.baseUrl, audience: 'openvibe.meme', responseType: 'arrayBuffer', json: body, signal: o.signal });
+ return { bytes: response.data, contentType: response.headers.get('content-type') || 'application/octet-stream' };
+ },
/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */
/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */
analyze: (input = {}, o = {}) => {
analyze: (input = {}, o = {}) => {
const url = input.url == null ? null : String(input.url);
const url = input.url == null ? null : String(input.url);
new file mode 100644
new file mode 100644
@@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
+# Meme client
+
+`openvibe-sdk/meme` exposes the public OpenVibe.Meme API. It works in Node and browsers; public reads do not need a token, while render writes use the token from the core client.
+
+```js
+const ov = require('openvibe-sdk');
+const client = ov.createClient();
+const meme = ov.meme.createMemeClient(client);
+
+const { entries } = await meme.search({ scope: 'internet', q: 'Distracted Boyfriend' });
+const entry = await meme.get(entries[0].slug); // entry() is the same read
+const { templates } = await meme.templates();
+const rendered = await meme.render({
+ template_id: templates[0].id,
+ lines: ['new format', 'same old bug'],
+ format: 'png',
+ editor: { font_style: 'impact', font_size: 30, crop_x: 50, crop_y: 50 },
+});
+// rendered.bytes is an ArrayBuffer; rendered.contentType is image/png.
+```
+
+`search(query)` accepts the same scope, text, kind, label, status, sort and usage-window filters as the HTTP API. `get(slug)` (or its older name, `entry(slug)`) reads one entry. `templates()` returns the reusable formats and their source/licence details. `render(input)` accepts one to four lines (up to 120 characters each), `png`, `gif` or `mp4`, and optional editor state; it returns `{ bytes, contentType }` without decoding the response as JSON. A render is a signed-in write and can fail with the API's problem response for an unavailable template, rejected caption, or missing sign-in.
@@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.129.0",
+ "version": "0.130.0",
"lockfileVersion": 3,
"lockfileVersion": 3,
"requires": true,
"requires": true,
"packages": {
"packages": {
"": {
"": {
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.129.0",
+ "version": "0.130.0",
"license": "MIT",
"license": "MIT",
"bin": {
"bin": {
"openvibe-download": "bin/openvibe-download.js"
"openvibe-download": "bin/openvibe-download.js"
@@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.129.0",
+ "version": "0.130.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.",
"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",
"main": "index.js",
"types": "types/index.d.ts",
"types": "types/index.d.ts",
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
const semver = require('./semver');
const semver = require('./semver');
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.129.0';
+const SDK_VERSION = '0.130.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -34,10 +34,25 @@ function createMemeClient(client, defaults = {}) {
@@ -34,10 +34,25 @@ function createMemeClient(client, defaults = {}) {
}) }, o),
}) }, o),
/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */
/** GET /api/v1/entries/:slug — origin, citations, spread, variations, examples, related and revisions. */
entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
entry: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
+ /** GET /api/v1/entries/:slug — the same read under the product's `get` name. */
+ get: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}` }, o),
/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */
/** GET /api/v1/entries/:slug/revisions — approved history (staff see pending/rejected too). */
revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),
revisions: (slug, o = {}) => call({ path: `/api/v1/entries/${enc(slug)}/revisions` }, o),
/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */
/** GET /api/v1/trends?window=day|week — rising posts with velocity, new templates and entries. */
trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),
trends: (opts = {}, o = {}) => call({ path: '/api/v1/trends', query: queryOf({ window: opts.window || 'day', limit: opts.limit }) }, o),
+ /** GET /api/v1/templates — reusable templates and their image licences. */
+ templates: (o = {}) => call({ path: '/api/v1/templates' }, o),
+ /** POST /api/v1/render — raw PNG, GIF, or MP4 bytes from a licensed template and caption. */
+ async render(input = {}, o = {}) {
+ const templateId = String(input.template_id || input.templateId || '').trim();
+ if (!templateId) throw new TypeError('render: template_id is required');
+ if (!Array.isArray(input.lines) || input.lines.length < 1 || input.lines.length > 4 || input.lines.some((line) => typeof line !== 'string' || line.length > 120)) throw new TypeError('render: lines must contain 1–4 strings of at most 120 characters');
+ const body = { template_id: templateId, lines: input.lines };
+ if (input.format != null) body.format = input.format;
+ if (input.editor != null) body.editor = input.editor;
+ const response = await client.request({ method: 'POST', path: '/api/v1/render', service: 'meme', baseUrl: defaults.baseUrl, audience: 'openvibe.meme', responseType: 'arrayBuffer', json: body, signal: o.signal });
+ return { bytes: response.data, contentType: response.headers.get('content-type') || 'application/octet-stream' };
+ },
/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */
/** POST /api/v1/analyze { url | media_id } — the template, matches, origins, meaning, labels, Reddit spread/tone. */
analyze: (input = {}, o = {}) => {
analyze: (input = {}, o = {}) => {
const url = input.url == null ? null : String(input.url);
const url = input.url == null ? null : String(input.url);
@@ -13,6 +13,8 @@ async function memeServer() {
@@ -13,6 +13,8 @@ async function memeServer() {
if (u.pathname === '/api/v1/entries/doge/revisions') return send(res, 200, { slug: 'doge', count: 0, revisions: [] });
if (u.pathname === '/api/v1/entries/doge/revisions') return send(res, 200, { slug: 'doge', count: 0, revisions: [] });
if (u.pathname === '/api/v1/entries/missing') return problem(res, 404, 'meme.not_found', 'No such meme.');
if (u.pathname === '/api/v1/entries/missing') return problem(res, 404, 'meme.not_found', 'No such meme.');
if (u.pathname === '/api/v1/trends') return send(res, 200, { window: 'week', rising: [], templates: [], entries: [], subreddits: [] });
if (u.pathname === '/api/v1/trends') return send(res, 200, { window: 'week', rising: [], templates: [], entries: [], subreddits: [] });
+ if (u.pathname === '/api/v1/templates') return send(res, 200, { count: 1, templates: [{ id: 'tpl_classic', name: 'Classic', license: 'OpenVibe' }] });
+ if (u.pathname === '/api/v1/render' && req.method === 'POST') { res.statusCode = 200; res.setHeader('content-type', 'image/png'); res.end(Buffer.from('fake-png')); return; }
if (u.pathname === '/api/v1/analyze') return send(res, 200, { id: 'anl_1', template: { name: 'Doge' }, labels: ['language'] });
if (u.pathname === '/api/v1/analyze') return send(res, 200, { id: 'anl_1', template: { name: 'Doge' }, labels: ['language'] });
if (u.pathname === '/api/v1/research' && req.method === 'POST') return send(res, 202, { id: 'rsc_1', topic: 'Doge', status: 'queued' });
if (u.pathname === '/api/v1/research' && req.method === 'POST') return send(res, 202, { id: 'rsc_1', topic: 'Doge', status: 'queued' });
if (u.pathname === '/api/v1/research/rsc_1' && req.method === 'GET') return send(res, 200, { id: 'rsc_1', status: 'succeeded', sources: [] });
if (u.pathname === '/api/v1/research/rsc_1' && req.method === 'GET') return send(res, 200, { id: 'rsc_1', status: 'succeeded', sources: [] });
@@ -41,8 +43,14 @@ run([
@@ -41,8 +43,14 @@ run([
assert.equal(searchReq.searchParams.get('limit'), '5');
assert.equal(searchReq.searchParams.get('limit'), '5');
assert.equal((await meme.entry('doge')).origin.url, 'https://example.com/doge');
assert.equal((await meme.entry('doge')).origin.url, 'https://example.com/doge');
+ assert.equal((await meme.get('doge')).origin.url, 'https://example.com/doge');
assert.equal((await meme.revisions('doge')).count, 0);
assert.equal((await meme.revisions('doge')).count, 0);
assert.equal((await meme.trends({ window: 'week' })).window, 'week');
assert.equal((await meme.trends({ window: 'week' })).window, 'week');
+ assert.equal((await meme.templates()).templates[0].id, 'tpl_classic');
+ const rendered = await meme.render({ template_id: 'tpl_classic', lines: ['hello'], format: 'png', editor: { font_style: 'modern' } });
+ assert.equal(rendered.contentType, 'image/png');
+ assert.equal(Buffer.from(rendered.bytes).toString(), 'fake-png');
+ assert.deepEqual(JSON.parse(srv.requests.at(-1).body.toString('utf8')), { template_id: 'tpl_classic', lines: ['hello'], format: 'png', editor: { font_style: 'modern' } });
assert.equal((await meme.analyze({ url: 'https://example.com/doge.png' })).id, 'anl_1');
assert.equal((await meme.analyze({ url: 'https://example.com/doge.png' })).id, 'anl_1');
assert.equal((await meme.analyze({ mediaId: 'med_1' })).id, 'anl_1');
assert.equal((await meme.analyze({ mediaId: 'med_1' })).id, 'anl_1');
const analyzeBody = JSON.parse(srv.requests.at(-1).body.toString('utf8'));
const analyzeBody = JSON.parse(srv.requests.at(-1).body.toString('utf8'));
@@ -66,6 +74,7 @@ run([
@@ -66,6 +74,7 @@ run([
assert.throws(() => meme.analyze({}), TypeError);
assert.throws(() => meme.analyze({}), TypeError);
assert.throws(() => meme.analyze({ url: 'https://x.test/a.png', media_id: 'med_1' }), TypeError);
assert.throws(() => meme.analyze({ url: 'https://x.test/a.png', media_id: 'med_1' }), TypeError);
assert.throws(() => meme.generate({}), TypeError);
assert.throws(() => meme.generate({}), TypeError);
+ await assert.rejects(() => meme.render({ template_id: 'tpl_classic', lines: [] }), TypeError);
assert.equal(srv.requests.length, 0, 'no request left the client for a bad input');
assert.equal(srv.requests.length, 0, 'no request left the client for a bad input');
await assert.rejects(() => meme.entry('missing'), (err) => err instanceof OpenVibeError && err.status === 404 && err.code === 'meme.not_found');
await assert.rejects(() => meme.entry('missing'), (err) => err instanceof OpenVibeError && err.status === 404 && err.code === 'meme.not_found');
} finally { await srv.close(); }
} finally { await srv.close(); }
@@ -2,6 +2,15 @@ import type { OpenVibeClient } from './core';
@@ -2,6 +2,15 @@ import type { OpenVibeClient } from './core';
export interface MemeOptions { signal?: AbortSignal; }
export interface MemeOptions { signal?: AbortSignal; }
export interface MemeDefaults extends MemeOptions { baseUrl?: string; }
export interface MemeDefaults extends MemeOptions { baseUrl?: string; }
+export interface MemeTemplate { id: string; name: string; image_url: string; box_count: number; source: string; license: string; credit?: string; source_url?: string; layout?: Record<string, unknown>; captions?: number; uses_today?: number; }
+export interface MemeRenderInput {
+ template_id?: string;
+ templateId?: string;
+ lines: string[];
+ format?: 'png' | 'gif' | 'mp4';
+ editor?: Record<string, unknown>;
+}
+export interface MemeRenderOutput { bytes: ArrayBuffer; contentType: string; }
export type MemeScope = 'openvibe' | 'internet';
export type MemeScope = 'openvibe' | 'internet';
export type MemeStatus = 'rising' | 'peaked' | 'classic' | 'dead';
export type MemeStatus = 'rising' | 'peaked' | 'classic' | 'dead';
@@ -174,8 +183,12 @@ export interface MemeGenerateResult {
@@ -174,8 +183,12 @@ export interface MemeGenerateResult {
export interface MemeClient {
export interface MemeClient {
search(query?: MemeSearchQuery): Promise<MemeSearchResult>;
search(query?: MemeSearchQuery): Promise<MemeSearchResult>;
entry(slug: string, opts?: MemeOptions): Promise<MemeEntryDetail>;
entry(slug: string, opts?: MemeOptions): Promise<MemeEntryDetail>;
+ /** The same read as entry(), under the product's `get` name. */
+ get(slug: string, opts?: MemeOptions): Promise<MemeEntryDetail>;
revisions(slug: string, opts?: MemeOptions): Promise<{ slug: string; count: number; revisions: MemeRevision[] }>;
revisions(slug: string, opts?: MemeOptions): Promise<{ slug: string; count: number; revisions: MemeRevision[] }>;
trends(opts?: { window?: 'day' | 'week'; limit?: number } & MemeOptions): Promise<MemeTrends>;
trends(opts?: { window?: 'day' | 'week'; limit?: number } & MemeOptions): Promise<MemeTrends>;
+ templates(opts?: MemeOptions): Promise<{ count: number; templates: MemeTemplate[] }>;
+ render(input: MemeRenderInput, opts?: MemeOptions): Promise<MemeRenderOutput>;
analyze(input: MemeAnalysisInput, opts?: MemeOptions): Promise<MemeAnalysis>;
analyze(input: MemeAnalysisInput, opts?: MemeOptions): Promise<MemeAnalysis>;
research(topic: string, opts?: MemeOptions): Promise<MemeResearch>;
research(topic: string, opts?: MemeOptions): Promise<MemeResearch>;
researchGet(id: string, opts?: MemeOptions): Promise<MemeResearch>;
researchGet(id: string, opts?: MemeOptions): Promise<MemeResearch>;