You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* overwrite with version
- adding version match for overwrite
- testing locking
- generated tests (not implemented)
* AI loves CJS
* Update overwrite-optimistic-locking.test.js
* Let Claude have a try
* surely you jest
* ain't nobody got time for that
* Update db-controller.txt
* send this immediately
The expressError handling was turning this into a text error with no payload, just a message
* send object back
* why doctype error?
* experimenting with errors
* add message
* `message` is a bad key here
* notes don't work either
* Update API.html
---------
Co-authored-by: Bryan Haberberger <bryan.j.haberberger@slu.edu>
RERUM allows the Generator of a record to overwrite that record. An error will be returned if the agent encoded in the request "Authorization" access token does not match the <code__rerum.generatedBy></code> agent of the existing record. </span>
812
-
813
812
Replace a record using a reference to its internal RERUM id and receive the <codeclass="language-plaintext highlighter-rouge">Location</code> URI for the resulting record as a response header and the complete record as the response body.
814
-
815
813
This will have the effects of update, set, and unset actions. New keys will be created and keys not present in the request will not be present in the resulting record.
816
-
817
814
The record is replaced in place, or overwritten, and so the <codeclass="language-plaintext highlighter-rouge">@id</code> will not change and the history connected with this record will not be altered. The <code>__rerum.isOverwritten</code> property will be set to the date and time of the overwrite.
818
815
</p>
816
+
<p>
817
+
This endpoint supports optimistic locking, if requested. Including the "If-Overwritten-Version" header with the
818
+
value of the <codeclass="language-plaintext highlighter-rouge">__rerum.isOverwritten</code> property of the
819
+
record will cause the request to fail if the record has been overwritten since that time.
820
+
This is useful for preventing overwriting a record that has been changed by another agent, colliding within an
821
+
application that rapidly requests overwrites of the same object, or if an object is held in memory or cache for a
822
+
long time prior to the overwrite. Omitting the "If-Overwritten-Version" header or <codeclass="language-plaintext highlighter-rouge">__rerum.isOverwritten</code>
823
+
property will cause the request to succeed regardless.
Note that resp.headers.get("location") will return "https://devstore.rerum.io/v1/id/abcdef1234567890"
893
+
Note: resp.headers.get("location") will return "https://devstore.rerum.io/v1/id/abcdef1234567890"
882
894
</p>
883
895
<pclass="alert">
884
-
Note that the <code>@id</code> and <code>__rerum.history</code> properties of the original record "https://devstore.rerum.io/v1/id/abcdef1234567890" have not changed. This is the difference between /update and /overwrite. Be careful.
896
+
Note: the <code>@id</code> and <code>__rerum.history</code> properties of the original record "https://devstore.rerum.io/v1/id/abcdef1234567890" have not changed. This is the difference between /update and /overwrite. Be careful.
0 commit comments