@wxn0brp/db 0.0.7 → 0.0.8
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/cjs/types/arg.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Arg {
|
|
|
6
6
|
_id?: Id;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}
|
|
9
|
-
export type SearchFunc<T> = (data: T, context: Context) => boolean;
|
|
10
|
-
export type UpdaterFunc<T> = (data: T, context: Context) => boolean;
|
|
11
|
-
export type Search<T = any> =
|
|
9
|
+
export type SearchFunc<T = any> = (data: T, context: Context) => boolean;
|
|
10
|
+
export type UpdaterFunc<T = any> = (data: T, context: Context) => boolean;
|
|
11
|
+
export type Search<T = any> = SearchOptions | SearchFunc<T>;
|
|
12
12
|
export type Updater<T = any> = UpdaterArg | UpdaterArg[] | UpdaterFunc<T>;
|
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
* This module defines the types and structures for search operators used
|
|
5
5
|
* to validate and query data objects.
|
|
6
6
|
*/
|
|
7
|
+
import { Arg } from "./arg";
|
|
7
8
|
/** Logical Operators */
|
|
8
9
|
export type LogicalOperators = {
|
|
9
10
|
/**
|
|
10
11
|
* Recursively applies multiple conditions, all of which must evaluate to true.
|
|
11
12
|
* Can include other operators such as $gt, $exists, or nested $and/$or conditions.
|
|
12
13
|
*/
|
|
13
|
-
$and?: Array<
|
|
14
|
+
$and?: Array<SearchOptions>;
|
|
14
15
|
/**
|
|
15
16
|
* Recursively applies multiple conditions, at least one of which must evaluate to true.
|
|
16
17
|
* Can include other operators such as $lt, $type, or nested $and/$or conditions.
|
|
17
18
|
*/
|
|
18
|
-
$or?: Array<
|
|
19
|
+
$or?: Array<SearchOptions>;
|
|
19
20
|
/**
|
|
20
21
|
* Negates a single condition.
|
|
21
22
|
* Can include any other operator as its value.
|
|
22
23
|
*/
|
|
23
|
-
$not?:
|
|
24
|
+
$not?: SearchOptions;
|
|
24
25
|
};
|
|
25
26
|
/** Comparison Operators */
|
|
26
27
|
export type ComparisonOperators = {
|
|
@@ -58,4 +59,4 @@ export type PredefinedSearchOperators = LogicalOperators & ComparisonOperators &
|
|
|
58
59
|
/**
|
|
59
60
|
* SearchOptions can be either a function or an object with predefined operators.
|
|
60
61
|
*/
|
|
61
|
-
export type SearchOptions = PredefinedSearchOperators
|
|
62
|
+
export type SearchOptions = PredefinedSearchOperators & Arg;
|
package/dist/esm/types/arg.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Arg {
|
|
|
6
6
|
_id?: Id;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}
|
|
9
|
-
export type SearchFunc<T> = (data: T, context: Context) => boolean;
|
|
10
|
-
export type UpdaterFunc<T> = (data: T, context: Context) => boolean;
|
|
11
|
-
export type Search<T = any> =
|
|
9
|
+
export type SearchFunc<T = any> = (data: T, context: Context) => boolean;
|
|
10
|
+
export type UpdaterFunc<T = any> = (data: T, context: Context) => boolean;
|
|
11
|
+
export type Search<T = any> = SearchOptions | SearchFunc<T>;
|
|
12
12
|
export type Updater<T = any> = UpdaterArg | UpdaterArg[] | UpdaterFunc<T>;
|
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
* This module defines the types and structures for search operators used
|
|
5
5
|
* to validate and query data objects.
|
|
6
6
|
*/
|
|
7
|
+
import { Arg } from "./arg";
|
|
7
8
|
/** Logical Operators */
|
|
8
9
|
export type LogicalOperators = {
|
|
9
10
|
/**
|
|
10
11
|
* Recursively applies multiple conditions, all of which must evaluate to true.
|
|
11
12
|
* Can include other operators such as $gt, $exists, or nested $and/$or conditions.
|
|
12
13
|
*/
|
|
13
|
-
$and?: Array<
|
|
14
|
+
$and?: Array<SearchOptions>;
|
|
14
15
|
/**
|
|
15
16
|
* Recursively applies multiple conditions, at least one of which must evaluate to true.
|
|
16
17
|
* Can include other operators such as $lt, $type, or nested $and/$or conditions.
|
|
17
18
|
*/
|
|
18
|
-
$or?: Array<
|
|
19
|
+
$or?: Array<SearchOptions>;
|
|
19
20
|
/**
|
|
20
21
|
* Negates a single condition.
|
|
21
22
|
* Can include any other operator as its value.
|
|
22
23
|
*/
|
|
23
|
-
$not?:
|
|
24
|
+
$not?: SearchOptions;
|
|
24
25
|
};
|
|
25
26
|
/** Comparison Operators */
|
|
26
27
|
export type ComparisonOperators = {
|
|
@@ -58,4 +59,4 @@ export type PredefinedSearchOperators = LogicalOperators & ComparisonOperators &
|
|
|
58
59
|
/**
|
|
59
60
|
* SearchOptions can be either a function or an object with predefined operators.
|
|
60
61
|
*/
|
|
61
|
-
export type SearchOptions = PredefinedSearchOperators
|
|
62
|
+
export type SearchOptions = PredefinedSearchOperators & Arg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"main": "dist/esm/index.js",
|
|
5
5
|
"types": "dist/esm/index.d.ts",
|
|
6
6
|
"description": "A simple file-based database management system with support for CRUD operations, custom queries, and graph structures.",
|