@chevre/domain 21.8.0-alpha.6 → 21.8.0-alpha.60

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 (129) hide show
  1. package/example/src/chevre/countOffers.ts +32 -0
  2. package/example/src/chevre/findItemListElementByCatalogId.ts +23 -0
  3. package/example/src/chevre/importOffersFromCOA.ts +7 -1
  4. package/example/src/chevre/migrateAggregateOffers.ts +89 -0
  5. package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
  6. package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
  7. package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
  8. package/example/src/chevre/processPay.ts +3 -4
  9. package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
  10. package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
  11. package/example/src/chevre/searchAggregateOffers.ts +48 -0
  12. package/example/src/chevre/searchEventTicketOffers.ts +3 -1
  13. package/example/src/chevre/searchEvents.ts +9 -7
  14. package/example/src/chevre/searchOffersByCatalog.ts +9 -5
  15. package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
  16. package/example/src/chevre/searchOrders.ts +9 -7
  17. package/example/src/chevre/sync2aggregateOffer.ts +27 -0
  18. package/example/src/chevre/syncAggregateOffer.ts +25 -0
  19. package/lib/chevre/emailMessageBuilder.js +6 -5
  20. package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
  21. package/lib/chevre/repo/aggregateOffer.js +534 -0
  22. package/lib/chevre/repo/assetTransaction.d.ts +16 -1
  23. package/lib/chevre/repo/assetTransaction.js +54 -2
  24. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
  25. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +177 -0
  26. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
  27. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
  28. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  29. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +24 -33
  30. package/lib/chevre/repo/mongoose/schemas/offer.js +4 -3
  31. package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
  32. package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
  33. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
  34. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  35. package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
  36. package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
  37. package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
  38. package/lib/chevre/repo/offer.d.ts +82 -47
  39. package/lib/chevre/repo/offer.js +1279 -289
  40. package/lib/chevre/repo/offerCatalog.d.ts +6 -0
  41. package/lib/chevre/repo/offerCatalog.js +13 -0
  42. package/lib/chevre/repo/order.d.ts +15 -0
  43. package/lib/chevre/repo/order.js +58 -26
  44. package/lib/chevre/repo/task.d.ts +7 -1
  45. package/lib/chevre/repo/task.js +100 -0
  46. package/lib/chevre/repository.d.ts +3 -0
  47. package/lib/chevre/repository.js +5 -1
  48. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -1
  49. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -1
  50. package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
  51. package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
  52. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
  53. package/lib/chevre/service/assetTransaction/pay.js +65 -46
  54. package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
  55. package/lib/chevre/service/assetTransaction/registerService.js +2 -1
  56. package/lib/chevre/service/assetTransaction/reserve.js +111 -35
  57. package/lib/chevre/service/delivery.js +17 -0
  58. package/lib/chevre/service/offer/event/authorize.js +39 -35
  59. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  60. package/lib/chevre/service/offer/event/factory.js +8 -8
  61. package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
  62. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
  63. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +6 -3
  64. package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
  65. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  66. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
  67. package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
  68. package/lib/chevre/service/offer/factory.d.ts +12 -4
  69. package/lib/chevre/service/offer/factory.js +9 -11
  70. package/lib/chevre/service/offer/product/searchProductOffers.d.ts +8 -1
  71. package/lib/chevre/service/offer/product/searchProductOffers.js +10 -3
  72. package/lib/chevre/service/offer/product.d.ts +1 -0
  73. package/lib/chevre/service/offer/product.js +3 -2
  74. package/lib/chevre/service/offer.d.ts +1 -0
  75. package/lib/chevre/service/offer.js +7 -1
  76. package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
  77. package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
  78. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
  79. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
  80. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
  81. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
  82. package/lib/chevre/service/order/onOrderStatusChanged.js +81 -54
  83. package/lib/chevre/service/order/payOrder.d.ts +2 -10
  84. package/lib/chevre/service/order/payOrder.js +4 -45
  85. package/lib/chevre/service/order/placeOrder.js +11 -13
  86. package/lib/chevre/service/order.d.ts +3 -1
  87. package/lib/chevre/service/order.js +6 -2
  88. package/lib/chevre/service/payment/any/factory.js +33 -8
  89. package/lib/chevre/service/payment/any.js +30 -21
  90. package/lib/chevre/service/payment/creditCard.js +12 -12
  91. package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
  92. package/lib/chevre/service/payment/movieTicket.js +10 -11
  93. package/lib/chevre/service/payment/paymentCard.js +9 -12
  94. package/lib/chevre/service/project.js +1 -1
  95. package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
  96. package/lib/chevre/service/reserve/checkInReservation.js +3 -2
  97. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
  98. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
  99. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
  100. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
  101. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
  102. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
  103. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
  104. package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
  105. package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
  106. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
  107. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
  108. package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
  109. package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
  110. package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
  111. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
  112. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
  113. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
  114. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +60 -0
  115. package/lib/chevre/service/task/onResourceUpdated.js +12 -0
  116. package/lib/chevre/service/task/returnPayTransaction.js +8 -3
  117. package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
  118. package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
  119. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
  120. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
  121. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
  122. package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
  123. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
  124. package/lib/chevre/service/transaction/returnOrder.js +5 -1
  125. package/lib/chevre/settings.d.ts +5 -3
  126. package/lib/chevre/settings.js +6 -6
  127. package/package.json +3 -3
  128. package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
  129. package/example/src/chevre/migrateEventOrganizer.ts +0 -154
@@ -9,6 +9,7 @@ exports.modelName = modelName;
9
9
  * タスクスキーマ
10
10
  */
11
11
  const schema = new mongoose_1.Schema({
12
+ identifier: String,
12
13
  project: mongoose_1.SchemaTypes.Mixed,
13
14
  name: String,
14
15
  status: String,
@@ -52,6 +53,13 @@ schema.index({ 'project.id': 1, runsAt: -1 }, { name: 'searchByProjectId-v202207
52
53
  schema.index({ name: 1, runsAt: -1 }, { name: 'searchByName-v2' });
53
54
  schema.index({ status: 1, runsAt: -1 }, { name: 'searchByStatus-v2' });
54
55
  schema.index({ runsAt: -1 }, { name: 'searchByRunsAt-v2' });
56
+ // identifier追加(2023-09-01~)
57
+ schema.index({ identifier: 1, runsAt: -1 }, {
58
+ name: 'searchByIdentifier',
59
+ partialFilterExpression: {
60
+ identifier: { $exists: true }
61
+ }
62
+ });
55
63
  schema.index({ dateAborted: 1, runsAt: -1 }, {
56
64
  name: 'searchByDateAborted',
57
65
  partialFilterExpression: {
@@ -1,47 +1,36 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Connection } from 'mongoose';
1
+ import { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
2
+ import { AnyExpression, Connection, PipelineStage } from 'mongoose';
26
3
  import * as factory from '../factory';
27
- interface IProjection {
28
- [key: string]: 0 | 1;
29
- }
4
+ type IMatchStage = PipelineStage.Match;
5
+ type KeyOfUnitPriceOffer = keyof factory.unitPriceOffer.IUnitPriceOffer;
6
+ type IProjection = {
7
+ [key in KeyOfUnitPriceOffer]?: 0 | 1;
8
+ };
9
+ export type IUnitPriceOfferFromAggregateOffer = factory.unitPriceOffer.IUnitPriceOffer & {
10
+ offerIndex?: number;
11
+ parentOffer?: {
12
+ id: string;
13
+ };
14
+ };
30
15
  /**
31
- * オファーリポジトリ
16
+ * 単価オファーリポジトリ
32
17
  */
33
18
  export declare class MongoRepository {
34
- private readonly offerModel;
19
+ private readonly aggregateOfferModel;
35
20
  private readonly offerCatalogModel;
21
+ private readonly taskModel;
36
22
  constructor(connection: Connection);
37
- static CREATE_OFFER_MONGO_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): any[];
23
+ static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): IMatchStage[];
24
+ static CREATE_AGGREGATE_OFFERS_PROJECTION(params: IProjection): {
25
+ [field: string]: AnyExpression;
26
+ };
38
27
  /**
39
- * カタログに含まれるオファーを検索する
40
- * カタログに登録されたオファーの順序は保証される
28
+ * カタログに含まれるオファーを検索する(カタログ内ソートは保証しない)
29
+ * カタログ内ソートインデックスはsortedOfferIdsで判断する
41
30
  */
42
31
  findOffersByOfferCatalogId(params: {
43
32
  /**
44
- * 指定したIDのオファーだけ取得する場合
33
+ * 指定したIDの単価オファーだけ取得する場合
45
34
  */
46
35
  ids?: string[];
47
36
  offerCatalog: {
@@ -55,18 +44,36 @@ export declare class MongoRepository {
55
44
  onlyValid?: boolean;
56
45
  limit?: number;
57
46
  page?: number;
58
- sort: boolean;
59
47
  projection?: IProjection;
48
+ /**
49
+ * 強制的にoffersコレクションを使用する
50
+ */
51
+ useOffersAsPrimaryForcible: boolean;
60
52
  }): Promise<{
61
- offers: factory.unitPriceOffer.IUnitPriceOffer[];
53
+ offers: IUnitPriceOfferFromAggregateOffer[];
54
+ /**
55
+ * カタログ内ソートされた集計オファーIDリスト
56
+ */
62
57
  sortedOfferIds: string[];
63
58
  }>;
64
- findById(params: {
59
+ findAggregateOfferById(params: {
60
+ project: {
61
+ id: string;
62
+ };
65
63
  id: string;
64
+ }): Promise<factory.aggregateOffer.IAggregateOffer>;
65
+ count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
66
+ search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection,
67
+ /**
68
+ * 強制的にoffersコレクションを使用する
69
+ */
70
+ useOffersAsPrimary?: boolean): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
71
+ save(params: factory.unitPriceOffer.IUnitPriceOffer & {
72
+ $unset?: any;
66
73
  }): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
67
- count(params: factory.unitPriceOffer.ISearchConditions): Promise<number>;
68
- search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
69
- save(params: factory.unitPriceOffer.IUnitPriceOffer): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
74
+ /**
75
+ * sskts専用オファー保管
76
+ */
70
77
  saveManyByIdentifier(params: {
71
78
  attributes: factory.unitPriceOffer.IUnitPriceOffer;
72
79
  upsert?: boolean;
@@ -87,17 +94,45 @@ export declare class MongoRepository {
87
94
  };
88
95
  }): Promise<import("mongodb").UpdateResult | undefined>;
89
96
  deleteById(params: {
97
+ project: {
98
+ id: string;
99
+ };
90
100
  id: string;
91
101
  }): Promise<void>;
92
- deleteByProject(params: {
102
+ sync2aggregateOffer(params: {
103
+ id?: {
104
+ $in: string[];
105
+ };
106
+ identifier?: {
107
+ $in: string[];
108
+ };
93
109
  project: {
94
110
  id: string;
95
111
  };
96
- }): Promise<void>;
97
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
98
- unsetUnnecessaryFields(params: {
99
- filter: any;
100
- $unset: any;
101
- }): Promise<import("mongodb").UpdateResult>;
112
+ isDeleted: boolean;
113
+ typeOf: factory.offerType.AggregateOffer | factory.offerType.Offer;
114
+ }): Promise<BulkWriteOpResultObject | void>;
115
+ /**
116
+ * オファー同期専用のタスク保管
117
+ */
118
+ saveSyncTask(params: {
119
+ id: {
120
+ $in: string[];
121
+ };
122
+ identifier: {
123
+ $in: string[];
124
+ };
125
+ isDeleted: boolean;
126
+ project: {
127
+ id: string;
128
+ };
129
+ typeOf: factory.offerType.AggregateOffer | factory.offerType.Offer;
130
+ options: {
131
+ emitImmediately: boolean;
132
+ };
133
+ }): Promise<{
134
+ id: string;
135
+ }[]>;
136
+ private searchFromAggregateOffer;
102
137
  }
103
138
  export {};