Skip to content

Commit adf4e0c

Browse files
committed
fix(metadata-protocol): type the upsert fork's caller read instead of erasing its options
Claude-Session: https://claude.ai/code/session_017xRBcVy4VXmkQjn2MGeaWk Co-authored-by: Claude <noreply@anthropic.com>
1 parent bf59c1e commit adf4e0c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/metadata-protocol/src/protocol-batch-data.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import type { ObjectStackProtocolImplementation, BatchDataLoopOutcome, BatchDataRowResult } from './protocol.js';
4949
import { byIdUpdateRecord, rowRequiredIdError, toRowApiError } from './protocol.js';
5050
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';
5252
import type { ISecurityService } from '@objectstack/spec/contracts';
5353
import { engineCanRollBack, recordNotFoundError } from '@objectstack/core';
5454
import { omitInternalFieldsFromWriteResponse } from './write-response-internal-fields.js';
@@ -433,8 +433,10 @@ export async function runBatchDataLoop(
433433
// under an insert's error — the masking ADR-0119 D4
434434
// forbade inside the atomic arm.
435435
objectReadable ??= callerMayReadObject.call(this, object, context);
436+
const callerRead: EngineQueryOptionsParsed = { where: { id: record.id } };
437+
if (context !== undefined) callerRead.context = context;
436438
const existing = (await objectReadable)
437-
? await this.engine.findOne(object, { where: { id: record.id }, ...ctxOpt } as any)
439+
? await this.engine.findOne(object, callerRead)
438440
: null;
439441
if (existing) {
440442
const dropped: DroppedFieldsEvent[] = [];

0 commit comments

Comments
 (0)