@karmaniverous/entity-manager 4.1.0 → 4.2.1

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.
@@ -330,14 +330,14 @@ class EntityManager {
330
330
  } = this.getKey(entityToken, component);
331
331
  return [...new Set([...keys, ...(0, _inspectParametersDeclaration.getParametersNames)(encode)]).values()];
332
332
  }, []));
333
- const indexProperies = (0, _zipObject2.default)(indexKeys, value.split(delimiter));
333
+ const indexProperties = (0, _zipObject2.default)(indexKeys, value.split(delimiter));
334
334
  return indexComponents.reduce((index, component) => {
335
335
  const {
336
336
  encode
337
337
  } = this.getKey(entityToken, component);
338
338
  return {
339
339
  ...index,
340
- [component]: encode(indexProperies)
340
+ [component]: encode(indexProperties)
341
341
  };
342
342
  }, {});
343
343
  }
@@ -372,8 +372,8 @@ class EntityManager {
372
372
  delete newItem[shardKeyToken];
373
373
 
374
374
  // Remove keys.
375
- (0, _forEach2.default)(keys, (getValue, key) => {
376
- delete newItem[key];
375
+ (0, _forEach2.default)(keys, (value, key) => {
376
+ if (!value.retain) delete newItem[key];
377
377
  });
378
378
  _classPrivateFieldGet(this, _entityManager).logger.debug('done', newItem);
379
379
  return newItem;
@@ -108,7 +108,10 @@ const keySchema = {
108
108
  type: 'object',
109
109
  properties: {
110
110
  encode: {},
111
- decode: {}
111
+ decode: {},
112
+ retain: {
113
+ type: 'boolean'
114
+ }
112
115
  },
113
116
  additionalProperties: false,
114
117
  required: ['encode']
@@ -306,11 +306,11 @@ export class EntityManager {
306
306
  }, [])
307
307
  );
308
308
 
309
- const indexProperies = _.zipObject(indexKeys, value.split(delimiter));
309
+ const indexProperties = _.zipObject(indexKeys, value.split(delimiter));
310
310
 
311
311
  return indexComponents.reduce((index, component) => {
312
312
  const { encode } = this.getKey(entityToken, component);
313
- return { ...index, [component]: encode(indexProperies) };
313
+ return { ...index, [component]: encode(indexProperties) };
314
314
  }, {});
315
315
  }
316
316
 
@@ -343,8 +343,8 @@ export class EntityManager {
343
343
  delete newItem[shardKeyToken];
344
344
 
345
345
  // Remove keys.
346
- _.forEach(keys, (getValue, key) => {
347
- delete newItem[key];
346
+ _.forEach(keys, (value, key) => {
347
+ if (!value.retain) delete newItem[key];
348
348
  });
349
349
  this.#entityManager.logger.debug('done', newItem);
350
350
 
@@ -72,6 +72,9 @@ const keySchema = {
72
72
  properties: {
73
73
  encode: {},
74
74
  decode: {},
75
+ retain: {
76
+ type: 'boolean',
77
+ },
75
78
  },
76
79
  additionalProperties: false,
77
80
  required: ['encode'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/entity-manager",
3
- "version": "4.1.0",
3
+ "version": "4.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },