@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.mjs CHANGED
@@ -4319,9 +4319,13 @@ function normalizeReadResult(responseData, pathIsDocument) {
4319
4319
  let doc = responseData;
4320
4320
  // Unwrap the single-doc envelope `{ data, status }` (Bug 2). A real document
4321
4321
  // never has the exact shape `{ data, status }` with nothing else meaningful,
4322
- // so detect the envelope by `data` being present alongside a numeric `status`.
4322
+ // so detect the envelope by `data` + numeric `status` AND the absence of a
4323
+ // top-level `_id` (a real stored doc always carries `_id`/`pathId` from the
4324
+ // worker; the envelope wrapper does not). This avoids unwrapping a genuine
4325
+ // document that merely happens to own `data`/`status` fields.
4323
4326
  if (doc && typeof doc === 'object' && !Array.isArray(doc) &&
4324
- 'data' in doc && 'status' in doc && typeof doc.status === 'number') {
4327
+ 'data' in doc && 'status' in doc && typeof doc.status === 'number' &&
4328
+ !('_id' in doc) && !('pathId' in doc)) {
4325
4329
  doc = doc.data;
4326
4330
  }
4327
4331
  if (doc === undefined || doc === null)