Skip to content

Commit

Permalink
fix update
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Aug 29, 2024
1 parent 1be22bf commit 0884e59
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/api/src/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,28 @@ export class Record implements RecordModel {
delete updateMessage.datePublished;
}

const agentResponse = await this._agent.processDwnRequest({
const requestOptions: ProcessDwnRequest<DwnInterface.RecordsWrite> = {
author : this._connectedDid,
dataStream : dataBlob,
messageParams : { ...updateMessage },
messageType : DwnInterface.RecordsWrite,
target : this._connectedDid,
});
};
if (this._delegateDid) {
// if an app is scoped down to a specific protocolPath or contextId, it must include those filters in the read request
const { rawMessage: delegatedGrant } = await this.findPermissionGrantForMessage({
messageParams: {
messageType : DwnInterface.RecordsWrite,
protocol : this.protocol,
}
});

// set the required delegated grant and grantee DID for the read operation
requestOptions.messageParams.delegatedGrant = delegatedGrant;
requestOptions.granteeDid = this._delegateDid;
}

Check warning on line 763 in packages/api/src/record.ts

View check run for this annotation

Codecov / codecov/patch

packages/api/src/record.ts#L752-L763

Added lines #L752 - L763 were not covered by tests

const agentResponse = await this._agent.processDwnRequest(requestOptions);

const { message, reply: { status } } = agentResponse;
const responseMessage = message;
Expand Down

0 comments on commit 0884e59

Please sign in to comment.