@chevre/domain 21.33.0-alpha.6 → 21.33.0-alpha.7

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.
@@ -5,6 +5,10 @@ import { chevre } from '../../../lib/index';
5
5
 
6
6
  const project = { id: String(process.env.PROJECT_ID) };
7
7
 
8
+ mongoose.Model.on('index', (...args) => {
9
+ console.error('******** index event emitted. ********\n', args);
10
+ });
11
+
8
12
  async function main() {
9
13
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
14
 
@@ -15,25 +19,19 @@ async function main() {
15
19
  page: 1,
16
20
  project: { id: { $eq: project.id } },
17
21
  typeOf: chevre.factory.transactionType.PlaceOrder,
18
- statuses: [chevre.factory.transactionStatusType.Confirmed],
19
- result: {
20
- order: {
21
- confirmationNumber: { $eq: '14438' },
22
- orderNumbers: ['CIN3-0760465-8981560']
23
- }
24
- },
22
+ // statuses: [chevre.factory.transactionStatusType.Confirmed],
23
+ // result: {
24
+ // order: {
25
+ // confirmationNumber: { $eq: '14438' },
26
+ // orderNumbers: ['CIN3-0760465-8981560']
27
+ // }
28
+ // },
29
+ tasksExportAction: { actionStatus: { $eq: chevre.factory.actionStatusType.PotentialActionStatus } },
25
30
  inclusion: ['_id'],
26
31
  exclusion: []
27
32
  });
28
33
  console.log('transactions found', transactions);
29
34
  console.log(transactions.length, 'transactions found');
30
-
31
- const transaction = await transactionRepo.findById({
32
- typeOf: chevre.factory.transactionType.PlaceOrder,
33
- id: '6570f9d7834f9638ceec86ad',
34
- inclusion: ['_id', 'typeOf', 'status']
35
- });
36
- console.log('transaction found', transaction);
37
35
  }
38
36
 
39
37
  main()
@@ -1,5 +1,5 @@
1
1
  import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
2
2
  declare const modelName = "Transaction";
3
- declare function createSchema(): Schema;
4
3
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
4
+ declare function createSchema(): Schema;
5
5
  export { modelName, indexes, createSchema };
@@ -51,17 +51,6 @@ const schemaOptions = {
51
51
  versionKey: false
52
52
  }
53
53
  };
54
- /**
55
- * 取引スキーマ
56
- */
57
- let schema;
58
- function createSchema() {
59
- if (schema === undefined) {
60
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
61
- }
62
- return schema;
63
- }
64
- exports.createSchema = createSchema;
65
54
  const indexes = [
66
55
  [
67
56
  { createdAt: 1 },
@@ -234,42 +223,6 @@ const indexes = [
234
223
  }
235
224
  }
236
225
  ],
237
- [
238
- { 'agent.familyName': 1, startDate: -1 },
239
- {
240
- name: 'searchByAgentFamilyName',
241
- partialFilterExpression: {
242
- 'agent.familyName': { $exists: true }
243
- }
244
- }
245
- ],
246
- [
247
- { 'agent.givenName': 1, startDate: -1 },
248
- {
249
- name: 'searchByAgentGivenName',
250
- partialFilterExpression: {
251
- 'agent.givenName': { $exists: true }
252
- }
253
- }
254
- ],
255
- [
256
- { 'agent.email': 1, startDate: -1 },
257
- {
258
- name: 'searchByAgentEmail',
259
- partialFilterExpression: {
260
- 'agent.email': { $exists: true }
261
- }
262
- }
263
- ],
264
- [
265
- { 'agent.telephone': 1, startDate: -1 },
266
- {
267
- name: 'searchByAgentTelephone',
268
- partialFilterExpression: {
269
- 'agent.telephone': { $exists: true }
270
- }
271
- }
272
- ],
273
226
  [
274
227
  { 'seller.typeOf': 1, startDate: -1 },
275
228
  {
@@ -305,33 +258,45 @@ const indexes = [
305
258
  ],
306
259
  [
307
260
  { tasksExportationStatus: 1, updatedAt: 1 },
308
- {
309
- name: 'reexportTasks'
310
- }
261
+ { name: 'reexportTasks' }
311
262
  ],
312
263
  [
313
- { 'project.id': 1, tasksExportationStatus: 1, updatedAt: 1 },
314
- {
315
- name: 'reexportTasks-v2',
316
- partialFilterExpression: {
317
- 'project.id': { $exists: true }
318
- }
319
- }
264
+ { status: 1, expires: 1 },
265
+ { name: 'makeExpired' }
320
266
  ],
321
267
  [
322
- { status: 1, expires: 1 },
268
+ { 'tasksExportAction.actionStatus': 1, startDate: -1 },
323
269
  {
324
- name: 'makeExpired'
270
+ name: 'searchByTasksExportActionActionStatus',
271
+ partialFilterExpression: {
272
+ 'tasksExportAction.actionStatus': { $exists: true }
273
+ }
325
274
  }
326
275
  ],
327
276
  [
328
- { 'project.id': 1, status: 1, expires: 1 },
277
+ { 'tasksExportAction.startDate': 1, startDate: -1 },
329
278
  {
330
- name: 'makeExpired-v2',
279
+ name: 'searchByTasksExportActionActionStartDate',
331
280
  partialFilterExpression: {
332
- 'project.id': { $exists: true }
281
+ 'tasksExportAction.startDate': { $exists: true }
333
282
  }
334
283
  }
335
284
  ]
336
285
  ];
337
286
  exports.indexes = indexes;
287
+ /**
288
+ * 取引スキーマ
289
+ */
290
+ let schema;
291
+ function createSchema() {
292
+ if (schema === undefined) {
293
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
294
+ if (settings_1.MONGO_AUTO_INDEX) {
295
+ indexes.forEach((indexParams) => {
296
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
297
+ });
298
+ }
299
+ }
300
+ return schema;
301
+ }
302
+ exports.createSchema = createSchema;
@@ -24,7 +24,7 @@ class MongoRepository {
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
- var _a, _b, _c, _d, _e, _f, _g, _h;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
28
28
  const andConditions = [];
29
29
  // tslint:disable-next-line:no-single-line-block-comment
30
30
  /* istanbul ignore else */
@@ -175,23 +175,27 @@ class MongoRepository {
175
175
  tasksExportationStatus: { $in: params.tasksExportationStatuses }
176
176
  });
177
177
  }
178
+ const tasksExportActionStatusEq = (_b = (_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.actionStatus) === null || _b === void 0 ? void 0 : _b.$eq;
179
+ if (typeof tasksExportActionStatusEq === 'string') {
180
+ andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $eq: tasksExportActionStatusEq } });
181
+ }
178
182
  switch (params.typeOf) {
179
183
  case factory.transactionType.PlaceOrder:
180
- const sellerIdIn = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.ids;
184
+ const sellerIdIn = (_c = params.seller) === null || _c === void 0 ? void 0 : _c.ids;
181
185
  if (Array.isArray(sellerIdIn)) {
182
186
  andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
183
187
  }
184
- const resultOrderNumberIn = (_c = (_b = params.result) === null || _b === void 0 ? void 0 : _b.order) === null || _c === void 0 ? void 0 : _c.orderNumbers;
188
+ const resultOrderNumberIn = (_e = (_d = params.result) === null || _d === void 0 ? void 0 : _d.order) === null || _e === void 0 ? void 0 : _e.orderNumbers;
185
189
  if (Array.isArray(resultOrderNumberIn)) {
186
190
  andConditions.push({ 'result.order.orderNumber': { $exists: true, $in: resultOrderNumberIn } });
187
191
  }
188
- const resultOrderConfirmationNumberEq = (_f = (_e = (_d = params.result) === null || _d === void 0 ? void 0 : _d.order) === null || _e === void 0 ? void 0 : _e.confirmationNumber) === null || _f === void 0 ? void 0 : _f.$eq;
192
+ const resultOrderConfirmationNumberEq = (_h = (_g = (_f = params.result) === null || _f === void 0 ? void 0 : _f.order) === null || _g === void 0 ? void 0 : _g.confirmationNumber) === null || _h === void 0 ? void 0 : _h.$eq;
189
193
  if (typeof resultOrderConfirmationNumberEq === 'string') {
190
194
  andConditions.push({
191
195
  'result.order.confirmationNumber': { $exists: true, $eq: resultOrderConfirmationNumberEq }
192
196
  });
193
197
  }
194
- const objectOrderNumberEq = (_h = (_g = params.object) === null || _g === void 0 ? void 0 : _g.orderNumber) === null || _h === void 0 ? void 0 : _h.$eq;
198
+ const objectOrderNumberEq = (_k = (_j = params.object) === null || _j === void 0 ? void 0 : _j.orderNumber) === null || _k === void 0 ? void 0 : _k.$eq;
195
199
  if (typeof objectOrderNumberEq === 'string') {
196
200
  andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
197
201
  }
package/package.json CHANGED
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.371.0",
14
- "@cinerino/sdk": "7.0.0-alpha.11",
13
+ "@chevre/factory": "4.372.0",
14
+ "@cinerino/sdk": "7.0.0-alpha.12",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
17
17
  "@sendgrid/mail": "6.4.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.33.0-alpha.6"
113
+ "version": "21.33.0-alpha.7"
114
114
  }