@chevre/domain 21.8.0-alpha.3 → 21.8.0-alpha.4

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.
@@ -0,0 +1,22 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ const KILO_BYTES = 1024;
5
+ async function main() {
6
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
7
+
8
+ const stats = await mongoose.connection.db.collection('tasks')
9
+ .stats({
10
+ scale: KILO_BYTES * KILO_BYTES
11
+ });
12
+ console.log('scaleFactor:', stats.scaleFactor);
13
+ console.log('avgObjSize:', stats.avgObjSize);
14
+ console.log('count:', stats.count);
15
+ console.log('size:', stats.size);
16
+ }
17
+
18
+ main()
19
+ .then(() => {
20
+ console.log('success!');
21
+ })
22
+ .catch(console.error);
@@ -10,18 +10,18 @@ async function main() {
10
10
 
11
11
  const taskRepo = new chevre.repository.Task(mongoose.connection);
12
12
 
13
- const tasks = await taskRepo.taskModel.find(
13
+ const tasks = await taskRepo.search(
14
14
  {
15
- 'project.id': { $eq: project.id },
16
- name: { $eq: chevre.factory.taskName.SendOrder },
17
- 'data.object.orderNumber': {
18
- $exists: true,
19
- $eq: 'xxx'
15
+ limit: 1,
16
+ project: { id: { $eq: project.id } },
17
+ name: { $in: [chevre.factory.taskName.SendOrder] },
18
+ data: {
19
+ object: {
20
+ orderNumber: { $eq: 'xxx' }
21
+ }
20
22
  }
21
23
  }
22
- )
23
- .limit(1)
24
- .exec();
24
+ );
25
25
  console.log('tasks found', tasks);
26
26
  console.log(tasks.length, 'tasks found');
27
27
  }
@@ -31,7 +31,7 @@ class MongoRepository {
31
31
  }
32
32
  // tslint:disable-next-line:max-func-body-length
33
33
  static CREATE_MONGO_CONDITIONS(params) {
34
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
34
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
35
35
  const andConditions = [];
36
36
  const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
37
37
  if (typeof idEq === 'string') {
@@ -115,32 +115,21 @@ class MongoRepository {
115
115
  }
116
116
  const objectIdEq = (_k = (_j = (_h = params.data) === null || _h === void 0 ? void 0 : _h.object) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
117
117
  if (typeof objectIdEq === 'string') {
118
- andConditions.push({
119
- 'data.object.id': {
120
- $exists: true,
121
- $eq: objectIdEq
122
- }
123
- });
118
+ andConditions.push({ 'data.object.id': { $exists: true, $eq: objectIdEq } });
119
+ }
120
+ const objectOrderNumberEq = (_o = (_m = (_l = params.data) === null || _l === void 0 ? void 0 : _l.object) === null || _m === void 0 ? void 0 : _m.orderNumber) === null || _o === void 0 ? void 0 : _o.$eq;
121
+ if (typeof objectOrderNumberEq === 'string') {
122
+ andConditions.push({ 'data.object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
124
123
  }
125
- const objectTransactionNumberEq = (_o = (_m = (_l = params.data) === null || _l === void 0 ? void 0 : _l.object) === null || _m === void 0 ? void 0 : _m.transactionNumber) === null || _o === void 0 ? void 0 : _o.$eq;
124
+ const objectTransactionNumberEq = (_r = (_q = (_p = params.data) === null || _p === void 0 ? void 0 : _p.object) === null || _q === void 0 ? void 0 : _q.transactionNumber) === null || _r === void 0 ? void 0 : _r.$eq;
126
125
  if (typeof objectTransactionNumberEq === 'string') {
127
- andConditions.push({
128
- 'data.object.transactionNumber': {
129
- $exists: true,
130
- $eq: objectTransactionNumberEq
131
- }
132
- });
126
+ andConditions.push({ 'data.object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
133
127
  }
134
- const objectPurposeIdEq = (_r = (_q = (_p = params.data) === null || _p === void 0 ? void 0 : _p.purpose) === null || _q === void 0 ? void 0 : _q.id) === null || _r === void 0 ? void 0 : _r.$eq;
128
+ const objectPurposeIdEq = (_u = (_t = (_s = params.data) === null || _s === void 0 ? void 0 : _s.purpose) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
135
129
  if (typeof objectPurposeIdEq === 'string') {
136
- andConditions.push({
137
- 'data.purpose.id': {
138
- $exists: true,
139
- $eq: objectPurposeIdEq
140
- }
141
- });
130
+ andConditions.push({ 'data.purpose.id': { $exists: true, $eq: objectPurposeIdEq } });
142
131
  }
143
- const objectPurposeOrderNumberEq = (_u = (_t = (_s = params.data) === null || _s === void 0 ? void 0 : _s.purpose) === null || _t === void 0 ? void 0 : _t.orderNumber) === null || _u === void 0 ? void 0 : _u.$eq;
132
+ const objectPurposeOrderNumberEq = (_x = (_w = (_v = params.data) === null || _v === void 0 ? void 0 : _v.purpose) === null || _w === void 0 ? void 0 : _w.orderNumber) === null || _x === void 0 ? void 0 : _x.$eq;
144
133
  if (typeof objectPurposeOrderNumberEq === 'string') {
145
134
  andConditions.push({
146
135
  'data.purpose.orderNumber': {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.327.0-alpha.1",
12
+ "@chevre/factory": "4.327.0-alpha.2",
13
13
  "@cinerino/sdk": "3.165.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.8.0-alpha.3"
120
+ "version": "21.8.0-alpha.4"
121
121
  }