@kravc/dos 1.11.8 → 1.11.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Document.js +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/dos",
3
- "version": "1.11.8",
3
+ "version": "1.11.9",
4
4
  "description": "Convention-based, easy-to-use library for building API-driven serverless services.",
5
5
  "keywords": [
6
6
  "Service",
package/src/Document.js CHANGED
@@ -207,11 +207,13 @@ class Document extends Component {
207
207
 
208
208
  /* NOTE: ensure that document to be updated exists and save it in the
209
209
  context so can be referenced in the after action helper */
210
- if (!originalDocument) {
210
+ if (originalDocument) {
211
+ this._extendWithPartition(context, query)
212
+
213
+ } else {
211
214
  originalDocument = await this.read(context, query)
212
- }
213
215
 
214
- this._extendWithPartition(context, query)
216
+ }
215
217
 
216
218
  const updatedItem = await this._update(query, mutation)
217
219
 
@@ -247,8 +249,11 @@ class Document extends Component {
247
249
  /* NOTE: ensure that document to be removed exists and save it in the
248
250
  context so can be referenced in the after action helper */
249
251
  const originalDocument = await this.read(context, query)
252
+ const hasQueryPartition = !!query.partition
250
253
 
251
- this._extendWithPartition(context, query)
254
+ if (!hasQueryPartition) {
255
+ this._extendWithPartition(context, query)
256
+ }
252
257
 
253
258
  await this._delete(query, context)
254
259