@chevre/domain 22.5.0-alpha.8 → 22.5.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 (160) hide show
  1. package/example/src/chevre/activateOptionalAggregationSettings.ts +19 -0
  2. package/example/src/chevre/aggregateAllEvents2.ts +7 -5
  3. package/example/src/chevre/aggregateEventPublicFields.ts +47 -0
  4. package/example/src/chevre/aggregateEventSellerMakesOffer.ts +32 -0
  5. package/example/src/chevre/findReservationByCode.ts +11 -10
  6. package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +101 -0
  7. package/example/src/chevre/migrateProjectMakesOfferAvailableAt.ts +85 -0
  8. package/example/src/chevre/person/cleanUpCognitoUsers.ts +90 -0
  9. package/example/src/chevre/searchCategoryCodesByAggregate.ts +1 -2
  10. package/example/src/chevre/searchOfferCatalogItems.ts +3 -2
  11. package/example/src/chevre/searchProjects.ts +2 -4
  12. package/example/src/chevre/searchSellersByAggregate.ts +4 -6
  13. package/example/src/chevre/unsetUnnecessaryFields.ts +17 -19
  14. package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +25 -14
  15. package/example/src/chevre/upsertProductsByProductId.ts +1 -1
  16. package/example/src/createMongooseConnection.ts +26 -0
  17. package/lib/chevre/repo/action.d.ts +41 -41
  18. package/lib/chevre/repo/action.js +5 -39
  19. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  20. package/lib/chevre/repo/categoryCode.d.ts +4 -8
  21. package/lib/chevre/repo/categoryCode.js +8 -36
  22. package/lib/chevre/repo/creativeWork.js +1 -20
  23. package/lib/chevre/repo/customer.d.ts +1 -1
  24. package/lib/chevre/repo/customer.js +4 -4
  25. package/lib/chevre/repo/event.d.ts +21 -12
  26. package/lib/chevre/repo/event.js +135 -37
  27. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +54 -0
  28. package/lib/chevre/repo/eventSellerMakesOffer.js +73 -0
  29. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -3
  30. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +0 -3
  31. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +0 -3
  32. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +0 -3
  33. package/lib/chevre/repo/mongoose/schemas/customer.js +0 -3
  34. package/lib/chevre/repo/mongoose/schemas/event.js +9 -54
  35. package/lib/chevre/repo/mongoose/schemas/member.js +0 -3
  36. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -3
  37. package/lib/chevre/repo/mongoose/schemas/paymentService.js +0 -3
  38. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +0 -3
  39. package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -3
  40. package/lib/chevre/repo/mongoose/schemas/project.js +0 -3
  41. package/lib/chevre/repo/mongoose/schemas/reservation.js +0 -3
  42. package/lib/chevre/repo/mongoose/schemas/seller.js +0 -3
  43. package/lib/chevre/repo/mongoose/schemas/trip.js +0 -3
  44. package/lib/chevre/repo/paymentService.d.ts +1 -1
  45. package/lib/chevre/repo/paymentService.js +0 -19
  46. package/lib/chevre/repo/place/movieTheater.js +1 -25
  47. package/lib/chevre/repo/product.js +1 -6
  48. package/lib/chevre/repo/project.d.ts +8 -2
  49. package/lib/chevre/repo/project.js +25 -26
  50. package/lib/chevre/repo/projectMakesOffer.d.ts +3 -1
  51. package/lib/chevre/repo/projectMakesOffer.js +5 -2
  52. package/lib/chevre/repo/role.js +0 -7
  53. package/lib/chevre/repo/seller.d.ts +18 -16
  54. package/lib/chevre/repo/seller.js +13 -31
  55. package/lib/chevre/repo/task.d.ts +12 -12
  56. package/lib/chevre/repo/transaction.d.ts +1 -1
  57. package/lib/chevre/repository.d.ts +5 -0
  58. package/lib/chevre/repository.js +15 -2
  59. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +4 -18
  60. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +28 -13
  61. package/lib/chevre/service/aggregation/project.js +1 -2
  62. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -4
  63. package/lib/chevre/service/assetTransaction/registerService.js +1 -2
  64. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -1
  65. package/lib/chevre/service/assetTransaction/reserve/start.js +11 -38
  66. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +4 -1
  67. package/lib/chevre/service/event.js +2 -2
  68. package/lib/chevre/service/moneyTransfer.js +1 -2
  69. package/lib/chevre/service/notification.d.ts +2 -4
  70. package/lib/chevre/service/notification.js +30 -9
  71. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -1
  72. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
  73. package/lib/chevre/service/offer/event/authorize.d.ts +2 -1
  74. package/lib/chevre/service/offer/event/authorize.js +2 -2
  75. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  76. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -85
  77. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +21 -257
  78. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.d.ts +38 -0
  79. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +97 -0
  80. package/lib/chevre/service/offer/event/searchOfferCatalogItemAvailability.d.ts +48 -0
  81. package/lib/chevre/service/offer/event/searchOfferCatalogItemAvailability.js +109 -0
  82. package/lib/chevre/service/offer/event/searchOfferCatalogItems.d.ts +38 -0
  83. package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +95 -0
  84. package/lib/chevre/service/offer/event/searchOffersByIds.js +26 -20
  85. package/lib/chevre/service/offer/event.d.ts +4 -1
  86. package/lib/chevre/service/offer/event.js +6 -3
  87. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
  88. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +1 -1
  89. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +4 -4
  90. package/lib/chevre/service/offer/onEventChanged.d.ts +1 -13
  91. package/lib/chevre/service/offer/onEventChanged.js +64 -71
  92. package/lib/chevre/service/offer.d.ts +6 -0
  93. package/lib/chevre/service/offer.js +12 -15
  94. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  95. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +7 -8
  96. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  97. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +7 -8
  98. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +8 -11
  99. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  100. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +7 -8
  101. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +1 -4
  102. package/lib/chevre/service/order/onOrderUpdated/factory.js +4 -7
  103. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
  104. package/lib/chevre/service/order/placeOrder.js +1 -1
  105. package/lib/chevre/service/payment/any/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
  106. package/lib/chevre/service/payment/any.js +1 -1
  107. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  108. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +0 -3
  109. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
  110. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
  111. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  112. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +50 -57
  113. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  114. package/lib/chevre/service/payment/paymentCard.js +0 -5
  115. package/lib/chevre/service/payment.d.ts +1 -1
  116. package/lib/chevre/service/report/telemetry.js +1 -1
  117. package/lib/chevre/service/reserve/cancelReservation.d.ts +1 -1
  118. package/lib/chevre/service/reserve/cancelReservation.js +14 -6
  119. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  120. package/lib/chevre/service/reserve/factory.d.ts +2 -61
  121. package/lib/chevre/service/reserve/factory.js +0 -11
  122. package/lib/chevre/service/reserve/findByCode.js +0 -1
  123. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +19 -0
  124. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +64 -0
  125. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -4
  126. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +37 -61
  127. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +22 -76
  128. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +26 -28
  129. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +0 -3
  130. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +17 -50
  131. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +18 -0
  132. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +66 -0
  133. package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
  134. package/lib/chevre/service/reserve/useReservation.js +4 -4
  135. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -7
  136. package/lib/chevre/service/reserve/verifyToken4reservation.js +17 -12
  137. package/lib/chevre/service/task/aggregateScreeningEvent.js +4 -2
  138. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +1 -1
  139. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +1 -5
  140. package/lib/chevre/service/task/deletePerson.d.ts +6 -0
  141. package/lib/chevre/service/task/deletePerson.js +420 -0
  142. package/lib/chevre/service/task/handleNotification.d.ts +3 -0
  143. package/lib/chevre/service/task/handleNotification.js +26 -0
  144. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  145. package/lib/chevre/service/task/onResourceUpdated.js +1 -1
  146. package/lib/chevre/service/task/triggerWebhook.js +2 -2
  147. package/lib/chevre/service/task.d.ts +3 -0
  148. package/lib/chevre/service/task.js +2 -0
  149. package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
  150. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +1 -3
  151. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +4 -2
  152. package/lib/chevre/service/transaction/returnOrder/preStart.js +4 -3
  153. package/lib/chevre/settings/aggregation.d.ts +23 -0
  154. package/lib/chevre/settings/aggregation.js +17 -0
  155. package/lib/chevre/settings.d.ts +52 -38
  156. package/lib/chevre/settings.js +12 -13
  157. package/package.json +5 -7
  158. package/example/src/chevre/migratePayTransactionRecipes.ts +0 -252
  159. package/example/src/chevre/migrateProductHasOfferCatalog.ts +0 -80
  160. package/example/src/chevre/migrateProjectMakesOffer.ts +0 -78
@@ -64,7 +64,7 @@ async function main() {
64
64
  ja: 'xxx'
65
65
  },
66
66
  hasOfferCatalog: {
67
- id: 'blpc770py',
67
+ // id: 'blpc770py',
68
68
  typeOf: 'OfferCatalog',
69
69
  itemListElement: [{ id: 'blpc770py' }]
70
70
  },
@@ -0,0 +1,26 @@
1
+ // tslint:disable:no-console no-magic-numbers
2
+ import * as mongoose from 'mongoose';
3
+
4
+ setInterval(
5
+ () => {
6
+ console.log('default connection:', mongoose.connection.id, mongoose.connection.readyState);
7
+ },
8
+ 500
9
+ );
10
+
11
+ setInterval(
12
+ () => {
13
+ // mongoose.createConnection(<string>process.env.MONGOLAB_URI, { autoIndex: false })
14
+ // .asPromise()
15
+ // .then((connection) => {
16
+ // console.log('connection created,', connection.id, connection.readyState);
17
+ // })
18
+ // .catch(console.error);
19
+ mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false })
20
+ .then(({ connection }) => {
21
+ console.log('default connection created,', connection.id, connection.readyState);
22
+ })
23
+ .catch(console.error);
24
+ },
25
+ 500
26
+ );
@@ -84,7 +84,7 @@ export declare class ActionRepo {
84
84
  /**
85
85
  * アクション検索
86
86
  */
87
- search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
87
+ search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
88
88
  /**
89
89
  * アクション開始
90
90
  */
@@ -376,96 +376,96 @@ export declare class ActionRepo {
376
376
  object: any;
377
377
  error?: any;
378
378
  project: Pick<factory.project.IProject, "id" | "typeOf">;
379
+ agent: import("@chevre/factory/lib/action").IParticipant;
380
+ purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
379
381
  typeOf: factory.actionType;
380
- amount?: any;
382
+ potentialActions?: any;
383
+ instrument?: any;
384
+ recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
381
385
  location?: any;
382
- description?: string | undefined;
383
386
  result?: any;
384
- toLocation?: any;
385
- actionStatus: factory.actionStatusType;
386
387
  endDate?: Date | undefined;
387
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
388
- startDate: Date;
389
- agent: import("@chevre/factory/lib/action").IParticipant;
390
- instrument?: any;
391
- potentialActions?: any;
392
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
393
388
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
389
+ startDate: Date;
390
+ description?: string | undefined;
391
+ amount?: any;
394
392
  fromLocation?: any;
393
+ toLocation?: any;
395
394
  replacer?: any;
396
395
  targetCollection?: any;
397
396
  cancelAction?: any;
397
+ actionStatus: factory.actionStatusType;
398
398
  }> & {
399
399
  object: any;
400
400
  error?: any;
401
401
  project: Pick<factory.project.IProject, "id" | "typeOf">;
402
+ agent: import("@chevre/factory/lib/action").IParticipant;
403
+ purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
402
404
  typeOf: factory.actionType;
403
- amount?: any;
405
+ potentialActions?: any;
406
+ instrument?: any;
407
+ recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
404
408
  location?: any;
405
- description?: string | undefined;
406
409
  result?: any;
407
- toLocation?: any;
408
- actionStatus: factory.actionStatusType;
409
410
  endDate?: Date | undefined;
410
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
411
- startDate: Date;
412
- agent: import("@chevre/factory/lib/action").IParticipant;
413
- instrument?: any;
414
- potentialActions?: any;
415
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
416
411
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
412
+ startDate: Date;
413
+ description?: string | undefined;
414
+ amount?: any;
417
415
  fromLocation?: any;
416
+ toLocation?: any;
418
417
  replacer?: any;
419
418
  targetCollection?: any;
420
419
  cancelAction?: any;
420
+ actionStatus: factory.actionStatusType;
421
421
  } & {
422
422
  _id: import("mongoose").Types.ObjectId;
423
423
  }, QueryOptions<import("mongoose").Document<unknown, {}, {
424
424
  object: any;
425
425
  error?: any;
426
426
  project: Pick<factory.project.IProject, "id" | "typeOf">;
427
+ agent: import("@chevre/factory/lib/action").IParticipant;
428
+ purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
427
429
  typeOf: factory.actionType;
428
- amount?: any;
430
+ potentialActions?: any;
431
+ instrument?: any;
432
+ recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
429
433
  location?: any;
430
- description?: string | undefined;
431
434
  result?: any;
432
- toLocation?: any;
433
- actionStatus: factory.actionStatusType;
434
435
  endDate?: Date | undefined;
435
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
436
- startDate: Date;
437
- agent: import("@chevre/factory/lib/action").IParticipant;
438
- instrument?: any;
439
- potentialActions?: any;
440
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
441
436
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
437
+ startDate: Date;
438
+ description?: string | undefined;
439
+ amount?: any;
442
440
  fromLocation?: any;
441
+ toLocation?: any;
443
442
  replacer?: any;
444
443
  targetCollection?: any;
445
444
  cancelAction?: any;
445
+ actionStatus: factory.actionStatusType;
446
446
  }> & {
447
447
  object: any;
448
448
  error?: any;
449
449
  project: Pick<factory.project.IProject, "id" | "typeOf">;
450
+ agent: import("@chevre/factory/lib/action").IParticipant;
451
+ purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
450
452
  typeOf: factory.actionType;
451
- amount?: any;
453
+ potentialActions?: any;
454
+ instrument?: any;
455
+ recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
452
456
  location?: any;
453
- description?: string | undefined;
454
457
  result?: any;
455
- toLocation?: any;
456
- actionStatus: factory.actionStatusType;
457
458
  endDate?: Date | undefined;
458
- purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
459
- startDate: Date;
460
- agent: import("@chevre/factory/lib/action").IParticipant;
461
- instrument?: any;
462
- potentialActions?: any;
463
- recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
464
459
  sameAs?: import("@chevre/factory/lib/action").ISameAs | undefined;
460
+ startDate: Date;
461
+ description?: string | undefined;
462
+ amount?: any;
465
463
  fromLocation?: any;
464
+ toLocation?: any;
466
465
  replacer?: any;
467
466
  targetCollection?: any;
468
467
  cancelAction?: any;
468
+ actionStatus: factory.actionStatusType;
469
469
  } & {
470
470
  _id: import("mongoose").Types.ObjectId;
471
471
  }>>;
@@ -452,7 +452,7 @@ class ActionRepo {
452
452
  /**
453
453
  * アクション検索
454
454
  */
455
- search(params, inclusion, exclusion) {
455
+ search(params, inclusion) {
456
456
  var _a;
457
457
  return __awaiter(this, void 0, void 0, function* () {
458
458
  const conditions = ActionRepo.CREATE_MONGO_CONDITIONS(params);
@@ -461,28 +461,11 @@ class ActionRepo {
461
461
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
462
462
  }
463
463
  else {
464
- if (Array.isArray(exclusion) && exclusion.length > 0) {
465
- positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
466
- }
464
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
465
+ // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
466
+ // }
467
467
  }
468
468
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
469
- // let projection: { [key: string]: number } = {};
470
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
471
- // inclusion.forEach((field) => {
472
- // projection[field] = 1;
473
- // });
474
- // } else {
475
- // projection = {
476
- // __v: 0,
477
- // createdAt: 0,
478
- // updatedAt: 0
479
- // };
480
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
481
- // exclusion.forEach((field) => {
482
- // projection[field] = 0;
483
- // });
484
- // }
485
- // }
486
469
  const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
487
470
  if (typeof params.limit === 'number' && params.limit > 0) {
488
471
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
@@ -664,23 +647,6 @@ class ActionRepo {
664
647
  }
665
648
  }
666
649
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
667
- // let projection: { [key: string]: number } = {};
668
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
669
- // inclusion.forEach((field) => {
670
- // projection[field] = 1;
671
- // });
672
- // } else {
673
- // projection = {
674
- // __v: 0,
675
- // createdAt: 0,
676
- // updatedAt: 0
677
- // };
678
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
679
- // exclusion.forEach((field) => {
680
- // projection[field] = 0;
681
- // });
682
- // }
683
- // }
684
650
  const doc = yield this.actionModel.findOne({
685
651
  typeOf: { $eq: params.typeOf },
686
652
  _id: { $eq: params.id }
@@ -705,7 +671,7 @@ class ActionRepo {
705
671
  project: { id: { $eq: params.project.id } },
706
672
  typeOf: { $eq: factory.actionType.PayAction },
707
673
  object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
708
- }, [], []);
674
+ }, []);
709
675
  return payActions.shift();
710
676
  });
711
677
  }
@@ -126,7 +126,7 @@ export declare class AssetTransactionRepo {
126
126
  status: {
127
127
  $in: factory.transactionStatusType[];
128
128
  };
129
- }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction, "id" | "typeOf" | "status">[]>;
129
+ }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction, "id" | "status" | "typeOf">[]>;
130
130
  /**
131
131
  * set task status exported by transaction id
132
132
  * IDでタスクをエクスポート済に変更する
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { AnyExpression, Connection, FilterQuery } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- type IKeyOfProjection = keyof factory.categoryCode.ICategoryCode | '_id';
27
+ type IKeyOfProjection = keyof factory.categoryCode.ICategoryCode;
28
28
  type IUnset = {
29
29
  [key in keyof Pick<factory.categoryCode.ICategoryCode, 'additionalProperty' | 'color' | 'image' | 'paymentMethod'>]?: 1;
30
30
  };
@@ -35,13 +35,13 @@ export declare class CategoryCodeRepo {
35
35
  private readonly categoryCodeModel;
36
36
  constructor(connection: Connection);
37
37
  static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): FilterQuery<factory.categoryCode.ICategoryCode>[];
38
- static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): {
38
+ static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[]): {
39
39
  [field: string]: AnyExpression;
40
40
  };
41
41
  /**
42
42
  * 集計検索(publicな属性検索が目的)
43
43
  */
44
- searchByAggregate(conditions: factory.categoryCode.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.categoryCode.ICategoryCode[]>;
44
+ searchByAggregate(conditions: factory.categoryCode.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.categoryCode.ICategoryCode[]>;
45
45
  /**
46
46
  * 検索
47
47
  */
@@ -49,11 +49,7 @@ export declare class CategoryCodeRepo {
49
49
  /**
50
50
  * 空の場合無効
51
51
  */
52
- inclusion: IKeyOfProjection[],
53
- /**
54
- * 空の場合無効
55
- */
56
- exclusion: IKeyOfProjection[]): Promise<(factory.categoryCode.ICategoryCode & {
52
+ inclusion: IKeyOfProjection[]): Promise<(factory.categoryCode.ICategoryCode & {
57
53
  id: string;
58
54
  })[]>;
59
55
  save(params: {
@@ -144,7 +144,7 @@ class CategoryCodeRepo {
144
144
  }
145
145
  return andConditions;
146
146
  }
147
- static CREATE_AGGREGATE_PROJECTION(inclusion, exclusion) {
147
+ static CREATE_AGGREGATE_PROJECTION(inclusion) {
148
148
  let projectStage = {
149
149
  _id: 0,
150
150
  id: { $toString: '$_id' },
@@ -162,7 +162,7 @@ class CategoryCodeRepo {
162
162
  projectStage = { _id: 0 };
163
163
  inclusion.forEach((field) => {
164
164
  switch (field) {
165
- case '_id':
165
+ // case '_id':
166
166
  case 'id':
167
167
  projectStage.id = { $toString: '$_id' };
168
168
  break;
@@ -171,25 +171,17 @@ class CategoryCodeRepo {
171
171
  }
172
172
  });
173
173
  }
174
- else if (exclusion.length > 0) {
175
- exclusion.forEach((field) => {
176
- if (typeof projectStage[field] === 'string' || typeof projectStage[field] === 'object') {
177
- // tslint:disable-next-line:no-dynamic-delete
178
- delete projectStage[field];
179
- }
180
- });
181
- }
182
174
  return projectStage;
183
175
  }
184
176
  /**
185
177
  * 集計検索(publicな属性検索が目的)
186
178
  */
187
- searchByAggregate(conditions, inclusion, exclusion) {
179
+ searchByAggregate(conditions, inclusion) {
188
180
  var _a;
189
181
  return __awaiter(this, void 0, void 0, function* () {
190
182
  const matchStages = CategoryCodeRepo.CREATE_MONGO_CONDITIONS(conditions)
191
183
  .map((c) => ({ $match: c }));
192
- const projectStage = CategoryCodeRepo.CREATE_AGGREGATE_PROJECTION(inclusion, exclusion);
184
+ const projectStage = CategoryCodeRepo.CREATE_AGGREGATE_PROJECTION(inclusion);
193
185
  const sortByCodeValue = (_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.codeValue;
194
186
  const aggregate = this.categoryCodeModel.aggregate([
195
187
  ...matchStages,
@@ -215,11 +207,7 @@ class CategoryCodeRepo {
215
207
  /**
216
208
  * 空の場合無効
217
209
  */
218
- inclusion,
219
- /**
220
- * 空の場合無効
221
- */
222
- exclusion) {
210
+ inclusion) {
223
211
  return __awaiter(this, void 0, void 0, function* () {
224
212
  const conditions = CategoryCodeRepo.CREATE_MONGO_CONDITIONS(params);
225
213
  let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
@@ -227,27 +215,11 @@ class CategoryCodeRepo {
227
215
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
228
216
  }
229
217
  else {
230
- if (Array.isArray(exclusion) && exclusion.length > 0) {
231
- positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
232
- }
218
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
219
+ // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
220
+ // }
233
221
  }
234
222
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
235
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
236
- // inclusion.forEach((field) => {
237
- // projection[field] = 1;
238
- // });
239
- // } else {
240
- // projection = {
241
- // __v: 0,
242
- // createdAt: 0,
243
- // updatedAt: 0
244
- // };
245
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
246
- // exclusion.forEach((field) => {
247
- // projection[field] = 0;
248
- // });
249
- // }
250
- // }
251
223
  const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
252
224
  if (typeof params.limit === 'number' && params.limit > 0) {
253
225
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
@@ -228,29 +228,10 @@ class CreativeWorkRepo {
228
228
  /**
229
229
  * コンテンツを検索する
230
230
  */
231
- projectFields(params, inclusion
232
- // exclusion: IKeyOfProjection[]
233
- ) {
231
+ projectFields(params, inclusion) {
234
232
  var _a;
235
233
  return __awaiter(this, void 0, void 0, function* () {
236
234
  const conditions = CreativeWorkRepo.CREATE_MONGO_CONDITIONS(params);
237
- // let projection: { [key: string]: number } = {};
238
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
239
- // inclusion.forEach((field) => {
240
- // projection[field] = 1;
241
- // });
242
- // } else {
243
- // projection = {
244
- // __v: 0,
245
- // createdAt: 0,
246
- // updatedAt: 0
247
- // };
248
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
249
- // exclusion.forEach((field) => {
250
- // projection[field] = 0;
251
- // });
252
- // }
253
- // }
254
235
  let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
255
236
  if (Array.isArray(inclusion) && inclusion.length > 0) {
256
237
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
@@ -47,7 +47,7 @@ export declare class CustomerRepo {
47
47
  /**
48
48
  * 顧客検索
49
49
  */
50
- projectFields(conditions: factory.customer.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.customer.ICustomer[]>;
50
+ projectFields(conditions: factory.customer.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.customer.ICustomer[]>;
51
51
  deleteById(params: {
52
52
  id: string;
53
53
  }): Promise<void>;
@@ -106,7 +106,7 @@ class CustomerRepo {
106
106
  /**
107
107
  * 顧客検索
108
108
  */
109
- projectFields(conditions, inclusion, exclusion) {
109
+ projectFields(conditions, inclusion) {
110
110
  var _a;
111
111
  return __awaiter(this, void 0, void 0, function* () {
112
112
  const andConditions = CustomerRepo.CREATE_MONGO_CONDITIONS(conditions);
@@ -115,9 +115,9 @@ class CustomerRepo {
115
115
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
116
116
  }
117
117
  else {
118
- if (Array.isArray(exclusion) && exclusion.length > 0) {
119
- positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
120
- }
118
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
119
+ // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
120
+ // }
121
121
  }
122
122
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
123
123
  const query = this.customerModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
@@ -71,6 +71,7 @@ interface IAggregateEvent {
71
71
  }
72
72
  export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
73
73
  type IKeyOfProjection<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id'> | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id';
74
+ type IKeyOfProjection4publicFields<T extends AvailableEventType> = Exclude<keyof factory.event.IEvent<T>, 'id' | 'offers'>;
74
75
  /**
75
76
  * minimizedEvent検索時のprojection候補
76
77
  * add(2024-07-18~)
@@ -115,6 +116,9 @@ export declare class EventRepo {
115
116
  */
116
117
  branchCode: string;
117
118
  };
119
+ options: {
120
+ updateOffersSeller: boolean;
121
+ };
118
122
  }): Promise<{
119
123
  bulkWriteResult: BulkWriteResult;
120
124
  modifiedEvents: {
@@ -161,6 +165,23 @@ export declare class EventRepo {
161
165
  * イベントを検索する(inclusion projection)
162
166
  */
163
167
  projectEventFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
168
+ /**
169
+ * apiで公開属性を検索する(2024-10-13~)
170
+ */
171
+ aggregatePublicFields<T extends AvailableEventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection4publicFields<T>[], options: {
172
+ /**
173
+ * offersを属性をprojectするかどうか
174
+ */
175
+ includeOffers: boolean;
176
+ /**
177
+ * offers.seller.makesOfferをprojectするかどうか
178
+ */
179
+ includeSellerMakesOffer: boolean;
180
+ /**
181
+ * offers.seller.makesOfferをavailableAtOrFromでfilterする
182
+ */
183
+ sellerMakesOfferAvailableAtIn?: string[];
184
+ }): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
164
185
  /**
165
186
  * IDのみで検索する
166
187
  * projectionなし
@@ -316,32 +337,20 @@ export declare class EventRepo {
316
337
  getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<Document<unknown, {}, IDocType> & ((import("@chevre/factory/lib/event/anyEvent").IAttributes & {
317
338
  _id: string;
318
339
  } & Required<{
319
- /**
320
- * イベントリポジトリ
321
- */
322
340
  _id: string;
323
341
  }>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
324
342
  _id: string;
325
343
  aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
326
344
  } & Required<{
327
- /**
328
- * イベントリポジトリ
329
- */
330
345
  _id: string;
331
346
  }>)), import("mongoose").QueryOptions<Document<unknown, {}, IDocType> & ((import("@chevre/factory/lib/event/anyEvent").IAttributes & {
332
347
  _id: string;
333
348
  } & Required<{
334
- /**
335
- * イベントリポジトリ
336
- */
337
349
  _id: string;
338
350
  }>) | (import("@chevre/factory/lib/event/screeningEvent").IAttributes & {
339
351
  _id: string;
340
352
  aggregateOffer?: import("@chevre/factory/lib/event/anyEvent").IAggregateOffer | undefined;
341
353
  } & Required<{
342
- /**
343
- * イベントリポジトリ
344
- */
345
354
  _id: string;
346
355
  }>))>>;
347
356
  addAvailableAtOrFrom(params: {