@thisisagile/easy-mongo 12.22.0 → 12.22.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/Collection.d.ts +1 -1
- package/dist/MongoGateway.d.ts +3 -2
- package/dist/MongoGateway.js +3 -0
- package/dist/MongoGateway.js.map +1 -1
- package/package.json +3 -3
- package/src/MongoGateway.ts +22 -2
package/dist/Collection.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class Collection extends Mapper {
|
|
|
7
7
|
ignore: (property?: string | undefined) => import("@thisisagile/easy").Mapping;
|
|
8
8
|
skipIn: (property: string) => import("@thisisagile/easy").Mapping;
|
|
9
9
|
skipOut: (property: string) => import("@thisisagile/easy").Mapping;
|
|
10
|
-
func: (property: string, funcIn: Get<import("@thisisagile/easy").JsonValue
|
|
10
|
+
func: (property: string, funcIn: Get<import("@thisisagile/easy").Optional<import("@thisisagile/easy").JsonValue>, Json>, funcOut: Get<import("@thisisagile/easy").Optional<import("@thisisagile/easy").JsonValue>, Json>) => import("@thisisagile/easy").Mapping;
|
|
11
11
|
add: (funcIn: Get<import("@thisisagile/easy").JsonValue, Json>) => import("@thisisagile/easy").Mapping;
|
|
12
12
|
map: (mapper: import("@thisisagile/easy").Construct<Mapper>, property?: string | undefined) => import("@thisisagile/easy").Mapping;
|
|
13
13
|
propsToList: (...maps: import("@thisisagile/easy").Mapping[]) => import("@thisisagile/easy").Mapping;
|
package/dist/MongoGateway.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FindOptions, MongoProvider } from './MongoProvider';
|
|
2
|
-
import { Condition, Gateway, Id, Json, JsonValue, List, LogicalCondition, PageList } from '@thisisagile/easy';
|
|
1
|
+
import { Filter, FindOptions, MongoProvider } from './MongoProvider';
|
|
2
|
+
import { Condition, Gateway, Id, Json, JsonValue, List, LogicalCondition, Optional, PageList } from '@thisisagile/easy';
|
|
3
3
|
import { Collection } from './Collection';
|
|
4
4
|
export declare class MongoGateway implements Gateway<FindOptions> {
|
|
5
5
|
readonly collection: Collection;
|
|
@@ -13,6 +13,7 @@ export declare class MongoGateway implements Gateway<FindOptions> {
|
|
|
13
13
|
search(q: JsonValue, options?: FindOptions): Promise<PageList<Json>>;
|
|
14
14
|
filter(options?: FindOptions): Promise<PageList<Json>>;
|
|
15
15
|
exists(id: Id): Promise<boolean>;
|
|
16
|
+
aggregate(...filters: Optional<Filter>[]): Promise<PageList<Json>>;
|
|
16
17
|
add(item: Json): Promise<Json>;
|
|
17
18
|
update(item: Json): Promise<Json>;
|
|
18
19
|
remove(id: Id): Promise<boolean>;
|
package/dist/MongoGateway.js
CHANGED
|
@@ -31,6 +31,9 @@ class MongoGateway {
|
|
|
31
31
|
exists(id) {
|
|
32
32
|
return this.provider.byId(id).then(i => (0, easy_1.isDefined)(i));
|
|
33
33
|
}
|
|
34
|
+
aggregate(...filters) {
|
|
35
|
+
return this.provider.aggregate((0, easy_1.toArray)(...filters).filter(easy_1.isPresent));
|
|
36
|
+
}
|
|
34
37
|
add(item) {
|
|
35
38
|
return this.provider.add(this.collection.out(item)).then(j => this.collection.in(j));
|
|
36
39
|
}
|
package/dist/MongoGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoGateway.js","sourceRoot":"","sources":["../src/MongoGateway.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"MongoGateway.js","sourceRoot":"","sources":["../src/MongoGateway.ts"],"names":[],"mappings":";;;AACA,4CAgB2B;AAG3B,MAAa,YAAY;IACvB,YAAqB,UAAsB,EAAW,WAA0B,UAAU,CAAC,QAAQ;QAA9E,eAAU,GAAV,UAAU,CAAY;QAAW,aAAQ,GAAR,QAAQ,CAAqC;IAAG,CAAC;IAEvG,GAAG,CAAC,OAAqB;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,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"12.22.
|
|
3
|
+
"version": "12.22.3",
|
|
4
4
|
"description": "Add support for MongoDB",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@thisisagile/easy-test": "12.22.
|
|
34
|
+
"@thisisagile/easy-test": "12.22.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thisisagile/easy": "^12.22.
|
|
37
|
+
"@thisisagile/easy": "^12.22.3",
|
|
38
38
|
"mongodb": "^4.13.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/MongoGateway.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
import { FindOptions, MongoProvider } from './MongoProvider';
|
|
2
|
-
import {
|
|
1
|
+
import { Filter, FindOptions, MongoProvider } from './MongoProvider';
|
|
2
|
+
import {
|
|
3
|
+
asJson,
|
|
4
|
+
asPageList,
|
|
5
|
+
Condition,
|
|
6
|
+
Gateway,
|
|
7
|
+
Id,
|
|
8
|
+
ifDefined,
|
|
9
|
+
isDefined,
|
|
10
|
+
isPresent,
|
|
11
|
+
Json,
|
|
12
|
+
JsonValue,
|
|
13
|
+
List,
|
|
14
|
+
LogicalCondition,
|
|
15
|
+
Optional,
|
|
16
|
+
PageList,
|
|
17
|
+
toArray,
|
|
18
|
+
} from '@thisisagile/easy';
|
|
3
19
|
import { Collection } from './Collection';
|
|
4
20
|
|
|
5
21
|
export class MongoGateway implements Gateway<FindOptions> {
|
|
@@ -37,6 +53,10 @@ export class MongoGateway implements Gateway<FindOptions> {
|
|
|
37
53
|
return this.provider.byId(id).then(i => isDefined(i));
|
|
38
54
|
}
|
|
39
55
|
|
|
56
|
+
aggregate(...filters: Optional<Filter>[]): Promise<PageList<Json>> {
|
|
57
|
+
return this.provider.aggregate(toArray(...filters).filter(isPresent) as Filter[]);
|
|
58
|
+
}
|
|
59
|
+
|
|
40
60
|
add(item: Json): Promise<Json> {
|
|
41
61
|
return this.provider.add(this.collection.out(item)).then(j => this.collection.in(j));
|
|
42
62
|
}
|