@thisisagile/easy-mongo 7.37.2 → 7.37.6

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.
@@ -11,11 +11,12 @@ export declare class Collection extends Mapper {
11
11
  propsToList: (...maps: import("@thisisagile/easy").Mapping[]) => import("@thisisagile/easy").Mapping;
12
12
  list: (mapper: import("@thisisagile/easy").Mapping, property: string) => import("@thisisagile/easy").Mapping;
13
13
  };
14
+ readonly id: Field;
14
15
  constructor(options?: MapOptions);
15
16
  get db(): Database;
16
17
  get provider(): MongoProvider;
17
- readonly id: Field;
18
18
  where: (...conditions: Condition[]) => Json;
19
+ match: (...conditions: Condition[]) => Json;
19
20
  google: (value: unknown) => Condition;
20
21
  search: (key: Text) => Field;
21
22
  out(to?: Json): Json;
@@ -13,6 +13,7 @@ class Collection extends easy_1.Mapper {
13
13
  };
14
14
  this.id = this.map.field('id', { dflt: easy_1.toUuid });
15
15
  this.where = (...conditions) => new easy_1.LogicalCondition('and', conditions).toJSON();
16
+ this.match = (...conditions) => new easy_1.LogicalCondition('match', conditions).toJSON();
16
17
  this.google = (value) => (0, easy_1.toCondition)('$text', 'search', value);
17
18
  this.search = (key) => this.map.field((0, easy_1.asString)(key));
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.js","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":";;;AAAA,4CAc2B;AAC3B,mCAAsC;AACtC,mDAAgD;AAEhD,MAAa,UAAW,SAAQ,aAAM;IAMpC,YAAY,UAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QANE,QAAG,GAAG;YACvB,GAAG,eAAQ;YACX,KAAK,EAAE,CAAc,IAAY,EAAE,OAA4B,EAAS,EAAE,CAAC,IAAI,YAAK,CAAC,IAAI,EAAE,OAAO,CAAC;SACpG,CAAC;QAcO,OAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC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AG,CAAC,GAAG,UAAuB,EAAQ,EAAE,CAAC,IAAI,uBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;QAE/F,UAAK,GAAG,CAAC,GAAG,UAAuB,EAAQ,EAAE,CAAC,IAAI,uBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;QAEjG,WAAM,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,IAAA,kBAAW,EAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAE9E,WAAM,GAAG,CAAC,GAAS,EAAS,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAA,eAAQ,EAAC,GAAG,CAAC,CAAC,CAAC;IAhB7D,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,eAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,6BAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAUD,GAAG,CAAC,KAAW,EAAE;QACf,OAAO,IAAA,mBAAW,EAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACF;AA9BD,gCA8BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-mongo",
3
- "version": "7.37.2",
3
+ "version": "7.37.6",
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": "7.37.2"
34
+ "@thisisagile/easy-test": "7.37.6"
35
35
  },
36
36
  "dependencies": {
37
- "@thisisagile/easy": "7.37.2",
37
+ "@thisisagile/easy": "7.37.6",
38
38
  "@types/mongodb": "^3.6.20",
39
39
  "mongodb": "^3.7.3"
40
40
  }
package/src/Collection.ts CHANGED
@@ -21,6 +21,7 @@ export class Collection extends Mapper {
21
21
  ...mappings,
22
22
  field: <T = unknown>(name: string, options?: PropertyOptions<T>): Field => new Field(name, options),
23
23
  };
24
+ readonly id = this.map.field('id', { dflt: toUuid });
24
25
 
25
26
  constructor(options: MapOptions = { startFrom: 'source' }) {
26
27
  super(options);
@@ -34,10 +35,10 @@ export class Collection extends Mapper {
34
35
  return new MongoProvider(this);
35
36
  }
36
37
 
37
- readonly id = this.map.field('id', { dflt: toUuid });
38
-
39
38
  where = (...conditions: Condition[]): Json => new LogicalCondition('and', conditions).toJSON();
40
39
 
40
+ match = (...conditions: Condition[]): Json => new LogicalCondition('match', conditions).toJSON();
41
+
41
42
  google = (value: unknown): Condition => toCondition('$text', 'search', value);
42
43
 
43
44
  search = (key: Text): Field => this.map.field(asString(key));