@bounded-sh/core 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4339,9 +4339,13 @@ function normalizeReadResult(responseData, pathIsDocument) {
4339
4339
  let doc = responseData;
4340
4340
  // Unwrap the single-doc envelope `{ data, status }` (Bug 2). A real document
4341
4341
  // never has the exact shape `{ data, status }` with nothing else meaningful,
4342
- // so detect the envelope by `data` being present alongside a numeric `status`.
4342
+ // so detect the envelope by `data` + numeric `status` AND the absence of a
4343
+ // top-level `_id` (a real stored doc always carries `_id`/`pathId` from the
4344
+ // worker; the envelope wrapper does not). This avoids unwrapping a genuine
4345
+ // document that merely happens to own `data`/`status` fields.
4343
4346
  if (doc && typeof doc === 'object' && !Array.isArray(doc) &&
4344
- 'data' in doc && 'status' in doc && typeof doc.status === 'number') {
4347
+ 'data' in doc && 'status' in doc && typeof doc.status === 'number' &&
4348
+ !('_id' in doc) && !('pathId' in doc)) {
4345
4349
  doc = doc.data;
4346
4350
  }
4347
4351
  if (doc === undefined || doc === null)