@chevre/domain 21.35.0-alpha.10 → 21.35.0-alpha.12

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.
@@ -35,7 +35,7 @@ class MongoRepository {
35
35
  }
36
36
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
37
37
  static CREATE_MONGO_CONDITIONS(params) {
38
- 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, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75;
38
+ 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, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68;
39
39
  const andConditions = [];
40
40
  const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
41
41
  if (Array.isArray(idIn)) {
@@ -250,16 +250,18 @@ class MongoRepository {
250
250
  }
251
251
  });
252
252
  }
253
- const objectAcceptedOfferSeatNumberIn = (_43 = (_42 = (_41 = (_40 = (_39 = (_38 = (_37 = params.object) === null || _37 === void 0 ? void 0 : _37.acceptedOffer) === null || _38 === void 0 ? void 0 : _38.itemOffered) === null || _39 === void 0 ? void 0 : _39.serviceOutput) === null || _40 === void 0 ? void 0 : _40.reservedTicket) === null || _41 === void 0 ? void 0 : _41.ticketedSeat) === null || _42 === void 0 ? void 0 : _42.seatNumber) === null || _43 === void 0 ? void 0 : _43.$in;
254
- if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
255
- andConditions.push({
256
- 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
257
- $exists: true,
258
- $in: objectAcceptedOfferSeatNumberIn
259
- }
260
- });
261
- }
262
- const objectTransactionNumberEq = (_45 = (_44 = params.object) === null || _44 === void 0 ? void 0 : _44.transactionNumber) === null || _45 === void 0 ? void 0 : _45.$eq;
253
+ // discontinue(2024-06-18~)
254
+ // const objectAcceptedOfferSeatNumberIn =
255
+ // params.object?.acceptedOffer?.itemOffered?.serviceOutput?.reservedTicket?.ticketedSeat?.seatNumber?.$in;
256
+ // if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
257
+ // andConditions.push({
258
+ // 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
259
+ // $exists: true,
260
+ // $in: objectAcceptedOfferSeatNumberIn
261
+ // }
262
+ // });
263
+ // }
264
+ const objectTransactionNumberEq = (_38 = (_37 = params.object) === null || _37 === void 0 ? void 0 : _37.transactionNumber) === null || _38 === void 0 ? void 0 : _38.$eq;
263
265
  if (typeof objectTransactionNumberEq === 'string') {
264
266
  andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
265
267
  }
@@ -269,14 +271,14 @@ class MongoRepository {
269
271
  });
270
272
  }
271
273
  else {
272
- const typeOfEq = (_46 = params.typeOf) === null || _46 === void 0 ? void 0 : _46.$eq;
274
+ const typeOfEq = (_39 = params.typeOf) === null || _39 === void 0 ? void 0 : _39.$eq;
273
275
  if (typeof typeOfEq === 'string') {
274
276
  andConditions.push({
275
277
  typeOf: { $eq: typeOfEq }
276
278
  });
277
279
  }
278
280
  }
279
- const actionStatusIn = (_47 = params.actionStatus) === null || _47 === void 0 ? void 0 : _47.$in;
281
+ const actionStatusIn = (_40 = params.actionStatus) === null || _40 === void 0 ? void 0 : _40.$in;
280
282
  if (Array.isArray(actionStatusIn)) {
281
283
  andConditions.push({
282
284
  actionStatus: { $in: actionStatusIn }
@@ -299,7 +301,7 @@ class MongoRepository {
299
301
  startDate: { $lte: startDateLte }
300
302
  });
301
303
  }
302
- const fromLocationTypeOfIn = (_49 = (_48 = params.fromLocation) === null || _48 === void 0 ? void 0 : _48.typeOf) === null || _49 === void 0 ? void 0 : _49.$in;
304
+ const fromLocationTypeOfIn = (_42 = (_41 = params.fromLocation) === null || _41 === void 0 ? void 0 : _41.typeOf) === null || _42 === void 0 ? void 0 : _42.$in;
303
305
  if (Array.isArray(fromLocationTypeOfIn)) {
304
306
  andConditions.push({
305
307
  'fromLocation.typeOf': {
@@ -308,7 +310,7 @@ class MongoRepository {
308
310
  }
309
311
  });
310
312
  }
311
- const fromLocationAccountNumberIn = (_51 = (_50 = params.fromLocation) === null || _50 === void 0 ? void 0 : _50.accountNumber) === null || _51 === void 0 ? void 0 : _51.$in;
313
+ const fromLocationAccountNumberIn = (_44 = (_43 = params.fromLocation) === null || _43 === void 0 ? void 0 : _43.accountNumber) === null || _44 === void 0 ? void 0 : _44.$in;
312
314
  if (Array.isArray(fromLocationAccountNumberIn)) {
313
315
  andConditions.push({
314
316
  'fromLocation.accountNumber': {
@@ -317,7 +319,7 @@ class MongoRepository {
317
319
  }
318
320
  });
319
321
  }
320
- const fromLocationAccountTypeIn = (_53 = (_52 = params.fromLocation) === null || _52 === void 0 ? void 0 : _52.accountType) === null || _53 === void 0 ? void 0 : _53.$in;
322
+ const fromLocationAccountTypeIn = (_46 = (_45 = params.fromLocation) === null || _45 === void 0 ? void 0 : _45.accountType) === null || _46 === void 0 ? void 0 : _46.$in;
321
323
  if (Array.isArray(fromLocationAccountTypeIn)) {
322
324
  andConditions.push({
323
325
  'fromLocation.accountType': {
@@ -326,7 +328,7 @@ class MongoRepository {
326
328
  }
327
329
  });
328
330
  }
329
- const toLocationTypeOfIn = (_55 = (_54 = params.toLocation) === null || _54 === void 0 ? void 0 : _54.typeOf) === null || _55 === void 0 ? void 0 : _55.$in;
331
+ const toLocationTypeOfIn = (_48 = (_47 = params.toLocation) === null || _47 === void 0 ? void 0 : _47.typeOf) === null || _48 === void 0 ? void 0 : _48.$in;
330
332
  if (Array.isArray(toLocationTypeOfIn)) {
331
333
  andConditions.push({
332
334
  'toLocation.typeOf': {
@@ -335,7 +337,7 @@ class MongoRepository {
335
337
  }
336
338
  });
337
339
  }
338
- const toLocationAccountNumberIn = (_57 = (_56 = params.toLocation) === null || _56 === void 0 ? void 0 : _56.accountNumber) === null || _57 === void 0 ? void 0 : _57.$in;
340
+ const toLocationAccountNumberIn = (_50 = (_49 = params.toLocation) === null || _49 === void 0 ? void 0 : _49.accountNumber) === null || _50 === void 0 ? void 0 : _50.$in;
339
341
  if (Array.isArray(toLocationAccountNumberIn)) {
340
342
  andConditions.push({
341
343
  'toLocation.accountNumber': {
@@ -344,7 +346,7 @@ class MongoRepository {
344
346
  }
345
347
  });
346
348
  }
347
- const toLocationAccountTypeIn = (_59 = (_58 = params.toLocation) === null || _58 === void 0 ? void 0 : _58.accountType) === null || _59 === void 0 ? void 0 : _59.$in;
349
+ const toLocationAccountTypeIn = (_52 = (_51 = params.toLocation) === null || _51 === void 0 ? void 0 : _51.accountType) === null || _52 === void 0 ? void 0 : _52.$in;
348
350
  if (Array.isArray(toLocationAccountTypeIn)) {
349
351
  andConditions.push({
350
352
  'toLocation.accountType': {
@@ -353,7 +355,7 @@ class MongoRepository {
353
355
  }
354
356
  });
355
357
  }
356
- const purposeTypeOfIn = (_61 = (_60 = params.purpose) === null || _60 === void 0 ? void 0 : _60.typeOf) === null || _61 === void 0 ? void 0 : _61.$in;
358
+ const purposeTypeOfIn = (_54 = (_53 = params.purpose) === null || _53 === void 0 ? void 0 : _53.typeOf) === null || _54 === void 0 ? void 0 : _54.$in;
357
359
  if (Array.isArray(purposeTypeOfIn)) {
358
360
  andConditions.push({
359
361
  'purpose.typeOf': {
@@ -362,7 +364,7 @@ class MongoRepository {
362
364
  }
363
365
  });
364
366
  }
365
- const purposeIdIn = (_63 = (_62 = params.purpose) === null || _62 === void 0 ? void 0 : _62.id) === null || _63 === void 0 ? void 0 : _63.$in;
367
+ const purposeIdIn = (_56 = (_55 = params.purpose) === null || _55 === void 0 ? void 0 : _55.id) === null || _56 === void 0 ? void 0 : _56.$in;
366
368
  if (Array.isArray(purposeIdIn)) {
367
369
  andConditions.push({
368
370
  'purpose.id': {
@@ -371,7 +373,7 @@ class MongoRepository {
371
373
  }
372
374
  });
373
375
  }
374
- const purposeOrderNumberIn = (_65 = (_64 = params.purpose) === null || _64 === void 0 ? void 0 : _64.orderNumber) === null || _65 === void 0 ? void 0 : _65.$in;
376
+ const purposeOrderNumberIn = (_58 = (_57 = params.purpose) === null || _57 === void 0 ? void 0 : _57.orderNumber) === null || _58 === void 0 ? void 0 : _58.$in;
375
377
  if (Array.isArray(purposeOrderNumberIn)) {
376
378
  andConditions.push({
377
379
  'purpose.orderNumber': {
@@ -380,7 +382,7 @@ class MongoRepository {
380
382
  }
381
383
  });
382
384
  }
383
- const resultTypeOfIn = (_67 = (_66 = params.result) === null || _66 === void 0 ? void 0 : _66.typeOf) === null || _67 === void 0 ? void 0 : _67.$in;
385
+ const resultTypeOfIn = (_60 = (_59 = params.result) === null || _59 === void 0 ? void 0 : _59.typeOf) === null || _60 === void 0 ? void 0 : _60.$in;
384
386
  if (Array.isArray(resultTypeOfIn)) {
385
387
  andConditions.push({
386
388
  'result.typeOf': {
@@ -389,7 +391,7 @@ class MongoRepository {
389
391
  }
390
392
  });
391
393
  }
392
- const resultIdIn = (_69 = (_68 = params.result) === null || _68 === void 0 ? void 0 : _68.id) === null || _69 === void 0 ? void 0 : _69.$in;
394
+ const resultIdIn = (_62 = (_61 = params.result) === null || _61 === void 0 ? void 0 : _61.id) === null || _62 === void 0 ? void 0 : _62.$in;
393
395
  if (Array.isArray(resultIdIn)) {
394
396
  andConditions.push({
395
397
  'result.id': {
@@ -398,7 +400,7 @@ class MongoRepository {
398
400
  }
399
401
  });
400
402
  }
401
- const resultOrderNumberIn = (_71 = (_70 = params.result) === null || _70 === void 0 ? void 0 : _70.orderNumber) === null || _71 === void 0 ? void 0 : _71.$in;
403
+ const resultOrderNumberIn = (_64 = (_63 = params.result) === null || _63 === void 0 ? void 0 : _63.orderNumber) === null || _64 === void 0 ? void 0 : _64.$in;
402
404
  if (Array.isArray(resultOrderNumberIn)) {
403
405
  andConditions.push({
404
406
  'result.orderNumber': {
@@ -407,7 +409,7 @@ class MongoRepository {
407
409
  }
408
410
  });
409
411
  }
410
- const resultCodeIn = (_73 = (_72 = params.result) === null || _72 === void 0 ? void 0 : _72.code) === null || _73 === void 0 ? void 0 : _73.$in;
412
+ const resultCodeIn = (_66 = (_65 = params.result) === null || _65 === void 0 ? void 0 : _65.code) === null || _66 === void 0 ? void 0 : _66.$in;
411
413
  if (Array.isArray(resultCodeIn)) {
412
414
  andConditions.push({
413
415
  'result.code': {
@@ -417,7 +419,7 @@ class MongoRepository {
417
419
  });
418
420
  }
419
421
  // sameAs(2024-04-23~)
420
- const sameAsIdEq = (_75 = (_74 = params.sameAs) === null || _74 === void 0 ? void 0 : _74.id) === null || _75 === void 0 ? void 0 : _75.$eq;
422
+ const sameAsIdEq = (_68 = (_67 = params.sameAs) === null || _67 === void 0 ? void 0 : _67.id) === null || _68 === void 0 ? void 0 : _68.$eq;
421
423
  if (typeof sameAsIdEq === 'string') {
422
424
  andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
423
425
  }
@@ -75,13 +75,25 @@ function createPlacingOrderFromExistingTransaction(params) {
75
75
  }
76
76
  }
77
77
  // orderedItem生成のためにacceptedOffersを取得
78
- let acceptedOffers;
78
+ let acceptedOffers = [];
79
79
  const serialNumbers = authorizeOfferActionsWithInstrument
80
80
  .filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
81
81
  .map(({ instrument }) => String(instrument.transactionNumber));
82
- // すでにtypeOf: Orderに変更済の場合acceptedOffersは空になるが、そもそもorderedItemはその後上書きされないので、空のまま処理して問題なし
83
- acceptedOffers = (yield repos.orderInTransaction.findAcceptedOffersByOrderNumber({ orderNumber: { $eq: orderNumber } }))
84
- .filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
82
+ try {
83
+ // すでにtypeOf: Orderに変更済の場合acceptedOffersは空になるが、そもそもorderedItemはその後上書きされないので、空のまま処理して問題なし
84
+ acceptedOffers = (yield repos.orderInTransaction.findAcceptedOffersByOrderNumber({ orderNumber: { $eq: orderNumber } }))
85
+ .filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
86
+ }
87
+ catch (error) {
88
+ let throwsError = true;
89
+ // すでにtypeOf: Orderに変更済の場合、NotFoundとなる
90
+ if (error instanceof factory.errors.NotFound) {
91
+ throwsError = false;
92
+ }
93
+ if (throwsError) {
94
+ throw error;
95
+ }
96
+ }
85
97
  order = (0, factory_1.createPlacingOrder)({ transaction: placeOrderTransactionWithResult, authorizePaymentActions, acceptedOffers });
86
98
  return { order, placeOrderTransaction: placeOrderTransactionWithResult, serialNumbers };
87
99
  });
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.375.0-alpha.7",
13
+ "@chevre/factory": "4.375.0-alpha.8",
14
14
  "@cinerino/sdk": "7.3.0-alpha.0",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.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.35.0-alpha.10"
113
+ "version": "21.35.0-alpha.12"
114
114
  }