Skip to content

Commit

Permalink
Pass option to initial write processing
Browse files Browse the repository at this point in the history
  • Loading branch information
csuwildcat committed Jan 30, 2024
1 parent 33cdf73 commit ae5ec5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api/src/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,12 @@ export class Record implements RecordModel {

const initialWrite = this._initialWrite;

// Is there an initial write? Have we already stored this record?
if (initialWrite && !this._initialWriteStored) {

let agentResponse = await this._processMessage({
import : _import,
store : true,
store : store,
rawMessage : {
contextId: this._contextId,
...initialWrite
Expand All @@ -398,6 +399,7 @@ export class Record implements RecordModel {
const { message, reply: { status } } = agentResponse;
const responseMessage = message as RecordsWriteMessage;

// If we are importing, make sure to update the initial write's authorization, because now it will have the owner's signature on it
if (200 <= status.code && status.code <= 299) {
this._initialWriteStored = true;
if (_import) initialWrite.authorization = responseMessage.authorization;
Expand Down

0 comments on commit ae5ec5e

Please sign in to comment.