openvibers/openvibe.blog Commits
changelog: Network's /api/v1/registry/releases lists services under 'services' (the test stub now answers in that shape)
Changes
@@@ -110,9 +110,10 @@ function createChangelog({ config, store, blogs, posts, aiDrafts = null, fetchImasync function registry() {const base = String(c.networkUrl).replace(/\/+$/, '');const [svc, rel] = await Promise.all([getJson(`${base}/api/v1/registry/services`), getJson(`${base}/api/v1/registry/releases`)]);-- const services = new Map((svc.services || svc || []).map((s) => [s.id, s]));++ const list = (x, key) => (Array.isArray(x) ? x : (x && (x[key] || x.services)) || []);++ const services = new Map(list(svc, 'services').map((s) => [s.id, s]));const out = [];-- for (const r of rel.releases || rel || []) {++ for (const r of list(rel, 'releases')) {const s = services.get(r.id);if (!s || !s.repository || !/^[0-9a-f]{7,40}$/.test(String(r.release || ''))) continue;if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(s.repository)) continue;@@@ -22,7 +22,7 @@ const H = (n) => n.toString(16).padStart(40, 'a');{ id: 'tools', name: 'OpenVibe.Tools', repository: 'OpenVibers/OpenVibe.Tools', publicOrigin: 'https://openvibe.tools' },{ id: 'norepo', name: 'X' },] });-- if (u.pathname === '/api/v1/registry/releases') return json({ releases: Object.entries(releases).map(([id, r]) => ({ id, release: r, released_at: new Date(t.clock.now()).toISOString() })) });++ if (u.pathname === '/api/v1/registry/releases') return json({ checked_at: null, libraries: [], behind: [], services: Object.entries(releases).map(([id, r]) => ({ id, release: r, released_at: new Date(t.clock.now()).toISOString() })) });if (u.hostname === 'api.github.com') {ghCalls.push(u.pathname);const m = u.pathname.match(/^\/repos\/(.+)\/compare\/(.+)\.\.\.(.+)$/);
@@ -110,9 +110,10 @@ function createChangelog({ config, store, blogs, posts, aiDrafts = null, fetchIm
@@ -110,9 +110,10 @@ function createChangelog({ config, store, blogs, posts, aiDrafts = null, fetchIm
async function registry() {
async function registry() {
const base = String(c.networkUrl).replace(/\/+$/, '');
const base = String(c.networkUrl).replace(/\/+$/, '');
const [svc, rel] = await Promise.all([getJson(`${base}/api/v1/registry/services`), getJson(`${base}/api/v1/registry/releases`)]);
const [svc, rel] = await Promise.all([getJson(`${base}/api/v1/registry/services`), getJson(`${base}/api/v1/registry/releases`)]);
- const services = new Map((svc.services || svc || []).map((s) => [s.id, s]));
+ const list = (x, key) => (Array.isArray(x) ? x : (x && (x[key] || x.services)) || []);
+ const services = new Map(list(svc, 'services').map((s) => [s.id, s]));
const out = [];
const out = [];
- for (const r of rel.releases || rel || []) {
+ for (const r of list(rel, 'releases')) {
const s = services.get(r.id);
const s = services.get(r.id);
if (!s || !s.repository || !/^[0-9a-f]{7,40}$/.test(String(r.release || ''))) continue;
if (!s || !s.repository || !/^[0-9a-f]{7,40}$/.test(String(r.release || ''))) continue;
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(s.repository)) continue;
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(s.repository)) continue;
@@ -22,7 +22,7 @@ const H = (n) => n.toString(16).padStart(40, 'a');
@@ -22,7 +22,7 @@ const H = (n) => n.toString(16).padStart(40, 'a');
{ id: 'tools', name: 'OpenVibe.Tools', repository: 'OpenVibers/OpenVibe.Tools', publicOrigin: 'https://openvibe.tools' },
{ id: 'tools', name: 'OpenVibe.Tools', repository: 'OpenVibers/OpenVibe.Tools', publicOrigin: 'https://openvibe.tools' },
{ id: 'norepo', name: 'X' },
{ id: 'norepo', name: 'X' },
] });
] });
- if (u.pathname === '/api/v1/registry/releases') return json({ releases: Object.entries(releases).map(([id, r]) => ({ id, release: r, released_at: new Date(t.clock.now()).toISOString() })) });
+ if (u.pathname === '/api/v1/registry/releases') return json({ checked_at: null, libraries: [], behind: [], services: Object.entries(releases).map(([id, r]) => ({ id, release: r, released_at: new Date(t.clock.now()).toISOString() })) });
if (u.hostname === 'api.github.com') {
if (u.hostname === 'api.github.com') {
ghCalls.push(u.pathname);
ghCalls.push(u.pathname);
const m = u.pathname.match(/^\/repos\/(.+)\/compare\/(.+)\.\.\.(.+)$/);
const m = u.pathname.match(/^\/repos\/(.+)\/compare\/(.+)\.\.\.(.+)$/);