@sprucelabs/data-stores 32.0.3 → 32.0.5
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/build/databases/MongoDatabase.js +5 -5
- package/build/databases/mongo.types.d.ts +3 -9
- package/build/esm/databases/MongoDatabase.js +5 -5
- package/build/esm/databases/mongo.types.d.ts +3 -9
- package/build/esm/utilities/mongo.utility.js +2 -2
- package/build/utilities/mongo.utility.js +2 -2
- package/package.json +15 -15
|
@@ -84,7 +84,7 @@ class MongoDatabase {
|
|
|
84
84
|
try {
|
|
85
85
|
q = this.toMongoIdAndNull(collection, query || {});
|
|
86
86
|
}
|
|
87
|
-
catch (
|
|
87
|
+
catch (_a) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
const match = await this.assertDbWhileAttempingTo('found one record.', collection)
|
|
@@ -99,7 +99,7 @@ class MongoDatabase {
|
|
|
99
99
|
try {
|
|
100
100
|
q = this.toMongoIdAndNull(collection, query || {});
|
|
101
101
|
}
|
|
102
|
-
catch (
|
|
102
|
+
catch (_a) {
|
|
103
103
|
return [];
|
|
104
104
|
}
|
|
105
105
|
if ((options === null || options === void 0 ? void 0 : options.limit) === 0) {
|
|
@@ -230,7 +230,7 @@ class MongoDatabase {
|
|
|
230
230
|
.toArray();
|
|
231
231
|
return indexes.filter((index) => index.name !== '_id_');
|
|
232
232
|
}
|
|
233
|
-
catch (
|
|
233
|
+
catch (_a) {
|
|
234
234
|
return [];
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -269,7 +269,7 @@ class MongoDatabase {
|
|
|
269
269
|
}
|
|
270
270
|
return uniqueIndexes;
|
|
271
271
|
}
|
|
272
|
-
catch (
|
|
272
|
+
catch (_a) {
|
|
273
273
|
return [];
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -287,7 +287,7 @@ class MongoDatabase {
|
|
|
287
287
|
}
|
|
288
288
|
return nonUniqueIndexes;
|
|
289
289
|
}
|
|
290
|
-
catch (
|
|
290
|
+
catch (_a) {
|
|
291
291
|
return [];
|
|
292
292
|
}
|
|
293
293
|
}
|
|
@@ -1609,13 +1609,9 @@ type KeysOfAType<TSchema, Type> = {
|
|
|
1609
1609
|
type KeysOfOtherType<TSchema, Type> = {
|
|
1610
1610
|
[key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
|
|
1611
1611
|
}[keyof TSchema];
|
|
1612
|
-
type AcceptedFields<TSchema, FieldType, AssignableType> =
|
|
1613
|
-
readonly [key in KeysOfAType<TSchema, FieldType>]?: AssignableType;
|
|
1614
|
-
};
|
|
1612
|
+
type AcceptedFields<TSchema, FieldType, AssignableType> = Readonly<Partial<Record<KeysOfAType<TSchema, FieldType>, AssignableType>>>;
|
|
1615
1613
|
/** It avoids using fields with not acceptable types */
|
|
1616
|
-
type NotAcceptedFields<TSchema, FieldType> =
|
|
1617
|
-
readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
|
|
1618
|
-
};
|
|
1614
|
+
type NotAcceptedFields<TSchema, FieldType> = Readonly<Partial<Record<KeysOfOtherType<TSchema, FieldType>, never>>>;
|
|
1619
1615
|
type DotAndArrayNotation<AssignableType> = Readonly<Record<string, AssignableType>>;
|
|
1620
1616
|
type ReadonlyPartial<TSchema> = {
|
|
1621
1617
|
readonly [key in keyof TSchema]?: TSchema[key];
|
|
@@ -1707,9 +1703,7 @@ export interface UpdateQuery<TSchema> {
|
|
|
1707
1703
|
$pull?: PullOperator<TSchema> | undefined;
|
|
1708
1704
|
$push?: PushOperator<TSchema> | undefined;
|
|
1709
1705
|
$pullAll?: PullAllOperator<TSchema> | undefined;
|
|
1710
|
-
$bit?: Record<string,
|
|
1711
|
-
[key in 'and' | 'or' | 'xor']?: number;
|
|
1712
|
-
}> | undefined;
|
|
1706
|
+
$bit?: Record<string, Partial<Record<'and' | 'or' | 'xor', number>>> | undefined;
|
|
1713
1707
|
}
|
|
1714
1708
|
/**
|
|
1715
1709
|
* Available BSON types
|
|
@@ -92,7 +92,7 @@ export default class MongoDatabase {
|
|
|
92
92
|
try {
|
|
93
93
|
q = this.toMongoIdAndNull(collection, query || {});
|
|
94
94
|
}
|
|
95
|
-
catch (
|
|
95
|
+
catch (_a) {
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
98
|
const match = yield this.assertDbWhileAttempingTo('found one record.', collection)
|
|
@@ -109,7 +109,7 @@ export default class MongoDatabase {
|
|
|
109
109
|
try {
|
|
110
110
|
q = this.toMongoIdAndNull(collection, query || {});
|
|
111
111
|
}
|
|
112
|
-
catch (
|
|
112
|
+
catch (_a) {
|
|
113
113
|
return [];
|
|
114
114
|
}
|
|
115
115
|
if ((options === null || options === void 0 ? void 0 : options.limit) === 0) {
|
|
@@ -254,7 +254,7 @@ export default class MongoDatabase {
|
|
|
254
254
|
.toArray();
|
|
255
255
|
return indexes.filter((index) => index.name !== '_id_');
|
|
256
256
|
}
|
|
257
|
-
catch (
|
|
257
|
+
catch (_a) {
|
|
258
258
|
return [];
|
|
259
259
|
}
|
|
260
260
|
});
|
|
@@ -297,7 +297,7 @@ export default class MongoDatabase {
|
|
|
297
297
|
}
|
|
298
298
|
return uniqueIndexes;
|
|
299
299
|
}
|
|
300
|
-
catch (
|
|
300
|
+
catch (_a) {
|
|
301
301
|
return [];
|
|
302
302
|
}
|
|
303
303
|
});
|
|
@@ -317,7 +317,7 @@ export default class MongoDatabase {
|
|
|
317
317
|
}
|
|
318
318
|
return nonUniqueIndexes;
|
|
319
319
|
}
|
|
320
|
-
catch (
|
|
320
|
+
catch (_a) {
|
|
321
321
|
return [];
|
|
322
322
|
}
|
|
323
323
|
});
|
|
@@ -1609,13 +1609,9 @@ type KeysOfAType<TSchema, Type> = {
|
|
|
1609
1609
|
type KeysOfOtherType<TSchema, Type> = {
|
|
1610
1610
|
[key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
|
|
1611
1611
|
}[keyof TSchema];
|
|
1612
|
-
type AcceptedFields<TSchema, FieldType, AssignableType> =
|
|
1613
|
-
readonly [key in KeysOfAType<TSchema, FieldType>]?: AssignableType;
|
|
1614
|
-
};
|
|
1612
|
+
type AcceptedFields<TSchema, FieldType, AssignableType> = Readonly<Partial<Record<KeysOfAType<TSchema, FieldType>, AssignableType>>>;
|
|
1615
1613
|
/** It avoids using fields with not acceptable types */
|
|
1616
|
-
type NotAcceptedFields<TSchema, FieldType> =
|
|
1617
|
-
readonly [key in KeysOfOtherType<TSchema, FieldType>]?: never;
|
|
1618
|
-
};
|
|
1614
|
+
type NotAcceptedFields<TSchema, FieldType> = Readonly<Partial<Record<KeysOfOtherType<TSchema, FieldType>, never>>>;
|
|
1619
1615
|
type DotAndArrayNotation<AssignableType> = Readonly<Record<string, AssignableType>>;
|
|
1620
1616
|
type ReadonlyPartial<TSchema> = {
|
|
1621
1617
|
readonly [key in keyof TSchema]?: TSchema[key];
|
|
@@ -1707,9 +1703,7 @@ export interface UpdateQuery<TSchema> {
|
|
|
1707
1703
|
$pull?: PullOperator<TSchema> | undefined;
|
|
1708
1704
|
$push?: PushOperator<TSchema> | undefined;
|
|
1709
1705
|
$pullAll?: PullAllOperator<TSchema> | undefined;
|
|
1710
|
-
$bit?: Record<string,
|
|
1711
|
-
[key in 'and' | 'or' | 'xor']?: number;
|
|
1712
|
-
}> | undefined;
|
|
1706
|
+
$bit?: Record<string, Partial<Record<'and' | 'or' | 'xor', number>>> | undefined;
|
|
1713
1707
|
}
|
|
1714
1708
|
/**
|
|
1715
1709
|
* Available BSON types
|
|
@@ -38,7 +38,7 @@ const mongoUtil = {
|
|
|
38
38
|
? id
|
|
39
39
|
: new ObjectId(id);
|
|
40
40
|
}
|
|
41
|
-
catch (
|
|
41
|
+
catch (_a) {
|
|
42
42
|
normalizedValues._id = id;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -95,7 +95,7 @@ function mapNestedIdValues(id, options = {}) {
|
|
|
95
95
|
? value
|
|
96
96
|
: new ObjectId(value);
|
|
97
97
|
}
|
|
98
|
-
catch (
|
|
98
|
+
catch (_a) {
|
|
99
99
|
throw new SpruceError({
|
|
100
100
|
code: 'MONGO_ID_MAPPING_ERROR',
|
|
101
101
|
friendlyMessage: `Could not map '${value}' to an id.`,
|
|
@@ -43,7 +43,7 @@ const mongoUtil = {
|
|
|
43
43
|
? id
|
|
44
44
|
: new mongodb_1.ObjectId(id);
|
|
45
45
|
}
|
|
46
|
-
catch (
|
|
46
|
+
catch (_a) {
|
|
47
47
|
normalizedValues._id = id;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -100,7 +100,7 @@ function mapNestedIdValues(id, options = {}) {
|
|
|
100
100
|
? value
|
|
101
101
|
: new mongodb_1.ObjectId(value);
|
|
102
102
|
}
|
|
103
|
-
catch (
|
|
103
|
+
catch (_a) {
|
|
104
104
|
throw new SpruceError_1.default({
|
|
105
105
|
code: 'MONGO_ID_MAPPING_ERROR',
|
|
106
106
|
friendlyMessage: `Could not map '${value}' to an id.`,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "32.0.
|
|
6
|
+
"version": "32.0.5",
|
|
7
7
|
"files": [
|
|
8
8
|
"build/**/*",
|
|
9
9
|
"!build/__tests__",
|
|
@@ -75,28 +75,28 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@seald-io/nedb": "^4.1.2",
|
|
78
|
-
"@sprucelabs/error": "^8.1.
|
|
79
|
-
"@sprucelabs/globby": "^2.0.
|
|
80
|
-
"@sprucelabs/schema": "^33.
|
|
81
|
-
"@sprucelabs/spruce-skill-utils": "^34.0.
|
|
78
|
+
"@sprucelabs/error": "^8.1.6",
|
|
79
|
+
"@sprucelabs/globby": "^2.0.516",
|
|
80
|
+
"@sprucelabs/schema": "^33.2.2",
|
|
81
|
+
"@sprucelabs/spruce-skill-utils": "^34.0.9",
|
|
82
82
|
"just-clone": "^6.2.0",
|
|
83
83
|
"lodash": "^4.17.23",
|
|
84
|
-
"mongodb": "^7.
|
|
84
|
+
"mongodb": "^7.1.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@sprucelabs/esm-postbuild": "^9.0.
|
|
88
|
-
"@sprucelabs/jest-json-reporter": "^10.0.
|
|
89
|
-
"@sprucelabs/resolve-path-aliases": "^4.0.
|
|
87
|
+
"@sprucelabs/esm-postbuild": "^9.0.16",
|
|
88
|
+
"@sprucelabs/jest-json-reporter": "^10.0.23",
|
|
89
|
+
"@sprucelabs/resolve-path-aliases": "^4.0.16",
|
|
90
90
|
"@sprucelabs/semantic-release": "^6.0.0",
|
|
91
|
-
"@sprucelabs/test": "^11.1.
|
|
92
|
-
"@sprucelabs/test-utils": "^7.2.
|
|
91
|
+
"@sprucelabs/test": "^11.1.3",
|
|
92
|
+
"@sprucelabs/test-utils": "^7.2.8",
|
|
93
93
|
"@types/lodash": "^4.17.23",
|
|
94
|
-
"@types/node": "^25.
|
|
94
|
+
"@types/node": "^25.2.3",
|
|
95
95
|
"chokidar-cli": "^3.0.0",
|
|
96
96
|
"concurrently": "^9.2.1",
|
|
97
|
-
"dotenv": "^17.
|
|
98
|
-
"eslint": "^
|
|
99
|
-
"eslint-config-spruce": "^11.2.
|
|
97
|
+
"dotenv": "^17.3.1",
|
|
98
|
+
"eslint": "^10.0.0",
|
|
99
|
+
"eslint-config-spruce": "^11.2.30",
|
|
100
100
|
"jest": "^30.2.0",
|
|
101
101
|
"jest-circus": "^30.2.0",
|
|
102
102
|
"prettier": "^3.8.1",
|