@chevre/domain 20.0.0-alpha.5 → 20.1.0-alpha.0

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.
@@ -10,8 +10,12 @@ export declare class MongoRepository {
10
10
  static CREATE_MONGO_CONDITIONS(params: factory.product.ISearchConditions): any[];
11
11
  findById(conditions: {
12
12
  id: string;
13
- }, projection?: any): Promise<IProduct>;
14
- search(conditions: factory.product.ISearchConditions, projection?: any): Promise<IProduct[]>;
13
+ }, projection?: {
14
+ [key: string]: number;
15
+ }): Promise<IProduct>;
16
+ search(conditions: factory.product.ISearchConditions, projection?: {
17
+ [key: string]: number;
18
+ }): Promise<IProduct[]>;
15
19
  deleteById(params: {
16
20
  id: string;
17
21
  }): Promise<void>;
@@ -32,31 +32,25 @@ class MongoRepository {
32
32
  }
33
33
  // tslint:disable-next-line:max-func-body-length
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
36
36
  // MongoDB検索条件
37
37
  const andConditions = [];
38
38
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
39
39
  if (typeof projectIdEq === 'string') {
40
40
  andConditions.push({
41
- 'project.id': {
42
- $eq: projectIdEq
43
- }
41
+ 'project.id': { $eq: projectIdEq }
44
42
  });
45
43
  }
46
44
  const typeOfEq = (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$eq;
47
45
  if (typeof typeOfEq === 'string') {
48
46
  andConditions.push({
49
- typeOf: {
50
- $eq: typeOfEq
51
- }
47
+ typeOf: { $eq: typeOfEq }
52
48
  });
53
49
  }
54
50
  const typeOfIn = (_d = params.typeOf) === null || _d === void 0 ? void 0 : _d.$in;
55
51
  if (Array.isArray(typeOfIn)) {
56
52
  andConditions.push({
57
- typeOf: {
58
- $in: typeOfIn
59
- }
53
+ typeOf: { $in: typeOfIn }
60
54
  });
61
55
  }
62
56
  const hasOfferCatalogIdEq = (_f = (_e = params.hasOfferCatalog) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
@@ -79,38 +73,22 @@ class MongoRepository {
79
73
  const productIDEq = (_j = params.productID) === null || _j === void 0 ? void 0 : _j.$eq;
80
74
  if (typeof productIDEq === 'string') {
81
75
  andConditions.push({
82
- productID: {
83
- $eq: productIDEq
84
- }
76
+ productID: { $eq: productIDEq }
85
77
  });
86
78
  }
87
79
  const productIDIn = (_k = params.productID) === null || _k === void 0 ? void 0 : _k.$in;
88
80
  if (Array.isArray(productIDIn)) {
89
81
  andConditions.push({
90
- productID: {
91
- $in: productIDIn
92
- }
82
+ productID: { $in: productIDIn }
83
+ });
84
+ }
85
+ const productIDRegex = (_l = params.productID) === null || _l === void 0 ? void 0 : _l.$regex;
86
+ if (typeof productIDRegex === 'string' && productIDRegex.length > 0) {
87
+ andConditions.push({
88
+ productID: { $regex: new RegExp(productIDRegex) }
93
89
  });
94
90
  }
95
- // const offersValidFromGte = params.offers?.validFrom?.$gte;
96
- // if (offersValidFromGte instanceof Date) {
97
- // andConditions.push({
98
- // 'offers.validFrom': {
99
- // $exists: true,
100
- // $gte: offersValidFromGte
101
- // }
102
- // });
103
- // }
104
- // const offersSellerIdIn = params.offers?.seller?.id?.$in;
105
- // if (Array.isArray(offersSellerIdIn)) {
106
- // andConditions.push({
107
- // 'offers.seller.id': {
108
- // $exists: true,
109
- // $in: offersSellerIdIn
110
- // }
111
- // });
112
- // }
113
- const offersElemMatch = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.$elemMatch;
91
+ const offersElemMatch = (_m = params.offers) === null || _m === void 0 ? void 0 : _m.$elemMatch;
114
92
  if (offersElemMatch !== undefined && offersElemMatch !== null) {
115
93
  andConditions.push({
116
94
  offers: {
@@ -118,7 +96,7 @@ class MongoRepository {
118
96
  }
119
97
  });
120
98
  }
121
- const serviceOutputTypeOfEq = (_o = (_m = params.serviceOutput) === null || _m === void 0 ? void 0 : _m.typeOf) === null || _o === void 0 ? void 0 : _o.$eq;
99
+ const serviceOutputTypeOfEq = (_p = (_o = params.serviceOutput) === null || _o === void 0 ? void 0 : _o.typeOf) === null || _p === void 0 ? void 0 : _p.$eq;
122
100
  if (typeof serviceOutputTypeOfEq === 'string') {
123
101
  andConditions.push({
124
102
  'serviceOutput.typeOf': {
@@ -127,7 +105,7 @@ class MongoRepository {
127
105
  }
128
106
  });
129
107
  }
130
- const serviceOutputAmountCurrencyEq = (_r = (_q = (_p = params.serviceOutput) === null || _p === void 0 ? void 0 : _p.amount) === null || _q === void 0 ? void 0 : _q.currency) === null || _r === void 0 ? void 0 : _r.$eq;
108
+ const serviceOutputAmountCurrencyEq = (_s = (_r = (_q = params.serviceOutput) === null || _q === void 0 ? void 0 : _q.amount) === null || _r === void 0 ? void 0 : _r.currency) === null || _s === void 0 ? void 0 : _s.$eq;
131
109
  if (typeof serviceOutputAmountCurrencyEq === 'string') {
132
110
  andConditions.push({
133
111
  'serviceOutput.amount.currency': {
@@ -136,7 +114,7 @@ class MongoRepository {
136
114
  }
137
115
  });
138
116
  }
139
- const serviceTypeCodeValueEq = (_t = (_s = params.serviceType) === null || _s === void 0 ? void 0 : _s.codeValue) === null || _t === void 0 ? void 0 : _t.$eq;
117
+ const serviceTypeCodeValueEq = (_u = (_t = params.serviceType) === null || _t === void 0 ? void 0 : _t.codeValue) === null || _u === void 0 ? void 0 : _u.$eq;
140
118
  if (typeof serviceTypeCodeValueEq === 'string') {
141
119
  andConditions.push({
142
120
  'serviceType.codeValue': {
@@ -145,7 +123,7 @@ class MongoRepository {
145
123
  }
146
124
  });
147
125
  }
148
- const nameRegex = (_u = params.name) === null || _u === void 0 ? void 0 : _u.$regex;
126
+ const nameRegex = (_v = params.name) === null || _v === void 0 ? void 0 : _v.$regex;
149
127
  if (typeof nameRegex === 'string' && nameRegex.length > 0) {
150
128
  const nameRegexExp = new RegExp(nameRegex);
151
129
  andConditions.push({
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.274.0",
13
- "@cinerino/sdk": "3.130.0-alpha.6",
12
+ "@chevre/factory": "4.276.0-alpha.0",
13
+ "@cinerino/sdk": "3.132.0-alpha.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.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.0.0-alpha.5"
123
+ "version": "20.1.0-alpha.0"
124
124
  }