taladb 0.9.2 → 0.9.3
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/index.d.mts +32 -12
- package/dist/index.d.ts +32 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -43,17 +43,30 @@ type Document = {
|
|
|
43
43
|
_id?: string;
|
|
44
44
|
[key: string]: Value | undefined;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The operators available on a single field.
|
|
48
|
+
*
|
|
49
|
+
* Deliberately **not** a conditional type. `T extends null | undefined ? … : …`
|
|
50
|
+
* is *distributive*, so for a union-typed field (`type: 'Cabin' | 'Villa' | …`)
|
|
51
|
+
* it spreads over every member and infers `$in?: 'Cabin'[] | 'Villa'[] | …`
|
|
52
|
+
* instead of `$in?: ('Cabin' | 'Villa' | …)[]` — making `$in` unusable on any
|
|
53
|
+
* union field without a cast.
|
|
54
|
+
*
|
|
55
|
+
* Tuple-wrapping the check (`[T] extends [null | undefined]`) stops the
|
|
56
|
+
* distribution but then strips `$exists` from optional fields, which is the one
|
|
57
|
+
* thing the conditional existed for. So there is no conditional at all: `$exists`
|
|
58
|
+
* is always available (it is meaningful on every field), and the value operators
|
|
59
|
+
* use `NonNullable<T>` so an optional field still compares against its real type.
|
|
60
|
+
*/
|
|
61
|
+
type FieldOps<T> = {
|
|
62
|
+
$eq?: NonNullable<T>;
|
|
63
|
+
$ne?: NonNullable<T>;
|
|
64
|
+
$gt?: NonNullable<T>;
|
|
65
|
+
$gte?: NonNullable<T>;
|
|
66
|
+
$lt?: NonNullable<T>;
|
|
67
|
+
$lte?: NonNullable<T>;
|
|
68
|
+
$in?: NonNullable<T>[];
|
|
69
|
+
$nin?: NonNullable<T>[];
|
|
57
70
|
$exists?: boolean;
|
|
58
71
|
/** Full-text search: matches documents where this string field contains the given token. */
|
|
59
72
|
$contains?: string;
|
|
@@ -227,7 +240,14 @@ type AggregateStage<T extends Document = Document> = {
|
|
|
227
240
|
$skip: number;
|
|
228
241
|
} | {
|
|
229
242
|
$limit: number;
|
|
230
|
-
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Reshape each document. Either an **inclusion** (`{ name: 1, city: 1 }` —
|
|
246
|
+
* keep only these) or an **exclusion** (`{ description: 0 }` — keep everything
|
|
247
|
+
* else). The two cannot be mixed and doing so throws; `_id: 0` is the one
|
|
248
|
+
* exclusion allowed alongside an inclusion.
|
|
249
|
+
*/
|
|
250
|
+
| {
|
|
231
251
|
$project: Record<string, 0 | 1>;
|
|
232
252
|
};
|
|
233
253
|
/** An ordered aggregation pipeline. */
|
package/dist/index.d.ts
CHANGED
|
@@ -43,17 +43,30 @@ type Document = {
|
|
|
43
43
|
_id?: string;
|
|
44
44
|
[key: string]: Value | undefined;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The operators available on a single field.
|
|
48
|
+
*
|
|
49
|
+
* Deliberately **not** a conditional type. `T extends null | undefined ? … : …`
|
|
50
|
+
* is *distributive*, so for a union-typed field (`type: 'Cabin' | 'Villa' | …`)
|
|
51
|
+
* it spreads over every member and infers `$in?: 'Cabin'[] | 'Villa'[] | …`
|
|
52
|
+
* instead of `$in?: ('Cabin' | 'Villa' | …)[]` — making `$in` unusable on any
|
|
53
|
+
* union field without a cast.
|
|
54
|
+
*
|
|
55
|
+
* Tuple-wrapping the check (`[T] extends [null | undefined]`) stops the
|
|
56
|
+
* distribution but then strips `$exists` from optional fields, which is the one
|
|
57
|
+
* thing the conditional existed for. So there is no conditional at all: `$exists`
|
|
58
|
+
* is always available (it is meaningful on every field), and the value operators
|
|
59
|
+
* use `NonNullable<T>` so an optional field still compares against its real type.
|
|
60
|
+
*/
|
|
61
|
+
type FieldOps<T> = {
|
|
62
|
+
$eq?: NonNullable<T>;
|
|
63
|
+
$ne?: NonNullable<T>;
|
|
64
|
+
$gt?: NonNullable<T>;
|
|
65
|
+
$gte?: NonNullable<T>;
|
|
66
|
+
$lt?: NonNullable<T>;
|
|
67
|
+
$lte?: NonNullable<T>;
|
|
68
|
+
$in?: NonNullable<T>[];
|
|
69
|
+
$nin?: NonNullable<T>[];
|
|
57
70
|
$exists?: boolean;
|
|
58
71
|
/** Full-text search: matches documents where this string field contains the given token. */
|
|
59
72
|
$contains?: string;
|
|
@@ -227,7 +240,14 @@ type AggregateStage<T extends Document = Document> = {
|
|
|
227
240
|
$skip: number;
|
|
228
241
|
} | {
|
|
229
242
|
$limit: number;
|
|
230
|
-
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Reshape each document. Either an **inclusion** (`{ name: 1, city: 1 }` —
|
|
246
|
+
* keep only these) or an **exclusion** (`{ description: 0 }` — keep everything
|
|
247
|
+
* else). The two cannot be mixed and doing so throws; `_id: 0` is the one
|
|
248
|
+
* exclusion allowed alongside an inclusion.
|
|
249
|
+
*/
|
|
250
|
+
| {
|
|
231
251
|
$project: Record<string, 0 | 1>;
|
|
232
252
|
};
|
|
233
253
|
/** An ordered aggregation pipeline. */
|