@odatano/core 2.0.0-rc.2 → 2.0.0-rc.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatano/core",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0-rc.3",
4
4
  "description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
5
5
  "imports": {
6
6
  "#cds-models/*": "./@cds-models/*/index.js"
@@ -76,12 +76,16 @@ function indexOnMissRead(entity, reqKeyField, validate, indexFn, options) {
76
76
  // Populate the row (+ compositions) on a miss, then let CAP run the client's
77
77
  // query — one extra SELECT per keyed read, but $expand/$select (and the
78
78
  // temporal filter of the projection) apply exactly as on the un-keyed path.
79
- const indexed = existing ? undefined : await indexFn(db, key);
80
- const result = await db.run(req.query);
81
- // Safety net: if the freshly written slice is still outside the session's
82
- // temporal window (widening had no effect, e.g. the transaction was already
83
- // open), degrade to the pre-#13 behaviour — bare row instead of a wrong 404.
84
- return result ?? indexed ?? existing;
79
+ if (!existing)
80
+ await indexFn(db, key);
81
+ // The client's query is the ONLY authority on what comes back. Falling back
82
+ // to `existing` (or the indexer's return value) when it matches nothing
83
+ // answers a request the client never made — a second key that does not
84
+ // match, or an excluding $filter, would get a sibling row with a 200
85
+ // instead of a 404 (KNOWN_ISSUES #15). Non-temporal entities always see
86
+ // their fresh rows here; temporal ones rely on widenTemporalWindow above,
87
+ // and if that ever stops working the failure is a loud 404 covered by
88
+ // test/integration/keyed-read-expand.test.ts, not silently wrong data.
85
89
  }
86
90
  return db.run(req.query);
87
91
  });