@chevre/domain 20.2.0-alpha.21 → 20.2.0-alpha.22

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.
@@ -6,7 +6,7 @@ import * as factory from '../factory';
6
6
  export declare class MongoRepository {
7
7
  readonly taskModel: typeof Model;
8
8
  constructor(connection: Connection);
9
- static CREATE_MONGO_CONDITIONS<T extends factory.taskName>(params: factory.task.ISearchConditions<T>): any[];
9
+ static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): any[];
10
10
  save(taskAttributes: factory.task.IAttributes<factory.taskName>): Promise<factory.task.ITask<factory.taskName>>;
11
11
  saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[]): Promise<any[]>;
12
12
  executeOneByName<T extends factory.taskName>(params: {
@@ -29,11 +29,11 @@ export declare class MongoRepository {
29
29
  name: T;
30
30
  id: string;
31
31
  }): Promise<factory.task.ITask<T>>;
32
- count<T extends factory.taskName>(params: factory.task.ISearchConditions<T>): Promise<number>;
32
+ count(params: factory.task.ISearchConditions): Promise<number>;
33
33
  /**
34
34
  * 検索する
35
35
  */
36
- search<T extends factory.taskName>(params: factory.task.ISearchConditions<T>, projection?: any): Promise<factory.task.ITask<T>[]>;
36
+ search(params: factory.task.ISearchConditions, projection?: any): Promise<factory.task.ITask<factory.taskName>[]>;
37
37
  deleteByProject(params: {
38
38
  project: {
39
39
  id: string;
@@ -29,29 +29,24 @@ class MongoRepository {
29
29
  }
30
30
  // tslint:disable-next-line:max-func-body-length
31
31
  static CREATE_MONGO_CONDITIONS(params) {
32
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
33
- const andConditions = [{
34
- name: { $exists: true }
35
- }];
36
- // tslint:disable-next-line:no-single-line-block-comment
37
- /* istanbul ignore else */
38
- if (params.project !== undefined) {
39
- if (params.project.id !== undefined && params.project.id !== null) {
40
- if (typeof params.project.id.$eq === 'string') {
41
- andConditions.push({
42
- 'project.id': {
43
- $eq: params.project.id.$eq
44
- }
45
- });
46
- }
47
- }
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
33
+ const andConditions = [];
34
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
35
+ if (typeof projectIdEq === 'string') {
36
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
48
37
  }
49
- // tslint:disable-next-line:no-single-line-block-comment
50
- /* istanbul ignore else */
51
- if (params.name !== undefined) {
52
- andConditions.push({
53
- name: params.name
54
- });
38
+ if (typeof params.name === 'string') {
39
+ andConditions.push({ name: { $eq: params.name } });
40
+ }
41
+ else {
42
+ const nameIn = (_c = params.name) === null || _c === void 0 ? void 0 : _c.$in;
43
+ if (Array.isArray(nameIn)) {
44
+ andConditions.push({ name: { $in: nameIn } });
45
+ }
46
+ const nameNin = (_d = params.name) === null || _d === void 0 ? void 0 : _d.$nin;
47
+ if (Array.isArray(nameNin)) {
48
+ andConditions.push({ name: { $nin: nameNin } });
49
+ }
55
50
  }
56
51
  // tslint:disable-next-line:no-single-line-block-comment
57
52
  /* istanbul ignore else */
@@ -94,7 +89,7 @@ class MongoRepository {
94
89
  }
95
90
  });
96
91
  }
97
- const dateAbortedGte = (_a = params.dateAborted) === null || _a === void 0 ? void 0 : _a.$gte;
92
+ const dateAbortedGte = (_e = params.dateAborted) === null || _e === void 0 ? void 0 : _e.$gte;
98
93
  if (dateAbortedGte instanceof Date) {
99
94
  andConditions.push({
100
95
  dateAborted: {
@@ -103,7 +98,7 @@ class MongoRepository {
103
98
  }
104
99
  });
105
100
  }
106
- const dateAbortedLte = (_b = params.dateAborted) === null || _b === void 0 ? void 0 : _b.$lte;
101
+ const dateAbortedLte = (_f = params.dateAborted) === null || _f === void 0 ? void 0 : _f.$lte;
107
102
  if (dateAbortedLte instanceof Date) {
108
103
  andConditions.push({
109
104
  dateAborted: {
@@ -112,7 +107,7 @@ class MongoRepository {
112
107
  }
113
108
  });
114
109
  }
115
- const objectTransactionNumberEq = (_e = (_d = (_c = params.data) === null || _c === void 0 ? void 0 : _c.object) === null || _d === void 0 ? void 0 : _d.transactionNumber) === null || _e === void 0 ? void 0 : _e.$eq;
110
+ const objectTransactionNumberEq = (_j = (_h = (_g = params.data) === null || _g === void 0 ? void 0 : _g.object) === null || _h === void 0 ? void 0 : _h.transactionNumber) === null || _j === void 0 ? void 0 : _j.$eq;
116
111
  if (typeof objectTransactionNumberEq === 'string') {
117
112
  andConditions.push({
118
113
  'data.object.transactionNumber': {
@@ -121,7 +116,7 @@ class MongoRepository {
121
116
  }
122
117
  });
123
118
  }
124
- const objectPurposeIdEq = (_h = (_g = (_f = params.data) === null || _f === void 0 ? void 0 : _f.purpose) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
119
+ const objectPurposeIdEq = (_m = (_l = (_k = params.data) === null || _k === void 0 ? void 0 : _k.purpose) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
125
120
  if (typeof objectPurposeIdEq === 'string') {
126
121
  andConditions.push({
127
122
  'data.purpose.id': {
@@ -130,7 +125,7 @@ class MongoRepository {
130
125
  }
131
126
  });
132
127
  }
133
- const objectPurposeOrderNumberEq = (_l = (_k = (_j = params.data) === null || _j === void 0 ? void 0 : _j.purpose) === null || _k === void 0 ? void 0 : _k.orderNumber) === null || _l === void 0 ? void 0 : _l.$eq;
128
+ const objectPurposeOrderNumberEq = (_q = (_p = (_o = params.data) === null || _o === void 0 ? void 0 : _o.purpose) === null || _p === void 0 ? void 0 : _p.orderNumber) === null || _q === void 0 ? void 0 : _q.$eq;
134
129
  if (typeof objectPurposeOrderNumberEq === 'string') {
135
130
  andConditions.push({
136
131
  'data.purpose.orderNumber': {
@@ -113,16 +113,13 @@ function abort(params) {
113
113
  exports.abort = abort;
114
114
  function notifyAbortedTasks(params) {
115
115
  return (repos) => __awaiter(this, void 0, void 0, function* () {
116
- let abortedTasks = yield repos.task.search({
117
- statuses: [factory.taskStatus.Aborted],
118
- dateAborted: {
119
- $gte: params.dateAbortedGte
120
- }
121
- });
116
+ const abortedTasks = yield repos.task.search(Object.assign({ statuses: [factory.taskStatus.Aborted], dateAborted: { $gte: params.dateAbortedGte } }, (settings_1.ABORTED_TASKS_WITHOUT_REPORT.length > 0)
117
+ ? { name: { $nin: settings_1.ABORTED_TASKS_WITHOUT_REPORT } }
118
+ : undefined));
122
119
  // 中止を報告しないタスク以外にフィルター
123
- abortedTasks = abortedTasks.filter((task) => {
124
- return !settings_1.ABORTED_TASKS_WITHOUT_REPORT.includes(task.name);
125
- });
120
+ // abortedTasks = abortedTasks.filter((task) => {
121
+ // return !ABORTED_TASKS_WITHOUT_REPORT.includes(task.name);
122
+ // });
126
123
  if (abortedTasks.length > 0) {
127
124
  // 開発者へ報告
128
125
  const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.282.0",
12
+ "@chevre/factory": "4.283.0",
13
13
  "@cinerino/sdk": "3.135.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0-alpha.21"
123
+ "version": "20.2.0-alpha.22"
124
124
  }