@thisisagile/easy-mongo 10.10.0 → 10.10.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.
@@ -8,19 +8,19 @@ class MongoGateway {
8
8
  this.provider = provider;
9
9
  }
10
10
  all(options) {
11
- return this.provider.all(options).then(l => l.map(j => this.collection.in(j)));
11
+ return this.provider.all(options).then(pl => (0, easy_1.toPageList)(pl.map(j => this.collection.in(j)), pl));
12
12
  }
13
13
  byId(id) {
14
14
  return this.provider.byId(id).then(j => (0, easy_1.ifDefined)(j, this.collection.in(j)));
15
15
  }
16
16
  by(key, value, options) {
17
- return this.provider.by(key, value, options).then(l => l.map(j => this.collection.in(j)));
17
+ return this.provider.by(key, value, options).then(pl => (0, easy_1.toPageList)(pl.map(j => this.collection.in(j)), pl));
18
18
  }
19
19
  byIds(...ids) {
20
20
  return this.find(this.collection.id.isIn(...ids));
21
21
  }
22
22
  find(q, options) {
23
- return this.provider.find((0, easy_1.asJson)(q), options).then(l => l.map(j => this.collection.in(j)));
23
+ return this.provider.find((0, easy_1.asJson)(q), options).then(pl => (0, easy_1.toPageList)(pl.map(j => this.collection.in(j)), pl));
24
24
  }
25
25
  search(q, options) {
26
26
  return this.find(this.collection.google(q), options);
@@ -1 +1 @@
1
- {"version":3,"file":"MongoGateway.js","sourceRoot":"","sources":["../src/MongoGateway.ts"],"names":[],"mappings":";;;AACA,4CAA0J;AAG1J,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,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU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CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,EAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,gBAAS,EAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,GAAG,CAAC,IAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,CAAC,IAAU;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,CAAC,EAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;CACF;AAlDD,oCAkDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-mongo",
3
- "version": "10.10.0",
3
+ "version": "10.10.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": "10.10.0"
34
+ "@thisisagile/easy-test": "10.10.3"
35
35
  },
36
36
  "dependencies": {
37
- "@thisisagile/easy": "10.10.0",
37
+ "@thisisagile/easy": "10.10.3",
38
38
  "mongodb": "^4.5.0"
39
39
  }
40
40
  }
@@ -1,12 +1,28 @@
1
1
  import { MongoProvider } from './MongoProvider';
2
- import { asJson, Condition, Field, Gateway, Id, ifDefined, isDefined, Json, JsonValue, LogicalCondition, PageList, PageOptions } from '@thisisagile/easy';
2
+ import {
3
+ asJson,
4
+ Condition,
5
+ Field,
6
+ Gateway,
7
+ Id,
8
+ ifDefined,
9
+ isDefined,
10
+ Json,
11
+ JsonValue,
12
+ LogicalCondition,
13
+ PageList,
14
+ PageOptions,
15
+ toPageList,
16
+ } from '@thisisagile/easy';
3
17
  import { Collection } from './Collection';
4
18
 
5
19
  export class MongoGateway implements Gateway {
6
- constructor(readonly collection: Collection, readonly provider: MongoProvider = collection.provider) {}
20
+ constructor(readonly collection: Collection, readonly provider: MongoProvider = collection.provider) {
21
+ }
7
22
 
8
23
  all(options?: PageOptions): Promise<PageList<Json>> {
9
- return this.provider.all(options).then(l => l.map(j => this.collection.in(j)));
24
+ return this.provider.all(options).then(pl => toPageList(pl.map(j => this.collection.in(j)), pl),
25
+ );
10
26
  }
11
27
 
12
28
  byId(id: Id): Promise<Json | undefined> {
@@ -14,7 +30,12 @@ export class MongoGateway implements Gateway {
14
30
  }
15
31
 
16
32
  by(key: string, value: JsonValue, options?: PageOptions): Promise<PageList<Json>> {
17
- return this.provider.by(key, value, options).then(l => l.map(j => this.collection.in(j)));
33
+ return this.provider.by(key, value, options).then(pl =>
34
+ toPageList(
35
+ pl.map(j => this.collection.in(j)),
36
+ pl,
37
+ ),
38
+ );
18
39
  }
19
40
 
20
41
  byIds(...ids: Id[]): Promise<PageList<Json>> {
@@ -22,7 +43,8 @@ export class MongoGateway implements Gateway {
22
43
  }
23
44
 
24
45
  find(q: JsonValue | Condition | LogicalCondition, options?: PageOptions): Promise<PageList<Json>> {
25
- return this.provider.find(asJson(q), options).then(l => l.map(j => this.collection.in(j)));
46
+ return this.provider.find(asJson(q), options).then(pl => toPageList(pl.map(j => this.collection.in(j)), pl),
47
+ );
26
48
  }
27
49
 
28
50
  search(q: JsonValue, options?: PageOptions): Promise<PageList<Json>> {