@adobe/spacecat-shared-data-access 1.60.0 → 1.60.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.60.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.60.0...@adobe/spacecat-shared-data-access-v1.60.1) (2024-12-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removeElectroProperties ([#498](https://github.com/adobe/spacecat-shared/issues/498)) ([a21b188](https://github.com/adobe/spacecat-shared/commit/a21b1887d6872092679f9c5d02452e79711955e7))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.60.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.59.2...@adobe/spacecat-shared-data-access-v1.60.0) (2024-12-18)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.60.0",
3
+ "version": "1.60.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -18,7 +18,6 @@ import {
18
18
 
19
19
  import { ElectroValidationError } from 'electrodb';
20
20
 
21
- import { removeElectroProperties } from '../../../../test/it/util/util.js';
22
21
  import { createAccessors } from '../../util/accessor.utils.js';
23
22
  import ValidationError from '../../errors/validation.error.js';
24
23
  import { guardId } from '../../util/guards.js';
@@ -26,6 +25,7 @@ import {
26
25
  entityNameToAllPKValue,
27
26
  isNonEmptyArray,
28
27
  keyNamesToIndexName,
28
+ removeElectroProperties,
29
29
  } from '../../util/util.js';
30
30
  import { INDEX_TYPES } from './constants.js';
31
31
 
@@ -46,6 +46,25 @@ const keyNamesToMethodName = (keyNames, prefix) => prefix + keyNames.map(capital
46
46
 
47
47
  const modelNameToEntityName = (modelName) => decapitalize(modelName);
48
48
 
49
+ const removeElectroProperties = (record) => { /* eslint-disable no-underscore-dangle */
50
+ const cleanedRecord = { ...record };
51
+
52
+ delete cleanedRecord.sk;
53
+ delete cleanedRecord.pk;
54
+ delete cleanedRecord.gsi1pk;
55
+ delete cleanedRecord.gsi1sk;
56
+ delete cleanedRecord.gsi2pk;
57
+ delete cleanedRecord.gsi2sk;
58
+ delete cleanedRecord.gsi3pk;
59
+ delete cleanedRecord.gsi3sk;
60
+ delete cleanedRecord.gsi4pk;
61
+ delete cleanedRecord.gsi4sk;
62
+ delete cleanedRecord.__edb_e__;
63
+ delete cleanedRecord.__edb_v__;
64
+
65
+ return cleanedRecord;
66
+ };
67
+
49
68
  const sanitizeTimestamps = (data) => {
50
69
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
70
  const { createdAt, updatedAt, ...rest } = data;
@@ -79,6 +98,7 @@ export {
79
98
  keyNamesToMethodName,
80
99
  modelNameToEntityName,
81
100
  referenceToBaseMethodName,
101
+ removeElectroProperties,
82
102
  sanitizeIdAndAuditFields,
83
103
  sanitizeTimestamps,
84
104
  };