@kravc/dos 1.8.9 → 1.8.10

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 +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/dos",
3
- "version": "1.8.9",
3
+ "version": "1.8.10",
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
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
- const { get, omit, capitalize } = require('lodash')
4
3
  const { ulid } = require('ulid')
5
4
  const Component = require('./Component')
6
5
  const getIdPrefix = require('./helpers/getIdPrefix')
7
6
  const getComponentTitle = require('./helpers/getComponentTitle')
8
7
  const DocumentExistsError = require('./errors/DocumentExistsError')
9
8
  const DocumentNotFoundError = require('./errors/DocumentNotFoundError')
9
+ const { get, omit, capitalize, cloneDeep } = require('lodash')
10
10
 
11
11
  const STORE = {}
12
12
 
@@ -139,7 +139,7 @@ class Document extends Component {
139
139
  }
140
140
 
141
141
  static _read({ id = 'NONE' }) {
142
- return STORE[this.name][id]
142
+ return cloneDeep(STORE[this.name][id])
143
143
  }
144
144
 
145
145
  static async index(context, query = {}, options = {}) {
@@ -151,7 +151,7 @@ class Document extends Component {
151
151
  }
152
152
 
153
153
  static _index() {
154
- const items = Object.values(STORE[this.name] || {})
154
+ const items = Object.values(STORE[this.name] || {}).map(cloneDeep)
155
155
 
156
156
  return { items, count: items.length }
157
157
  }
@@ -201,7 +201,7 @@ class Document extends Component {
201
201
 
202
202
  STORE[this.name][id] = { ...item, ...mutation }
203
203
 
204
- return STORE[this.name][id]
204
+ return cloneDeep(STORE[this.name][id])
205
205
  }
206
206
 
207
207
  static async delete(context, query) {