|
48 | 48 | import type { ObjectStackProtocolImplementation, BatchDataLoopOutcome, BatchDataRowResult } from './protocol.js'; |
49 | 49 | import { byIdUpdateRecord, rowRequiredIdError, toRowApiError } from './protocol.js'; |
50 | 50 | import type { BatchUpdateRequest, BatchUpdateResponse, DeleteManyDataRequest, UpdateManyDataRequest } from '@objectstack/spec/api'; |
51 | | -import type { DroppedFieldsEvent } from '@objectstack/spec/data'; |
| 51 | +import type { DroppedFieldsEvent, EngineQueryOptionsParsed } from '@objectstack/spec/data'; |
52 | 52 | import type { ISecurityService } from '@objectstack/spec/contracts'; |
53 | 53 | import { engineCanRollBack, recordNotFoundError } from '@objectstack/core'; |
54 | 54 | import { omitInternalFieldsFromWriteResponse } from './write-response-internal-fields.js'; |
@@ -433,8 +433,10 @@ export async function runBatchDataLoop( |
433 | 433 | // under an insert's error — the masking ADR-0119 D4 |
434 | 434 | // forbade inside the atomic arm. |
435 | 435 | objectReadable ??= callerMayReadObject.call(this, object, context); |
| 436 | + const callerRead: EngineQueryOptionsParsed = { where: { id: record.id } }; |
| 437 | + if (context !== undefined) callerRead.context = context; |
436 | 438 | const existing = (await objectReadable) |
437 | | - ? await this.engine.findOne(object, { where: { id: record.id }, ...ctxOpt } as any) |
| 439 | + ? await this.engine.findOne(object, callerRead) |
438 | 440 | : null; |
439 | 441 | if (existing) { |
440 | 442 | const dropped: DroppedFieldsEvent[] = []; |
|
0 commit comments