@thisisagile/easy-mongo 10.5.11 → 10.5.15

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.
@@ -1,16 +1,16 @@
1
1
  import { MongoProvider } from './MongoProvider';
2
- import { Condition, Gateway, Id, Json, JsonValue, List, LogicalCondition } from '@thisisagile/easy';
2
+ import { Condition, Gateway, Id, Json, JsonValue, LogicalCondition, TotalList } from '@thisisagile/easy';
3
3
  import { Collection } from './Collection';
4
4
  export declare class MongoGateway implements Gateway {
5
5
  readonly collection: Collection;
6
6
  readonly provider: MongoProvider;
7
7
  constructor(collection: Collection, provider?: MongoProvider);
8
- all(): Promise<List<Json>>;
8
+ all(): Promise<TotalList<Json>>;
9
9
  byId(id: Id): Promise<Json | undefined>;
10
- by(key: string, value: JsonValue): Promise<List<Json>>;
11
- byIds(...ids: Id[]): Promise<List<Json>>;
12
- find(q: JsonValue | Condition | LogicalCondition): Promise<List<Json>>;
13
- search(q: JsonValue): Promise<List<Json>>;
10
+ by(key: string, value: JsonValue): Promise<TotalList<Json>>;
11
+ byIds(...ids: Id[]): Promise<TotalList<Json>>;
12
+ find(q: JsonValue | Condition | LogicalCondition): Promise<TotalList<Json>>;
13
+ search(q: JsonValue): Promise<TotalList<Json>>;
14
14
  exists(id: Id): Promise<boolean>;
15
15
  add(item: Json): Promise<Json>;
16
16
  update(item: Json): Promise<Json>;
@@ -1 +1 @@
1
- {"version":3,"file":"MongoGateway.js","sourceRoot":"","sources":["../src/MongoGateway.ts"],"names":[],"mappings":";;;AACA,4CAAyI;AAGzI,MAAa,YAAY;IACvB,YAAqB,UAAsB,EAAW,WAA0B,UAAU,CAAC,QAAQ;QAA9E,eAAU,GAAV,UAAU,CAAY;QAAW,aAAQ,GAAR,QAAQ,CAAqC;IAAG,CAAC;IAEvG,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,C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AAC,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;AA3CD,oCA2CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-mongo",
3
- "version": "10.5.11",
3
+ "version": "10.5.15",
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.5.11"
34
+ "@thisisagile/easy-test": "10.5.15"
35
35
  },
36
36
  "dependencies": {
37
- "@thisisagile/easy": "10.5.11",
37
+ "@thisisagile/easy": "10.5.15",
38
38
  "mongodb": "^4.5.0"
39
39
  }
40
40
  }
@@ -1,11 +1,23 @@
1
1
  import { MongoProvider } from './MongoProvider';
2
- import { asJson, Condition, Field, Gateway, Id, ifDefined, isDefined, Json, JsonValue, List, LogicalCondition } 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, TotalList,
13
+ } from '@thisisagile/easy';
3
14
  import { Collection } from './Collection';
4
15
 
5
16
  export class MongoGateway implements Gateway {
6
- constructor(readonly collection: Collection, readonly provider: MongoProvider = collection.provider) {}
17
+ constructor(readonly collection: Collection, readonly provider: MongoProvider = collection.provider) {
18
+ }
7
19
 
8
- all(): Promise<List<Json>> {
20
+ all(): Promise<TotalList<Json>> {
9
21
  return this.provider.all().then(l => l.map(j => this.collection.in(j)));
10
22
  }
11
23
 
@@ -13,19 +25,19 @@ export class MongoGateway implements Gateway {
13
25
  return this.provider.byId(id).then(j => ifDefined(j, this.collection.in(j)));
14
26
  }
15
27
 
16
- by(key: string, value: JsonValue): Promise<List<Json>> {
28
+ by(key: string, value: JsonValue): Promise<TotalList<Json>> {
17
29
  return this.provider.by(key, value).then(l => l.map(j => this.collection.in(j)));
18
30
  }
19
31
 
20
- byIds(...ids: Id[]): Promise<List<Json>> {
32
+ byIds(...ids: Id[]): Promise<TotalList<Json>> {
21
33
  return this.find((this.collection.id as Field).isIn(...ids));
22
34
  }
23
35
 
24
- find(q: JsonValue | Condition | LogicalCondition): Promise<List<Json>> {
36
+ find(q: JsonValue | Condition | LogicalCondition): Promise<TotalList<Json>> {
25
37
  return this.provider.find(asJson(q)).then(l => l.map(j => this.collection.in(j)));
26
38
  }
27
39
 
28
- search(q: JsonValue): Promise<List<Json>> {
40
+ search(q: JsonValue): Promise<TotalList<Json>> {
29
41
  return this.find(this.collection.google(q));
30
42
  }
31
43