@loomcore/api 0.0.12 → 0.0.13
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.
|
@@ -3,15 +3,8 @@ import { apiUtils } from '../utils/index.js';
|
|
|
3
3
|
import { config } from '../config/base-api-config.js';
|
|
4
4
|
const SENSITIVE_FIELDS = [
|
|
5
5
|
'password',
|
|
6
|
-
'token',
|
|
7
|
-
'apiKey',
|
|
8
6
|
'secret',
|
|
9
|
-
'
|
|
10
|
-
'creditCard',
|
|
11
|
-
'ssn',
|
|
12
|
-
'email',
|
|
13
|
-
'phone',
|
|
14
|
-
'address'
|
|
7
|
+
'ssn'
|
|
15
8
|
];
|
|
16
9
|
const sanitizeData = (data) => {
|
|
17
10
|
if (!data || typeof data !== 'object') {
|
package/dist/utils/db.utils.js
CHANGED
|
@@ -152,10 +152,15 @@ function buildMongoMatchFromQueryOptions(queryOptions) {
|
|
|
152
152
|
for (const [key, value] of Object.entries(filters)) {
|
|
153
153
|
if (value) {
|
|
154
154
|
if (value.eq !== undefined) {
|
|
155
|
-
if (typeof value.eq === 'string'
|
|
156
|
-
&& key.endsWith('Id')
|
|
155
|
+
if (typeof value.eq === 'string'
|
|
156
|
+
&& key.endsWith('Id')
|
|
157
|
+
&& !PROPERTIES_THAT_ARE_NOT_OBJECT_IDS.includes(key)
|
|
158
|
+
&& entityUtils.isValidObjectId(value.eq)) {
|
|
157
159
|
match[key] = new ObjectId(value.eq);
|
|
158
160
|
}
|
|
161
|
+
else if (typeof value.eq === 'string' && !isNaN(Number(value.eq))) {
|
|
162
|
+
match[key] = Number(value.eq);
|
|
163
|
+
}
|
|
159
164
|
else {
|
|
160
165
|
match[key] = value.eq;
|
|
161
166
|
}
|
|
@@ -170,7 +175,8 @@ function buildMongoMatchFromQueryOptions(queryOptions) {
|
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
else {
|
|
173
|
-
|
|
178
|
+
const convertedValues = value.in.map(val => typeof val === 'string' && !isNaN(Number(val)) ? Number(val) : val);
|
|
179
|
+
match[key] = { $in: convertedValues };
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
else if (value.gte !== undefined) {
|