Skip to content

Commit 3b2e6f4

Browse files
committed
fix(cmc): readOffer must use streams not streamIds on events.get
`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.
1 parent 128e3f0 commit 3b2e6f4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

components/pryv-cmc/src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,12 @@ async function requestScopeUpdate (conn, params) {
550550
async function readOffer (capabilityUrl, opts) {
551551
const pryv = (opts && opts.pryv) || require('pryv');
552552
const cap = new pryv.Connection(capabilityUrl);
553+
// `events.get` takes `streams` (recursive read filter), not `streamIds`
554+
// (which is the events.create write target). Mirror the field used by
555+
// the other events.get callers in this file (listInvites, waitForAccept,
556+
// listAcceptedRelationships).
553557
const events = await cap.apiOne('events.get', {
554-
streamIds: [NS_INTERNAL + ':offer'],
558+
streams: [NS_INTERNAL + ':offer'],
555559
limit: 1
556560
}, 'events');
557561
if (events.length === 0) {

0 commit comments

Comments
 (0)