@chevre/domain 21.19.0-alpha.9 → 21.19.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.
Files changed (49) hide show
  1. package/example/src/chevre/processAction.ts +42 -0
  2. package/example/src/chevre/searchOffers.ts +2 -1
  3. package/example/src/chevre/upsertProductsByProductId.ts +99 -0
  4. package/lib/chevre/repo/action.d.ts +9 -4
  5. package/lib/chevre/repo/action.js +24 -3
  6. package/lib/chevre/repo/aggregateOffer.js +28 -22
  7. package/lib/chevre/repo/offer.js +28 -22
  8. package/lib/chevre/repo/offerCatalog.js +13 -9
  9. package/lib/chevre/repo/offerCatalogItem.js +14 -10
  10. package/lib/chevre/repo/paymentService.d.ts +2 -7
  11. package/lib/chevre/repo/paymentService.js +14 -54
  12. package/lib/chevre/repo/paymentServiceProvider.js +1 -4
  13. package/lib/chevre/repo/product.d.ts +19 -7
  14. package/lib/chevre/repo/product.js +47 -14
  15. package/lib/chevre/service/code.js +1 -3
  16. package/lib/chevre/service/delivery.js +2 -6
  17. package/lib/chevre/service/event/createEvent.js +1 -3
  18. package/lib/chevre/service/event.js +2 -6
  19. package/lib/chevre/service/moneyTransfer.js +1 -3
  20. package/lib/chevre/service/notification.js +2 -6
  21. package/lib/chevre/service/offer/event/authorize.js +1 -2
  22. package/lib/chevre/service/offer/eventServiceByCOA.js +2 -4
  23. package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -3
  24. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -3
  25. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +1 -3
  26. package/lib/chevre/service/offer/product.js +1 -2
  27. package/lib/chevre/service/order/confirmPayTransaction.js +1 -3
  28. package/lib/chevre/service/order/placeOrder.js +2 -6
  29. package/lib/chevre/service/order/returnOrder.js +1 -3
  30. package/lib/chevre/service/order/sendOrder.js +1 -2
  31. package/lib/chevre/service/payment/any.js +1 -2
  32. package/lib/chevre/service/payment/creditCard.js +2 -5
  33. package/lib/chevre/service/payment/faceToFace.js +2 -5
  34. package/lib/chevre/service/payment/movieTicket.js +2 -6
  35. package/lib/chevre/service/payment/paymentCard.js +2 -4
  36. package/lib/chevre/service/product.js +1 -3
  37. package/lib/chevre/service/reserve/cancelReservation.js +2 -6
  38. package/lib/chevre/service/reserve/confirmReservation.js +1 -3
  39. package/lib/chevre/service/reserve/useReservation.js +1 -3
  40. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -3
  41. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -3
  42. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -14
  43. package/lib/chevre/service/task/returnPayTransaction.js +1 -2
  44. package/lib/chevre/service/task/returnReserveTransaction.js +1 -2
  45. package/lib/chevre/service/transaction/deleteTransaction.js +1 -3
  46. package/lib/chevre/service/transaction/moneyTransfer.js +1 -2
  47. package/lib/chevre/settings.d.ts +0 -2
  48. package/lib/chevre/settings.js +1 -3
  49. package/package.json +3 -3
@@ -0,0 +1,42 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ // tslint:disable-next-line:max-func-body-length
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
13
+ const action = await actionRepo.start({
14
+ project: { typeOf: chevre.factory.organizationType.Project, id: project.id },
15
+ typeOf: chevre.factory.actionType.CreateAction,
16
+ agent: {
17
+ id: project.id,
18
+ name: 'sample',
19
+ typeOf: chevre.factory.organizationType.Project
20
+ },
21
+ object: { typeOf: chevre.factory.offerType.Offer },
22
+ ...{
23
+ targetCollection: { typeOf: chevre.factory.offerType.Offer }
24
+ }
25
+ });
26
+ // const error = new Error('sample error');
27
+ // await actionRepo.giveUp({
28
+ // typeOf: action.typeOf,
29
+ // id: action.id,
30
+ // // error: { ...error, message: error.message, name: error.name }
31
+ // error
32
+ // });
33
+ await actionRepo.completeWithVoid({
34
+ typeOf: action.typeOf,
35
+ id: action.id,
36
+ result: {}
37
+ });
38
+ }
39
+
40
+ main()
41
+ .then()
42
+ .catch(console.error);
@@ -28,6 +28,7 @@ async function main() {
28
28
  },
29
29
  priceSpecification: {
30
30
  appliesToMovieTicket: {
31
+ $size: 2,
31
32
  serviceOutput: {
32
33
  typeOf: {
33
34
  // $eq: '',
@@ -54,7 +55,7 @@ async function main() {
54
55
  // ]
55
56
  // }
56
57
  },
57
- { project: 1 }
58
+ { project: 1, name: 1 }
58
59
  );
59
60
  console.log(offers.map((offer) => {
60
61
  return `${offer.project?.id} ${offer.id} ${offer.parentOffer?.id} ${offer.identifier} ${offer.name?.ja}`;
@@ -0,0 +1,99 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+
8
+ // tslint:disable-next-line:max-func-body-length
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
13
+
14
+ const result = await productRepo.upsertManyByProductId(
15
+ [
16
+ {
17
+ $set: {
18
+ project: {
19
+ typeOf: chevre.factory.organizationType.Project,
20
+ id: PROJECT_ID
21
+ },
22
+ typeOf: chevre.factory.product.ProductType.EventService,
23
+ productID: '2023122601EventService',
24
+ name: {
25
+ en: 'xxx',
26
+ ja: 'xxx'
27
+ },
28
+ // hasOfferCatalog: {
29
+ // id: 'blpc770py',
30
+ // typeOf: 'OfferCatalog'
31
+ // },
32
+ // serviceType: {
33
+ // codeValue: '0001',
34
+ // typeOf: 'CategoryCode',
35
+ // inCodeSet: {
36
+ // identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType,
37
+ // typeOf: 'CategoryCodeSet'
38
+ // }
39
+ // },
40
+ availableChannel: {
41
+ typeOf: 'ServiceChannel',
42
+ credentials: {}
43
+ },
44
+ description: {
45
+ en: 'xxx',
46
+ ja: 'xxx'
47
+ }
48
+ },
49
+ $unset: {
50
+ hasOfferCatalog: 1,
51
+ serviceType: 1
52
+ }
53
+ },
54
+ {
55
+ $set: {
56
+ project: {
57
+ typeOf: chevre.factory.organizationType.Project,
58
+ id: PROJECT_ID
59
+ },
60
+ typeOf: chevre.factory.product.ProductType.EventService,
61
+ productID: '2023122602EventService',
62
+ name: {
63
+ en: 'xxx',
64
+ ja: 'xxx'
65
+ },
66
+ hasOfferCatalog: {
67
+ id: 'blpc770py',
68
+ typeOf: 'OfferCatalog'
69
+ },
70
+ // serviceType: {
71
+ // codeValue: '0001',
72
+ // typeOf: 'CategoryCode',
73
+ // inCodeSet: {
74
+ // identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType,
75
+ // typeOf: 'CategoryCodeSet'
76
+ // }
77
+ // },
78
+ availableChannel: {
79
+ typeOf: 'ServiceChannel',
80
+ credentials: {}
81
+ },
82
+ description: {
83
+ en: 'xxx',
84
+ ja: 'xxx'
85
+ }
86
+ },
87
+ $unset: {
88
+ }
89
+ }
90
+ ]
91
+ // { replace: true }
92
+ );
93
+ // tslint:disable-next-line:no-null-keyword
94
+ console.log(result);
95
+ }
96
+
97
+ main()
98
+ .then(console.log)
99
+ .catch(console.error);
@@ -70,6 +70,11 @@ export declare class MongoRepository {
70
70
  id: string;
71
71
  result: any;
72
72
  }): Promise<IAction<T>>;
73
+ completeWithVoid(params: {
74
+ typeOf: factory.actionType;
75
+ id: string;
76
+ result: any;
77
+ }): Promise<void>;
73
78
  /**
74
79
  * アクション取消
75
80
  */
@@ -80,11 +85,11 @@ export declare class MongoRepository {
80
85
  /**
81
86
  * アクション失敗
82
87
  */
83
- giveUp<T extends factory.actionType>(params: {
84
- typeOf: T;
88
+ giveUp(params: {
89
+ typeOf: factory.actionType;
85
90
  id: string;
86
- error: any;
87
- }): Promise<IAction<T>>;
91
+ error: Error;
92
+ }): Promise<void>;
88
93
  /**
89
94
  * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
90
95
  */
@@ -492,6 +492,22 @@ class MongoRepository {
492
492
  return doc.toObject();
493
493
  });
494
494
  }
495
+ completeWithVoid(params) {
496
+ return __awaiter(this, void 0, void 0, function* () {
497
+ const doc = yield this.actionModel.findOneAndUpdate({
498
+ _id: { $eq: params.id },
499
+ typeOf: { $eq: params.typeOf }
500
+ }, {
501
+ actionStatus: factory.actionStatusType.CompletedActionStatus,
502
+ result: params.result,
503
+ endDate: new Date()
504
+ }, { new: false, projection: { _id: 1 } })
505
+ .exec();
506
+ if (doc === null) {
507
+ throw new factory.errors.NotFound(this.actionModel.modelName);
508
+ }
509
+ });
510
+ }
495
511
  /**
496
512
  * アクション取消
497
513
  */
@@ -514,20 +530,25 @@ class MongoRepository {
514
530
  */
515
531
  giveUp(params) {
516
532
  return __awaiter(this, void 0, void 0, function* () {
533
+ const actionError = Object.assign(Object.assign({}, params.error), { message: params.error.message, name: params.error.name });
534
+ // const actionError: Object = params.error;
535
+ // if (params.error instanceof Error) {
536
+ // actionError = { ...params.error, message: params.error.message, name: params.error.name };
537
+ // }
517
538
  const doc = yield this.actionModel.findOneAndUpdate({
518
539
  typeOf: params.typeOf,
519
540
  _id: params.id
520
541
  }, {
521
542
  actionStatus: factory.actionStatusType.FailedActionStatus,
522
- error: params.error,
543
+ error: actionError,
523
544
  endDate: new Date()
524
545
  }, { new: true })
525
- .select({ __v: 0, createdAt: 0, updatedAt: 0 })
546
+ .select({ _id: 1 })
526
547
  .exec();
527
548
  if (doc === null) {
528
549
  throw new factory.errors.NotFound(this.actionModel.modelName);
529
550
  }
530
- return doc.toObject();
551
+ // return doc.toObject();
531
552
  });
532
553
  }
533
554
  /**
@@ -22,7 +22,7 @@ class MongoRepository {
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
26
26
  const matchStages = [];
27
27
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
28
28
  if (typeof projectIdEq === 'string') {
@@ -172,7 +172,13 @@ class MongoRepository {
172
172
  }
173
173
  });
174
174
  }
175
- const appliesToMovieTicketServiceTypeExist = (_w = (_v = (_u = params.priceSpecification) === null || _u === void 0 ? void 0 : _u.appliesToMovieTicket) === null || _v === void 0 ? void 0 : _v.serviceType) === null || _w === void 0 ? void 0 : _w.$exists;
175
+ const appliesToMovieTicketSize = (_v = (_u = params.priceSpecification) === null || _u === void 0 ? void 0 : _u.appliesToMovieTicket) === null || _v === void 0 ? void 0 : _v.$size;
176
+ if (typeof appliesToMovieTicketSize === 'number') {
177
+ matchStages.push({
178
+ $match: { 'offers.priceSpecification.appliesToMovieTicket': { $exists: true, $size: appliesToMovieTicketSize } }
179
+ });
180
+ }
181
+ const appliesToMovieTicketServiceTypeExist = (_y = (_x = (_w = params.priceSpecification) === null || _w === void 0 ? void 0 : _w.appliesToMovieTicket) === null || _x === void 0 ? void 0 : _x.serviceType) === null || _y === void 0 ? void 0 : _y.$exists;
176
182
  if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
177
183
  matchStages.push({
178
184
  $match: {
@@ -182,7 +188,7 @@ class MongoRepository {
182
188
  }
183
189
  });
184
190
  }
185
- const appliesToMovieTicketServiceTypeEq = (_z = (_y = (_x = params.priceSpecification) === null || _x === void 0 ? void 0 : _x.appliesToMovieTicket) === null || _y === void 0 ? void 0 : _y.serviceType) === null || _z === void 0 ? void 0 : _z.$eq;
191
+ const appliesToMovieTicketServiceTypeEq = (_1 = (_0 = (_z = params.priceSpecification) === null || _z === void 0 ? void 0 : _z.appliesToMovieTicket) === null || _0 === void 0 ? void 0 : _0.serviceType) === null || _1 === void 0 ? void 0 : _1.$eq;
186
192
  if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
187
193
  matchStages.push({
188
194
  $match: {
@@ -193,7 +199,7 @@ class MongoRepository {
193
199
  }
194
200
  });
195
201
  }
196
- const appliesToMovieTicketServiceOutputTypeOfEq = (_3 = (_2 = (_1 = (_0 = params.priceSpecification) === null || _0 === void 0 ? void 0 : _0.appliesToMovieTicket) === null || _1 === void 0 ? void 0 : _1.serviceOutput) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$eq;
202
+ const appliesToMovieTicketServiceOutputTypeOfEq = (_5 = (_4 = (_3 = (_2 = params.priceSpecification) === null || _2 === void 0 ? void 0 : _2.appliesToMovieTicket) === null || _3 === void 0 ? void 0 : _3.serviceOutput) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
197
203
  if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
198
204
  matchStages.push({
199
205
  $match: {
@@ -204,7 +210,7 @@ class MongoRepository {
204
210
  }
205
211
  });
206
212
  }
207
- const appliesToMovieTicketServiceOutputTypeOfAll = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$all;
213
+ const appliesToMovieTicketServiceOutputTypeOfAll = (_9 = (_8 = (_7 = (_6 = params.priceSpecification) === null || _6 === void 0 ? void 0 : _6.appliesToMovieTicket) === null || _7 === void 0 ? void 0 : _7.serviceOutput) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$all;
208
214
  if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfAll)) {
209
215
  matchStages.push({
210
216
  $match: {
@@ -215,7 +221,7 @@ class MongoRepository {
215
221
  }
216
222
  });
217
223
  }
218
- const appliesToMovieTicketServiceOutputTypeOfNin = (_11 = (_10 = (_9 = (_8 = params.priceSpecification) === null || _8 === void 0 ? void 0 : _8.appliesToMovieTicket) === null || _9 === void 0 ? void 0 : _9.serviceOutput) === null || _10 === void 0 ? void 0 : _10.typeOf) === null || _11 === void 0 ? void 0 : _11.$nin;
224
+ const appliesToMovieTicketServiceOutputTypeOfNin = (_13 = (_12 = (_11 = (_10 = params.priceSpecification) === null || _10 === void 0 ? void 0 : _10.appliesToMovieTicket) === null || _11 === void 0 ? void 0 : _11.serviceOutput) === null || _12 === void 0 ? void 0 : _12.typeOf) === null || _13 === void 0 ? void 0 : _13.$nin;
219
225
  if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
220
226
  matchStages.push({
221
227
  $match: {
@@ -226,7 +232,7 @@ class MongoRepository {
226
232
  });
227
233
  }
228
234
  if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
229
- const priceSpecificationPriceGte = (_12 = params.priceSpecification.price) === null || _12 === void 0 ? void 0 : _12.$gte;
235
+ const priceSpecificationPriceGte = (_14 = params.priceSpecification.price) === null || _14 === void 0 ? void 0 : _14.$gte;
230
236
  if (typeof priceSpecificationPriceGte === 'number') {
231
237
  matchStages.push({
232
238
  $match: {
@@ -237,7 +243,7 @@ class MongoRepository {
237
243
  }
238
244
  });
239
245
  }
240
- const priceSpecificationPriceLte = (_13 = params.priceSpecification.price) === null || _13 === void 0 ? void 0 : _13.$lte;
246
+ const priceSpecificationPriceLte = (_15 = params.priceSpecification.price) === null || _15 === void 0 ? void 0 : _15.$lte;
241
247
  if (typeof priceSpecificationPriceLte === 'number') {
242
248
  matchStages.push({
243
249
  $match: {
@@ -248,7 +254,7 @@ class MongoRepository {
248
254
  }
249
255
  });
250
256
  }
251
- const accountsReceivableGte = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.accountsReceivable) === null || _15 === void 0 ? void 0 : _15.$gte;
257
+ const accountsReceivableGte = (_17 = (_16 = params.priceSpecification.accounting) === null || _16 === void 0 ? void 0 : _16.accountsReceivable) === null || _17 === void 0 ? void 0 : _17.$gte;
252
258
  if (typeof accountsReceivableGte === 'number') {
253
259
  matchStages.push({
254
260
  $match: {
@@ -259,7 +265,7 @@ class MongoRepository {
259
265
  }
260
266
  });
261
267
  }
262
- const accountsReceivableLte = (_17 = (_16 = params.priceSpecification.accounting) === null || _16 === void 0 ? void 0 : _16.accountsReceivable) === null || _17 === void 0 ? void 0 : _17.$lte;
268
+ const accountsReceivableLte = (_19 = (_18 = params.priceSpecification.accounting) === null || _18 === void 0 ? void 0 : _18.accountsReceivable) === null || _19 === void 0 ? void 0 : _19.$lte;
263
269
  if (typeof accountsReceivableLte === 'number') {
264
270
  matchStages.push({
265
271
  $match: {
@@ -270,7 +276,7 @@ class MongoRepository {
270
276
  }
271
277
  });
272
278
  }
273
- const accountingCodeValueEq = (_20 = (_19 = (_18 = params.priceSpecification.accounting) === null || _18 === void 0 ? void 0 : _18.operatingRevenue) === null || _19 === void 0 ? void 0 : _19.codeValue) === null || _20 === void 0 ? void 0 : _20.$eq;
279
+ const accountingCodeValueEq = (_22 = (_21 = (_20 = params.priceSpecification.accounting) === null || _20 === void 0 ? void 0 : _20.operatingRevenue) === null || _21 === void 0 ? void 0 : _21.codeValue) === null || _22 === void 0 ? void 0 : _22.$eq;
274
280
  if (typeof accountingCodeValueEq === 'string') {
275
281
  matchStages.push({
276
282
  $match: {
@@ -281,7 +287,7 @@ class MongoRepository {
281
287
  }
282
288
  });
283
289
  }
284
- const accountingCodeValueIn = (_23 = (_22 = (_21 = params.priceSpecification.accounting) === null || _21 === void 0 ? void 0 : _21.operatingRevenue) === null || _22 === void 0 ? void 0 : _22.codeValue) === null || _23 === void 0 ? void 0 : _23.$in;
290
+ const accountingCodeValueIn = (_25 = (_24 = (_23 = params.priceSpecification.accounting) === null || _23 === void 0 ? void 0 : _23.operatingRevenue) === null || _24 === void 0 ? void 0 : _24.codeValue) === null || _25 === void 0 ? void 0 : _25.$in;
285
291
  if (Array.isArray(accountingCodeValueIn)) {
286
292
  matchStages.push({
287
293
  $match: {
@@ -292,7 +298,7 @@ class MongoRepository {
292
298
  }
293
299
  });
294
300
  }
295
- const referenceQuantityValueEq = (_25 = (_24 = params.priceSpecification.referenceQuantity) === null || _24 === void 0 ? void 0 : _24.value) === null || _25 === void 0 ? void 0 : _25.$eq;
301
+ const referenceQuantityValueEq = (_27 = (_26 = params.priceSpecification.referenceQuantity) === null || _26 === void 0 ? void 0 : _26.value) === null || _27 === void 0 ? void 0 : _27.$eq;
296
302
  if (typeof referenceQuantityValueEq === 'number') {
297
303
  matchStages.push({
298
304
  $match: {
@@ -304,7 +310,7 @@ class MongoRepository {
304
310
  });
305
311
  }
306
312
  }
307
- const availabilityEq = (_26 = params.availability) === null || _26 === void 0 ? void 0 : _26.$eq;
313
+ const availabilityEq = (_28 = params.availability) === null || _28 === void 0 ? void 0 : _28.$eq;
308
314
  if (typeof availabilityEq === 'string') {
309
315
  matchStages.push({
310
316
  $match: {
@@ -312,7 +318,7 @@ class MongoRepository {
312
318
  }
313
319
  });
314
320
  }
315
- const availableAtOrFromIdEq = (_28 = (_27 = params.availableAtOrFrom) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
321
+ const availableAtOrFromIdEq = (_30 = (_29 = params.availableAtOrFrom) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$eq;
316
322
  if (typeof availableAtOrFromIdEq === 'string') {
317
323
  matchStages.push({
318
324
  $match: {
@@ -323,7 +329,7 @@ class MongoRepository {
323
329
  }
324
330
  });
325
331
  }
326
- const availableAtOrFromIdIn = (_30 = (_29 = params.availableAtOrFrom) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
332
+ const availableAtOrFromIdIn = (_32 = (_31 = params.availableAtOrFrom) === null || _31 === void 0 ? void 0 : _31.id) === null || _32 === void 0 ? void 0 : _32.$in;
327
333
  if (Array.isArray(availableAtOrFromIdIn)) {
328
334
  matchStages.push({
329
335
  $match: {
@@ -334,7 +340,7 @@ class MongoRepository {
334
340
  }
335
341
  });
336
342
  }
337
- const addOnItemOfferedIdEq = (_33 = (_32 = (_31 = params.addOn) === null || _31 === void 0 ? void 0 : _31.itemOffered) === null || _32 === void 0 ? void 0 : _32.id) === null || _33 === void 0 ? void 0 : _33.$eq;
343
+ const addOnItemOfferedIdEq = (_35 = (_34 = (_33 = params.addOn) === null || _33 === void 0 ? void 0 : _33.itemOffered) === null || _34 === void 0 ? void 0 : _34.id) === null || _35 === void 0 ? void 0 : _35.$eq;
338
344
  if (typeof addOnItemOfferedIdEq === 'string') {
339
345
  matchStages.push({
340
346
  $match: {
@@ -342,7 +348,7 @@ class MongoRepository {
342
348
  }
343
349
  });
344
350
  }
345
- const addOnItemOfferedIdIn = (_36 = (_35 = (_34 = params.addOn) === null || _34 === void 0 ? void 0 : _34.itemOffered) === null || _35 === void 0 ? void 0 : _35.id) === null || _36 === void 0 ? void 0 : _36.$in;
351
+ const addOnItemOfferedIdIn = (_38 = (_37 = (_36 = params.addOn) === null || _36 === void 0 ? void 0 : _36.itemOffered) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$in;
346
352
  if (Array.isArray(addOnItemOfferedIdIn)) {
347
353
  matchStages.push({
348
354
  $match: {
@@ -350,7 +356,7 @@ class MongoRepository {
350
356
  }
351
357
  });
352
358
  }
353
- const hasMerchantReturnPolicyIdEq = (_38 = (_37 = params.hasMerchantReturnPolicy) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$eq;
359
+ const hasMerchantReturnPolicyIdEq = (_40 = (_39 = params.hasMerchantReturnPolicy) === null || _39 === void 0 ? void 0 : _39.id) === null || _40 === void 0 ? void 0 : _40.$eq;
354
360
  if (typeof hasMerchantReturnPolicyIdEq === 'string') {
355
361
  matchStages.push({
356
362
  $match: {
@@ -361,7 +367,7 @@ class MongoRepository {
361
367
  }
362
368
  });
363
369
  }
364
- const acceptedPaymentMethodIdentifierIn = (_40 = (_39 = params.acceptedPaymentMethod) === null || _39 === void 0 ? void 0 : _39.identifier) === null || _40 === void 0 ? void 0 : _40.$in;
370
+ const acceptedPaymentMethodIdentifierIn = (_42 = (_41 = params.acceptedPaymentMethod) === null || _41 === void 0 ? void 0 : _41.identifier) === null || _42 === void 0 ? void 0 : _42.$in;
365
371
  if (Array.isArray(acceptedPaymentMethodIdentifierIn)) {
366
372
  matchStages.push({
367
373
  $match: {
@@ -372,7 +378,7 @@ class MongoRepository {
372
378
  }
373
379
  });
374
380
  }
375
- const additionalPropertyAll = (_41 = params.additionalProperty) === null || _41 === void 0 ? void 0 : _41.$all;
381
+ const additionalPropertyAll = (_43 = params.additionalProperty) === null || _43 === void 0 ? void 0 : _43.$all;
376
382
  if (Array.isArray(additionalPropertyAll)) {
377
383
  matchStages.push({
378
384
  $match: {
@@ -383,7 +389,7 @@ class MongoRepository {
383
389
  }
384
390
  });
385
391
  }
386
- const additionalPropertyElemMatch = (_42 = params.additionalProperty) === null || _42 === void 0 ? void 0 : _42.$elemMatch;
392
+ const additionalPropertyElemMatch = (_44 = params.additionalProperty) === null || _44 === void 0 ? void 0 : _44.$elemMatch;
387
393
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
388
394
  matchStages.push({
389
395
  $match: {
@@ -40,7 +40,7 @@ class MongoRepository {
40
40
  }
41
41
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
42
42
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
43
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46;
43
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48;
44
44
  const matchStages = [];
45
45
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
46
46
  if (typeof projectIdEq === 'string') {
@@ -172,7 +172,13 @@ class MongoRepository {
172
172
  }
173
173
  });
174
174
  }
175
- const appliesToMovieTicketServiceTypeExist = (_0 = (_z = (_y = params.priceSpecification) === null || _y === void 0 ? void 0 : _y.appliesToMovieTicket) === null || _z === void 0 ? void 0 : _z.serviceType) === null || _0 === void 0 ? void 0 : _0.$exists;
175
+ const appliesToMovieTicketSize = (_z = (_y = params.priceSpecification) === null || _y === void 0 ? void 0 : _y.appliesToMovieTicket) === null || _z === void 0 ? void 0 : _z.$size;
176
+ if (typeof appliesToMovieTicketSize === 'number') {
177
+ matchStages.push({
178
+ $match: { 'offers.priceSpecification.appliesToMovieTicket': { $exists: true, $size: appliesToMovieTicketSize } }
179
+ });
180
+ }
181
+ const appliesToMovieTicketServiceTypeExist = (_2 = (_1 = (_0 = params.priceSpecification) === null || _0 === void 0 ? void 0 : _0.appliesToMovieTicket) === null || _1 === void 0 ? void 0 : _1.serviceType) === null || _2 === void 0 ? void 0 : _2.$exists;
176
182
  if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
177
183
  matchStages.push({
178
184
  $match: {
@@ -182,7 +188,7 @@ class MongoRepository {
182
188
  }
183
189
  });
184
190
  }
185
- const appliesToMovieTicketServiceTypeEq = (_3 = (_2 = (_1 = params.priceSpecification) === null || _1 === void 0 ? void 0 : _1.appliesToMovieTicket) === null || _2 === void 0 ? void 0 : _2.serviceType) === null || _3 === void 0 ? void 0 : _3.$eq;
191
+ const appliesToMovieTicketServiceTypeEq = (_5 = (_4 = (_3 = params.priceSpecification) === null || _3 === void 0 ? void 0 : _3.appliesToMovieTicket) === null || _4 === void 0 ? void 0 : _4.serviceType) === null || _5 === void 0 ? void 0 : _5.$eq;
186
192
  if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
187
193
  matchStages.push({
188
194
  $match: {
@@ -193,7 +199,7 @@ class MongoRepository {
193
199
  }
194
200
  });
195
201
  }
196
- const appliesToMovieTicketServiceOutputTypeOfEq = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
202
+ const appliesToMovieTicketServiceOutputTypeOfEq = (_9 = (_8 = (_7 = (_6 = params.priceSpecification) === null || _6 === void 0 ? void 0 : _6.appliesToMovieTicket) === null || _7 === void 0 ? void 0 : _7.serviceOutput) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$eq;
197
203
  if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
198
204
  matchStages.push({
199
205
  $match: {
@@ -204,7 +210,7 @@ class MongoRepository {
204
210
  }
205
211
  });
206
212
  }
207
- const appliesToMovieTicketServiceOutputTypeOfAll = (_11 = (_10 = (_9 = (_8 = params.priceSpecification) === null || _8 === void 0 ? void 0 : _8.appliesToMovieTicket) === null || _9 === void 0 ? void 0 : _9.serviceOutput) === null || _10 === void 0 ? void 0 : _10.typeOf) === null || _11 === void 0 ? void 0 : _11.$all;
213
+ const appliesToMovieTicketServiceOutputTypeOfAll = (_13 = (_12 = (_11 = (_10 = params.priceSpecification) === null || _10 === void 0 ? void 0 : _10.appliesToMovieTicket) === null || _11 === void 0 ? void 0 : _11.serviceOutput) === null || _12 === void 0 ? void 0 : _12.typeOf) === null || _13 === void 0 ? void 0 : _13.$all;
208
214
  if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfAll)) {
209
215
  matchStages.push({
210
216
  $match: {
@@ -215,7 +221,7 @@ class MongoRepository {
215
221
  }
216
222
  });
217
223
  }
218
- const appliesToMovieTicketServiceOutputTypeOfNin = (_15 = (_14 = (_13 = (_12 = params.priceSpecification) === null || _12 === void 0 ? void 0 : _12.appliesToMovieTicket) === null || _13 === void 0 ? void 0 : _13.serviceOutput) === null || _14 === void 0 ? void 0 : _14.typeOf) === null || _15 === void 0 ? void 0 : _15.$nin;
224
+ const appliesToMovieTicketServiceOutputTypeOfNin = (_17 = (_16 = (_15 = (_14 = params.priceSpecification) === null || _14 === void 0 ? void 0 : _14.appliesToMovieTicket) === null || _15 === void 0 ? void 0 : _15.serviceOutput) === null || _16 === void 0 ? void 0 : _16.typeOf) === null || _17 === void 0 ? void 0 : _17.$nin;
219
225
  if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
220
226
  matchStages.push({
221
227
  $match: {
@@ -226,7 +232,7 @@ class MongoRepository {
226
232
  });
227
233
  }
228
234
  if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
229
- const priceSpecificationPriceGte = (_16 = params.priceSpecification.price) === null || _16 === void 0 ? void 0 : _16.$gte;
235
+ const priceSpecificationPriceGte = (_18 = params.priceSpecification.price) === null || _18 === void 0 ? void 0 : _18.$gte;
230
236
  if (typeof priceSpecificationPriceGte === 'number') {
231
237
  matchStages.push({
232
238
  $match: {
@@ -237,7 +243,7 @@ class MongoRepository {
237
243
  }
238
244
  });
239
245
  }
240
- const priceSpecificationPriceLte = (_17 = params.priceSpecification.price) === null || _17 === void 0 ? void 0 : _17.$lte;
246
+ const priceSpecificationPriceLte = (_19 = params.priceSpecification.price) === null || _19 === void 0 ? void 0 : _19.$lte;
241
247
  if (typeof priceSpecificationPriceLte === 'number') {
242
248
  matchStages.push({
243
249
  $match: {
@@ -248,7 +254,7 @@ class MongoRepository {
248
254
  }
249
255
  });
250
256
  }
251
- const accountsReceivableGte = (_19 = (_18 = params.priceSpecification.accounting) === null || _18 === void 0 ? void 0 : _18.accountsReceivable) === null || _19 === void 0 ? void 0 : _19.$gte;
257
+ const accountsReceivableGte = (_21 = (_20 = params.priceSpecification.accounting) === null || _20 === void 0 ? void 0 : _20.accountsReceivable) === null || _21 === void 0 ? void 0 : _21.$gte;
252
258
  if (typeof accountsReceivableGte === 'number') {
253
259
  matchStages.push({
254
260
  $match: {
@@ -259,7 +265,7 @@ class MongoRepository {
259
265
  }
260
266
  });
261
267
  }
262
- const accountsReceivableLte = (_21 = (_20 = params.priceSpecification.accounting) === null || _20 === void 0 ? void 0 : _20.accountsReceivable) === null || _21 === void 0 ? void 0 : _21.$lte;
268
+ const accountsReceivableLte = (_23 = (_22 = params.priceSpecification.accounting) === null || _22 === void 0 ? void 0 : _22.accountsReceivable) === null || _23 === void 0 ? void 0 : _23.$lte;
263
269
  if (typeof accountsReceivableLte === 'number') {
264
270
  matchStages.push({
265
271
  $match: {
@@ -270,7 +276,7 @@ class MongoRepository {
270
276
  }
271
277
  });
272
278
  }
273
- const accountingCodeValueEq = (_24 = (_23 = (_22 = params.priceSpecification.accounting) === null || _22 === void 0 ? void 0 : _22.operatingRevenue) === null || _23 === void 0 ? void 0 : _23.codeValue) === null || _24 === void 0 ? void 0 : _24.$eq;
279
+ const accountingCodeValueEq = (_26 = (_25 = (_24 = params.priceSpecification.accounting) === null || _24 === void 0 ? void 0 : _24.operatingRevenue) === null || _25 === void 0 ? void 0 : _25.codeValue) === null || _26 === void 0 ? void 0 : _26.$eq;
274
280
  if (typeof accountingCodeValueEq === 'string') {
275
281
  matchStages.push({
276
282
  $match: {
@@ -281,7 +287,7 @@ class MongoRepository {
281
287
  }
282
288
  });
283
289
  }
284
- const accountingCodeValueIn = (_27 = (_26 = (_25 = params.priceSpecification.accounting) === null || _25 === void 0 ? void 0 : _25.operatingRevenue) === null || _26 === void 0 ? void 0 : _26.codeValue) === null || _27 === void 0 ? void 0 : _27.$in;
290
+ const accountingCodeValueIn = (_29 = (_28 = (_27 = params.priceSpecification.accounting) === null || _27 === void 0 ? void 0 : _27.operatingRevenue) === null || _28 === void 0 ? void 0 : _28.codeValue) === null || _29 === void 0 ? void 0 : _29.$in;
285
291
  if (Array.isArray(accountingCodeValueIn)) {
286
292
  matchStages.push({
287
293
  $match: {
@@ -292,7 +298,7 @@ class MongoRepository {
292
298
  }
293
299
  });
294
300
  }
295
- const referenceQuantityValueEq = (_29 = (_28 = params.priceSpecification.referenceQuantity) === null || _28 === void 0 ? void 0 : _28.value) === null || _29 === void 0 ? void 0 : _29.$eq;
301
+ const referenceQuantityValueEq = (_31 = (_30 = params.priceSpecification.referenceQuantity) === null || _30 === void 0 ? void 0 : _30.value) === null || _31 === void 0 ? void 0 : _31.$eq;
296
302
  if (typeof referenceQuantityValueEq === 'number') {
297
303
  matchStages.push({
298
304
  $match: {
@@ -304,7 +310,7 @@ class MongoRepository {
304
310
  });
305
311
  }
306
312
  }
307
- const availabilityEq = (_30 = params.availability) === null || _30 === void 0 ? void 0 : _30.$eq;
313
+ const availabilityEq = (_32 = params.availability) === null || _32 === void 0 ? void 0 : _32.$eq;
308
314
  if (typeof availabilityEq === 'string') {
309
315
  matchStages.push({
310
316
  $match: {
@@ -312,7 +318,7 @@ class MongoRepository {
312
318
  }
313
319
  });
314
320
  }
315
- const availableAtOrFromIdEq = (_32 = (_31 = params.availableAtOrFrom) === null || _31 === void 0 ? void 0 : _31.id) === null || _32 === void 0 ? void 0 : _32.$eq;
321
+ const availableAtOrFromIdEq = (_34 = (_33 = params.availableAtOrFrom) === null || _33 === void 0 ? void 0 : _33.id) === null || _34 === void 0 ? void 0 : _34.$eq;
316
322
  if (typeof availableAtOrFromIdEq === 'string') {
317
323
  matchStages.push({
318
324
  $match: {
@@ -323,7 +329,7 @@ class MongoRepository {
323
329
  }
324
330
  });
325
331
  }
326
- const availableAtOrFromIdIn = (_34 = (_33 = params.availableAtOrFrom) === null || _33 === void 0 ? void 0 : _33.id) === null || _34 === void 0 ? void 0 : _34.$in;
332
+ const availableAtOrFromIdIn = (_36 = (_35 = params.availableAtOrFrom) === null || _35 === void 0 ? void 0 : _35.id) === null || _36 === void 0 ? void 0 : _36.$in;
327
333
  if (Array.isArray(availableAtOrFromIdIn)) {
328
334
  matchStages.push({
329
335
  $match: {
@@ -334,7 +340,7 @@ class MongoRepository {
334
340
  }
335
341
  });
336
342
  }
337
- const addOnItemOfferedIdEq = (_37 = (_36 = (_35 = params.addOn) === null || _35 === void 0 ? void 0 : _35.itemOffered) === null || _36 === void 0 ? void 0 : _36.id) === null || _37 === void 0 ? void 0 : _37.$eq;
343
+ const addOnItemOfferedIdEq = (_39 = (_38 = (_37 = params.addOn) === null || _37 === void 0 ? void 0 : _37.itemOffered) === null || _38 === void 0 ? void 0 : _38.id) === null || _39 === void 0 ? void 0 : _39.$eq;
338
344
  if (typeof addOnItemOfferedIdEq === 'string') {
339
345
  matchStages.push({
340
346
  $match: {
@@ -342,7 +348,7 @@ class MongoRepository {
342
348
  }
343
349
  });
344
350
  }
345
- const addOnItemOfferedIdIn = (_40 = (_39 = (_38 = params.addOn) === null || _38 === void 0 ? void 0 : _38.itemOffered) === null || _39 === void 0 ? void 0 : _39.id) === null || _40 === void 0 ? void 0 : _40.$in;
351
+ const addOnItemOfferedIdIn = (_42 = (_41 = (_40 = params.addOn) === null || _40 === void 0 ? void 0 : _40.itemOffered) === null || _41 === void 0 ? void 0 : _41.id) === null || _42 === void 0 ? void 0 : _42.$in;
346
352
  if (Array.isArray(addOnItemOfferedIdIn)) {
347
353
  matchStages.push({
348
354
  $match: {
@@ -350,7 +356,7 @@ class MongoRepository {
350
356
  }
351
357
  });
352
358
  }
353
- const hasMerchantReturnPolicyIdEq = (_42 = (_41 = params.hasMerchantReturnPolicy) === null || _41 === void 0 ? void 0 : _41.id) === null || _42 === void 0 ? void 0 : _42.$eq;
359
+ const hasMerchantReturnPolicyIdEq = (_44 = (_43 = params.hasMerchantReturnPolicy) === null || _43 === void 0 ? void 0 : _43.id) === null || _44 === void 0 ? void 0 : _44.$eq;
354
360
  if (typeof hasMerchantReturnPolicyIdEq === 'string') {
355
361
  matchStages.push({
356
362
  $match: {
@@ -361,7 +367,7 @@ class MongoRepository {
361
367
  }
362
368
  });
363
369
  }
364
- const acceptedPaymentMethodIdentifierIn = (_44 = (_43 = params.acceptedPaymentMethod) === null || _43 === void 0 ? void 0 : _43.identifier) === null || _44 === void 0 ? void 0 : _44.$in;
370
+ const acceptedPaymentMethodIdentifierIn = (_46 = (_45 = params.acceptedPaymentMethod) === null || _45 === void 0 ? void 0 : _45.identifier) === null || _46 === void 0 ? void 0 : _46.$in;
365
371
  if (Array.isArray(acceptedPaymentMethodIdentifierIn)) {
366
372
  matchStages.push({
367
373
  $match: {
@@ -372,7 +378,7 @@ class MongoRepository {
372
378
  }
373
379
  });
374
380
  }
375
- const additionalPropertyAll = (_45 = params.additionalProperty) === null || _45 === void 0 ? void 0 : _45.$all;
381
+ const additionalPropertyAll = (_47 = params.additionalProperty) === null || _47 === void 0 ? void 0 : _47.$all;
376
382
  if (Array.isArray(additionalPropertyAll)) {
377
383
  matchStages.push({
378
384
  $match: {
@@ -383,7 +389,7 @@ class MongoRepository {
383
389
  }
384
390
  });
385
391
  }
386
- const additionalPropertyElemMatch = (_46 = params.additionalProperty) === null || _46 === void 0 ? void 0 : _46.$elemMatch;
392
+ const additionalPropertyElemMatch = (_48 = params.additionalProperty) === null || _48 === void 0 ? void 0 : _48.$elemMatch;
387
393
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
388
394
  matchStages.push({
389
395
  $match: {