From 214c0bea103b312a922351ce3361e3e1c2a27753 Mon Sep 17 00:00:00 2001 From: Perki Date: Tue, 19 May 2026 12:54:13 +0200 Subject: [PATCH] fix(cmc): readOffer must use `streams` not `streamIds` on events.get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `readOffer` was calling `events.get` with `streamIds: [...]` which the api-server schema rejects with OBJECT_ADDITIONAL_PROPERTIES. `events.get` takes `streams` (recursive read filter); `streamIds` is the `events.create` write target. The four other `events.get` callers in this file (listInvites, waitForAccept, listAcceptedRelationships) all already use `streams` correctly. Reproduces 100% against any open-pryv.io running the CMC plugin — any `cmc.readOffer(capabilityUrl)` call throws on the first await. No new tests in this PR — existing cmc.test.js suite mocks the Connection.apiOne layer and doesn't exercise the wire-shape; the schema mismatch only surfaces against a real api-server. End-to-end verification via an HDS-side scenario test runs green post-fix. --- components/pryv-cmc/src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/pryv-cmc/src/index.js b/components/pryv-cmc/src/index.js index 4cbaa18..bc6ca18 100644 --- a/components/pryv-cmc/src/index.js +++ b/components/pryv-cmc/src/index.js @@ -550,8 +550,12 @@ async function requestScopeUpdate (conn, params) { async function readOffer (capabilityUrl, opts) { const pryv = (opts && opts.pryv) || require('pryv'); const cap = new pryv.Connection(capabilityUrl); + // `events.get` takes `streams` (recursive read filter), not `streamIds` + // (which is the events.create write target). Mirror the field used by + // the other events.get callers in this file (listInvites, waitForAccept, + // listAcceptedRelationships). const events = await cap.apiOne('events.get', { - streamIds: [NS_INTERNAL + ':offer'], + streams: [NS_INTERNAL + ':offer'], limit: 1 }, 'events'); if (events.length === 0) {