@kravc/dos 1.11.9 → 1.11.11

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": "@kravc/dos",
3
- "version": "1.11.9",
3
+ "version": "1.11.11",
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,14 +207,12 @@ 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) {
211
- this._extendWithPartition(context, query)
212
-
213
- } else {
210
+ if (!originalDocument) {
214
211
  originalDocument = await this.read(context, query)
215
-
216
212
  }
217
213
 
214
+ this._extendWithPartition(context, query)
215
+
218
216
  const updatedItem = await this._update(query, mutation)
219
217
 
220
218
  const document = new this(context, updatedItem)
@@ -249,11 +247,8 @@ class Document extends Component {
249
247
  /* NOTE: ensure that document to be removed exists and save it in the
250
248
  context so can be referenced in the after action helper */
251
249
  const originalDocument = await this.read(context, query)
252
- const hasQueryPartition = !!query.partition
253
250
 
254
- if (!hasQueryPartition) {
255
- this._extendWithPartition(context, query)
256
- }
251
+ this._extendWithPartition(context, query)
257
252
 
258
253
  await this._delete(query, context)
259
254
 
package/src/index.d.ts CHANGED
@@ -40,6 +40,8 @@ export declare class Document<T> {
40
40
  static _create(attributes: AttributesMap): Promise<Boolean>;
41
41
  static _update(query: QueryMap, mutation: UpdateMutationMap): Promise<AttributesMap>;
42
42
 
43
+ static createId(attributes: AttributesMap): string;
44
+
43
45
  static getPartition(
44
46
  context: Context,
45
47
  parameters: Record<string, any>