mongo-typed 1.0.0 → 1.0.2
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/dist/filter.d.ts +8 -7
- package/dist/filter.spec.js +7 -0
- package/package.json +3 -3
package/dist/filter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BsonType, BsonTypeNumeric, IntegerType, RegExpOrString
|
|
1
|
+
import { BsonType, BsonTypeNumeric, IntegerType, RegExpOrString } from './bson-types.js';
|
|
2
2
|
import { DotNotation, DotPathValue } from './dot-notation.js';
|
|
3
3
|
import { Expr } from './expr.js';
|
|
4
4
|
import { GeoJson, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon } from './geo-json.js';
|
|
@@ -54,11 +54,11 @@ export declare interface NearFilter {
|
|
|
54
54
|
$maxDistance?: number;
|
|
55
55
|
$minDistance?: number;
|
|
56
56
|
}
|
|
57
|
-
export declare interface RootFilterOperators<TSchema> {
|
|
58
|
-
$and?:
|
|
57
|
+
export declare interface RootFilterOperators<TSchema extends object> {
|
|
58
|
+
$and?: RootFilter<TSchema>[];
|
|
59
59
|
$comment?: Document | string;
|
|
60
|
-
$nor?:
|
|
61
|
-
$or?:
|
|
60
|
+
$nor?: RootFilter<TSchema>[];
|
|
61
|
+
$or?: RootFilter<TSchema>[];
|
|
62
62
|
$text?: {
|
|
63
63
|
$caseSensitive?: boolean;
|
|
64
64
|
$diacriticSensitive?: boolean;
|
|
@@ -67,6 +67,7 @@ export declare interface RootFilterOperators<TSchema> {
|
|
|
67
67
|
};
|
|
68
68
|
$where?: ((this: TSchema) => boolean) | string;
|
|
69
69
|
}
|
|
70
|
-
export type Filter<TSchema> = TSchema extends object ?
|
|
70
|
+
export type Filter<TSchema> = TSchema extends object ? RootFilter<TSchema> : Condition<TSchema>;
|
|
71
|
+
export type RootFilter<TSchema extends object> = RootFilterOperators<TSchema> & {
|
|
71
72
|
[P in DotNotation<TSchema>]?: Condition<DotPathValue<TSchema, P>>;
|
|
72
|
-
}
|
|
73
|
+
};
|
package/dist/filter.spec.js
CHANGED
|
@@ -78,6 +78,13 @@ describe('Filter', () => {
|
|
|
78
78
|
describe('$in', () => {
|
|
79
79
|
it('should allow $in operator for primitive fields', () => {
|
|
80
80
|
});
|
|
81
|
+
/*
|
|
82
|
+
it('should allow arrays for array fields', () => {
|
|
83
|
+
type ActualArray = Filter<User>['tags'];
|
|
84
|
+
|
|
85
|
+
type T1 = Assert<Includes<ActualArray, { $in: string[] }>>;
|
|
86
|
+
});
|
|
87
|
+
*/
|
|
81
88
|
});
|
|
82
89
|
describe('$jsonSchema', () => {
|
|
83
90
|
it('should allow $jsonSchema with bsonType string', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongo-typed",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Provides type-safe MongoDB-style query and update utilities in TypeScript. It is designed to assist with building fully-typed data repository layers or services that interact with MongoDB-like syntax, without relying on external libraries or runtime packages.",
|
|
5
5
|
"author": "SecureDataSystems",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
24
|
+
"@secure-data-systems/eslint-config": "^1.0.2",
|
|
25
|
+
"@secure-data-systems/tsconfig": "^1.0.0",
|
|
26
26
|
"@types/node": "^24.0.3",
|
|
27
27
|
"glob": "^11.0.3",
|
|
28
28
|
"tsx": "^4.20.3",
|