@chevre/domain 28.0.0-alpha.3 → 28.0.0-alpha.5

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 (38) hide show
  1. package/lib/chevre/eventEmitter/transaction.d.ts +2 -2
  2. package/lib/chevre/eventEmitter/transaction.js +1 -1
  3. package/lib/chevre/repo/adminEvent.d.ts +0 -6
  4. package/lib/chevre/repo/adminEvent.js +3 -9
  5. package/lib/chevre/repo/adminTransaction.js +0 -98
  6. package/lib/chevre/repo/aggregateEvent.js +0 -1
  7. package/lib/chevre/repo/aggregateTransaction.d.ts +0 -1
  8. package/lib/chevre/repo/aggregateTransaction.js +0 -1
  9. package/lib/chevre/repo/event.d.ts +2 -2
  10. package/lib/chevre/repo/event.js +71 -110
  11. package/lib/chevre/repo/mongoose/schemas/transaction.js +54 -43
  12. package/lib/chevre/repo/orderInTransaction.js +0 -6
  13. package/lib/chevre/repo/transaction/placeOrder.d.ts +1 -6
  14. package/lib/chevre/repo/transaction/placeOrder.js +25 -84
  15. package/lib/chevre/repo/transaction.js +0 -1
  16. package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -2
  17. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
  18. package/lib/chevre/service/aggregation/system.js +1 -3
  19. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +1 -2
  20. package/lib/chevre/service/event.js +0 -1
  21. package/lib/chevre/service/offer/event/authorize.js +1 -4
  22. package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
  23. package/lib/chevre/service/offer/event/voidTransaction.js +2 -5
  24. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -4
  25. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -9
  26. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -4
  27. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -4
  28. package/lib/chevre/service/offer/onEventChanged.js +2 -4
  29. package/lib/chevre/service/offer.js +1 -2
  30. package/lib/chevre/service/payment/any/authorize.js +1 -1
  31. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +1 -4
  32. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
  33. package/lib/chevre/service/payment/any/publishPaymentUrl.js +1 -1
  34. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -2
  35. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -4
  36. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -4
  37. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -2
  38. package/package.json +2 -2
@@ -17,7 +17,7 @@ export type IPlaceOrder = Pick<factory.transaction.placeOrder.ITransaction, IKey
17
17
  };
18
18
  type IStartedPlaceOrderFields = 'expires' | 'id' | 'startDate' | 'status';
19
19
  export type IStartedPlaceOrder = Pick<factory.transaction.placeOrder.ITransaction, IStartedPlaceOrderFields>;
20
- type IFindParams = Pick<factory.transaction.placeOrder.ISearchConditions, 'agent' | 'ids' | 'limit' | 'object' | 'page' | 'project' | 'seller' | 'sort' | 'startFrom' | 'startThrough' | 'status' | 'statuses' | 'tasksExportAction'> & {};
20
+ type IFindParams = Pick<factory.transaction.placeOrder.ISearchConditions, 'agent' | 'ids' | 'limit' | 'object' | 'page' | 'project' | 'seller' | 'sort' | 'startFrom' | 'startThrough' | 'status' | 'statuses'> & {};
21
21
  /**
22
22
  * 注文取引リポジトリ
23
23
  */
@@ -41,7 +41,6 @@ export declare class PlaceOrderRepo {
41
41
  * 取引期限変更
42
42
  */
43
43
  updateExpires(params: {
44
- typeOf: factory.transactionType.PlaceOrder;
45
44
  id: string;
46
45
  expires: Date;
47
46
  }): Promise<void>;
@@ -58,14 +57,12 @@ export declare class PlaceOrderRepo {
58
57
  * 進行中の注文取引を取得する
59
58
  */
60
59
  findPlaceOrderInProgressById(params: {
61
- typeOf: factory.transactionType.PlaceOrder;
62
60
  id: string;
63
61
  }, inclusion: IKeyOfProjection[]): Promise<ITransactionInProgress>;
64
62
  /**
65
63
  * 特定注文取引参照
66
64
  */
67
65
  findPlaceOrderById(params: {
68
- typeOf: factory.transactionType.PlaceOrder;
69
66
  id: string;
70
67
  }, inclusion: IKeyOfProjection[]): Promise<IPlaceOrder>;
71
68
  /**
@@ -76,7 +73,6 @@ export declare class PlaceOrderRepo {
76
73
  * 取引を確定する
77
74
  */
78
75
  confirmPlaceOrder(params: {
79
- typeOf: factory.transactionType.PlaceOrder;
80
76
  id: string;
81
77
  object: {
82
78
  orderDate: Date;
@@ -90,7 +86,6 @@ export declare class PlaceOrderRepo {
90
86
  * 取引を中止する
91
87
  */
92
88
  cancelPlaceOrder(params: {
93
- typeOf: factory.transactionType.PlaceOrder;
94
89
  id: string;
95
90
  }): Promise<void>;
96
91
  }
@@ -110,14 +110,15 @@ class PlaceOrderRepo {
110
110
  });
111
111
  }
112
112
  }
113
- const tasksExportActionStatusIn = params.tasksExportAction?.actionStatus?.$in;
114
- if (Array.isArray(tasksExportActionStatusIn)) {
115
- andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $in: tasksExportActionStatusIn } });
116
- }
117
- const tasksExportActionStatusEq = params.tasksExportAction?.actionStatus?.$eq;
118
- if (typeof tasksExportActionStatusEq === 'string') {
119
- andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $eq: tasksExportActionStatusEq } });
120
- }
113
+ // discontinue(2026-09-11~)
114
+ // const tasksExportActionStatusIn = params.tasksExportAction?.actionStatus?.$in;
115
+ // if (Array.isArray(tasksExportActionStatusIn)) {
116
+ // andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $in: tasksExportActionStatusIn } });
117
+ // }
118
+ // const tasksExportActionStatusEq = params.tasksExportAction?.actionStatus?.$eq;
119
+ // if (typeof tasksExportActionStatusEq === 'string') {
120
+ // andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $eq: tasksExportActionStatusEq } });
121
+ // }
121
122
  const sellerIdIn = params.seller?.ids;
122
123
  if (Array.isArray(sellerIdIn)) {
123
124
  andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
@@ -174,62 +175,12 @@ class PlaceOrderRepo {
174
175
  .lean()
175
176
  .exec();
176
177
  }
177
- // /**
178
- // * 取引の注文番号を検索する
179
- // */
180
- // public async findInProgressOrderNumberById(params: {
181
- // id: string;
182
- // }): Promise<string | undefined> {
183
- // const doc = await this.transactionModel.findOne(
184
- // {
185
- // _id: { $eq: params.id },
186
- // typeOf: { $eq: factory.transactionType.PlaceOrder },
187
- // status: { $eq: factory.transactionStatusType.InProgress }
188
- // },
189
- // { 'object.orderNumber': 1 }
190
- // )
191
- // .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'orderNumber'> }>() // 2024-08-26~
192
- // .exec();
193
- // if (doc === null) {
194
- // throw new factory.errors.NotFound(
195
- // this.transactionModel.modelName,
196
- // `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
197
- // );
198
- // }
199
- // return doc.object.orderNumber;
200
- // }
201
- // /**
202
- // * 取引の確認番号を検索する
203
- // */
204
- // public async findInProgressConfirmationNumberById(params: {
205
- // id: string;
206
- // status: { $in: factory.transactionStatusType[] };
207
- // }): Promise<string | undefined> {
208
- // const doc = await this.transactionModel.findOne(
209
- // {
210
- // _id: { $eq: params.id },
211
- // typeOf: { $eq: factory.transactionType.PlaceOrder },
212
- // status: { $in: params.status.$in }
213
- // },
214
- // { 'object.confirmationNumber': 1 }
215
- // )
216
- // .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'confirmationNumber'> }>() // 2024-08-26~
217
- // .exec();
218
- // if (doc === null) {
219
- // throw new factory.errors.NotFound(
220
- // this.transactionModel.modelName,
221
- // `${factory.transactionType.PlaceOrder} ${params.status.$in.join(' or ')} not found`
222
- // );
223
- // }
224
- // return doc.object.confirmationNumber;
225
- // }
226
178
  /**
227
179
  * 取引期限変更
228
180
  */
229
181
  async updateExpires(params) {
230
182
  const doc = await this.transactionModel.findOneAndUpdate({
231
183
  _id: { $eq: params.id },
232
- typeOf: { $eq: params.typeOf },
233
184
  status: { $eq: factory_1.factory.transactionStatusType.InProgress }
234
185
  }, {
235
186
  $set: {
@@ -241,7 +192,7 @@ class PlaceOrderRepo {
241
192
  .lean()
242
193
  .exec();
243
194
  if (doc === null) {
244
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
195
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
245
196
  }
246
197
  }
247
198
  /**
@@ -291,7 +242,6 @@ class PlaceOrderRepo {
291
242
  };
292
243
  const filter = {
293
244
  _id: { $eq: params.id },
294
- typeOf: { $eq: params.typeOf },
295
245
  status: { $eq: factory_1.factory.transactionStatusType.InProgress },
296
246
  // expiresを条件に追加(2023-05-12~),
297
247
  expires: { $gt: new Date() }
@@ -300,7 +250,7 @@ class PlaceOrderRepo {
300
250
  .lean()
301
251
  .exec();
302
252
  if (doc === null) {
303
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
253
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
304
254
  }
305
255
  return doc;
306
256
  }
@@ -322,13 +272,12 @@ class PlaceOrderRepo {
322
272
  ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
323
273
  };
324
274
  const doc = await this.transactionModel.findOne({
325
- _id: { $eq: params.id },
326
- typeOf: { $eq: params.typeOf }
275
+ _id: { $eq: params.id }
327
276
  }, projection)
328
277
  .lean() // 2024-08-26~
329
278
  .exec();
330
279
  if (doc === null) {
331
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} not found`);
280
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} not found`);
332
281
  }
333
282
  return doc;
334
283
  }
@@ -341,7 +290,7 @@ class PlaceOrderRepo {
341
290
  // const tasksExportationStatus = factory.transactionTasksExportationStatus.Unexported; // discontinue(2024-06-20~)
342
291
  const startDate = new Date();
343
292
  let expires;
344
- const { typeOf } = params;
293
+ const typeOf = factory_1.factory.transactionType.PlaceOrder;
345
294
  // expiresInSecondsの指定があれば優先して適用する(2022-11-25~)
346
295
  if (typeof params.expiresInSeconds === 'number' && params.expiresInSeconds > 0) {
347
296
  expires = (0, moment_1.default)(startDate)
@@ -351,18 +300,12 @@ class PlaceOrderRepo {
351
300
  else {
352
301
  throw new factory_1.factory.errors.ArgumentNull('expiresInSeconds');
353
302
  }
354
- let creatingTransaction;
355
- if (typeOf === factory_1.factory.transactionType.PlaceOrder) {
356
- const { agent, project, object, seller, instrument } = params;
357
- creatingTransaction = {
358
- status, startDate, expires, typeOf, tasksExportAction,
359
- agent, project, seller, object,
360
- ...(typeof instrument?.id === 'string') ? { instrument } : undefined
361
- };
362
- }
363
- else {
364
- throw new factory_1.factory.errors.NotImplemented(`${typeOf} not implemented`);
365
- }
303
+ const { agent, project, object, seller, instrument } = params;
304
+ const creatingTransaction = {
305
+ status, startDate, expires, typeOf, tasksExportAction,
306
+ agent, project, seller, object,
307
+ ...(typeof instrument?.id === 'string') ? { instrument } : undefined
308
+ };
366
309
  // reimplemnt with insertMany(2024-05-30~)
367
310
  const result = await this.transactionModel.insertMany(creatingTransaction, { rawResult: true });
368
311
  const id = result.insertedIds?.[0]?.toHexString();
@@ -380,7 +323,6 @@ class PlaceOrderRepo {
380
323
  const endDate = new Date();
381
324
  const doc = await this.transactionModel.findOneAndUpdate({
382
325
  _id: { $eq: params.id },
383
- typeOf: { $eq: params.typeOf },
384
326
  status: { $eq: factory_1.factory.transactionStatusType.InProgress },
385
327
  expires: { $gt: endDate } // add expires(2025-02-27~)
386
328
  }, {
@@ -399,7 +341,7 @@ class PlaceOrderRepo {
399
341
  .exec();
400
342
  // NotFoundであれば取引状態確認
401
343
  if (doc === null) {
402
- const { expires, status } = await this.findPlaceOrderById({ typeOf: params.typeOf, id: params.id }, ['expires', 'status']);
344
+ const { expires, status } = await this.findPlaceOrderById({ id: params.id }, ['expires', 'status']);
403
345
  if (status === factory_1.factory.transactionStatusType.Confirmed) {
404
346
  // すでに確定済の場合スルー
405
347
  }
@@ -414,12 +356,12 @@ class PlaceOrderRepo {
414
356
  .isSameOrBefore((0, moment_1.default)(endDate))) {
415
357
  throw new factory_1.factory.errors.Argument('Transaction id', 'potentially expired');
416
358
  }
417
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
359
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
418
360
  }
419
361
  }
420
362
  transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
421
363
  id: params.id,
422
- typeOf: params.typeOf,
364
+ typeOf: factory_1.factory.transactionType.PlaceOrder,
423
365
  status: factory_1.factory.transactionStatusType.Confirmed
424
366
  });
425
367
  }
@@ -430,7 +372,6 @@ class PlaceOrderRepo {
430
372
  const endDate = new Date();
431
373
  // 進行中ステータスの取引を中止する
432
374
  const doc = await this.transactionModel.findOneAndUpdate({
433
- typeOf: params.typeOf,
434
375
  _id: params.id,
435
376
  status: factory_1.factory.transactionStatusType.InProgress
436
377
  }, {
@@ -455,12 +396,12 @@ class PlaceOrderRepo {
455
396
  throw new factory_1.factory.errors.Argument('Transaction id', 'Confirmed transaction unable to cancel');
456
397
  }
457
398
  else {
458
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
399
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
459
400
  }
460
401
  }
461
402
  transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
462
403
  id: params.id,
463
- typeOf: params.typeOf,
404
+ typeOf: factory_1.factory.transactionType.PlaceOrder,
464
405
  status: factory_1.factory.transactionStatusType.Canceled
465
406
  });
466
407
  }
@@ -30,7 +30,6 @@ class TransactionRepo {
30
30
  throw new factory_1.factory.errors.Argument('endDate.$lt', 'must be Date');
31
31
  }
32
32
  const query = this.transactionModel.findOneAndUpdate({
33
- // ...(Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined,
34
33
  status: {
35
34
  ...(typeof statusEq === 'string')
36
35
  ? { $eq: statusEq }
@@ -22,8 +22,7 @@ function aggregateOffers(params) {
22
22
  const eventCapacity = (await repos.event.projectEventFields({
23
23
  limit: 1,
24
24
  page: 1,
25
- id: { $eq: params.id },
26
- typeOf: params.typeOf
25
+ id: { $eq: params.id }
27
26
  }, ['maximumAttendeeCapacity', 'remainingAttendeeCapacity'])).shift();
28
27
  debug('processing aggregateOffersByEvent...', eventCapacity);
29
28
  await aggregateOffersByEvent({
@@ -53,7 +53,6 @@ function aggregateScreeningEvent(params) {
53
53
  limit: 100,
54
54
  page: 1,
55
55
  project: { id: { $eq: event.project.id } },
56
- typeOf: event.typeOf,
57
56
  eventStatuses: [factory_1.factory.eventStatusType.EventScheduled],
58
57
  startFrom: startFrom,
59
58
  startThrough: startThrough,
@@ -137,8 +137,7 @@ function aggregatePlaceOrder(params) {
137
137
  const aggregateResult = await repos.aggregateTransaction.aggregatePlaceOrder({
138
138
  project: { id: { $ne: params.excludedProjectId } },
139
139
  startFrom,
140
- startThrough,
141
- typeOf: factory_1.factory.transactionType.PlaceOrder
140
+ startThrough
142
141
  });
143
142
  debug('aggregatePlaceOrder:result', aggregateResult, aggregateResult.statuses[0]?.aggregation, startFrom);
144
143
  const aggregateResultsByClientId = [];
@@ -148,7 +147,6 @@ function aggregatePlaceOrder(params) {
148
147
  project: { id: { $ne: params.excludedProjectId } },
149
148
  startFrom,
150
149
  startThrough,
151
- typeOf: factory_1.factory.transactionType.PlaceOrder,
152
150
  clientId
153
151
  });
154
152
  debug('aggregateResultByClientId', aggregateResultByClientId, aggregateResultByClientId.statuses[0]?.aggregation, clientId, startFrom);
@@ -81,8 +81,7 @@ function validateAcceptedPaymentMethodIfNeeded(params
81
81
  const eventSeriesIds = (await repos.event.projectEventFields({
82
82
  limit: checkingEventIds.length,
83
83
  page: 1,
84
- id: { $in: checkingEventIds },
85
- typeOf: factory_1.factory.eventType.ScreeningEvent
84
+ id: { $in: checkingEventIds }
86
85
  }, ['superEvent'])).map((event) => event.superEvent.id);
87
86
  if (eventSeriesIds.length !== checkingEventIds.length) {
88
87
  throw new factory_1.factory.errors.NotFound(factory_1.factory.eventType.ScreeningEvent);
@@ -153,7 +153,6 @@ function cancelDeletedEvents(params) {
153
153
  // COAから削除されたイベントをキャンセル済ステータスへ変更
154
154
  const ids = await repos.event.searchEventIds({
155
155
  project: { id: { $eq: params.project.id } },
156
- typeOf: factory_1.factory.eventType.ScreeningEvent,
157
156
  superEvent: {
158
157
  locationBranchCodes: [params.locationBranchCode]
159
158
  },
@@ -121,10 +121,7 @@ function minimizeItemOffered(itemOffered, options) {
121
121
  }
122
122
  function validateCreateRequest(params) {
123
123
  return async (repos) => {
124
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
125
- typeOf: factory_1.factory.transactionType.PlaceOrder,
126
- id: params.transaction.id
127
- }, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
124
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
128
125
  if (transaction.agent.id !== params.agent.id) {
129
126
  throw new factory_1.factory.errors.Forbidden('Transaction not yours');
130
127
  }
@@ -63,7 +63,7 @@ function issueEventOfferTicket(params) {
63
63
  return async (repos) => {
64
64
  const { now, audience, eventId, eventOfferId, ticketedOffer, author, project, instrument } = params;
65
65
  // 取引は存在するか
66
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: factory_1.factory.transactionType.PlaceOrder, id: audience.id }, ['expires', 'typeOf', 'seller']);
66
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: audience.id }, ['expires', 'typeOf', 'seller']);
67
67
  // イベントは存在するか
68
68
  const event = await repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
69
69
  const { seller } = transaction;
@@ -22,7 +22,7 @@ function voidTransaction(params) {
22
22
  agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
23
23
  ...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
24
24
  };
25
- const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'object']);
25
+ const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'object']);
26
26
  // 興行オファー承認アクション検索
27
27
  let authorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
28
28
  // typeOf: factory.actionType.AuthorizeAction,
@@ -115,10 +115,7 @@ function cancelAcceptActions(params) {
115
115
  agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
116
116
  ...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
117
117
  };
118
- const transaction = await repos.placeOrder.findPlaceOrderById({
119
- typeOf: params.purpose.typeOf,
120
- id: params.purpose.id
121
- }, ['typeOf', 'status']);
118
+ const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status']);
122
119
  // 興行オファー承認アクション検索
123
120
  const completedAuthorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
124
121
  // typeOf: factory.actionType.AuthorizeAction,
@@ -19,10 +19,7 @@ function voidTransactionByActionId(params) {
19
19
  agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
20
20
  ...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
21
21
  };
22
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
23
- typeOf: factory_1.factory.transactionType.PlaceOrder,
24
- id: params.purpose.id
25
- }, ['typeOf']);
22
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['typeOf']);
26
23
  // if (transaction.agent.id !== params.agent.id) {
27
24
  // throw new factory.errors.Forbidden('Transaction not yours');
28
25
  // }
@@ -12,7 +12,6 @@ function findCOAInfo(params) {
12
12
  project: { id: { $eq: params.project.id } },
13
13
  limit: 1,
14
14
  page: 1,
15
- typeOf: factory_1.factory.eventType.ScreeningEvent,
16
15
  id: { $eq: params.id }
17
16
  }, ['coaInfo'])).shift();
18
17
  if (event === undefined) {
@@ -33,10 +32,7 @@ function acceptOffer(params) {
33
32
  if (typeof params.sameAs.id !== 'string' || params.sameAs.id === '') {
34
33
  throw new factory_1.factory.errors.ArgumentNull('sameAs.id');
35
34
  }
36
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
37
- typeOf: factory_1.factory.transactionType.PlaceOrder,
38
- id: params.purpose.id
39
- }, ['project', 'agent', 'typeOf']);
35
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['project', 'agent', 'typeOf']);
40
36
  // // 注文ドキュメントを参照(2026-06-24~)
41
37
  // const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
42
38
  // identifier: transaction.id,
@@ -118,10 +114,7 @@ function reAcceptOffer(params) {
118
114
  if (typeof params.potentialActions?.id !== 'string' || params.potentialActions.id === '') {
119
115
  throw new factory_1.factory.errors.ArgumentNull('potentialActions.id');
120
116
  }
121
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
122
- typeOf: factory_1.factory.transactionType.PlaceOrder,
123
- id: params.purpose.id
124
- }, ['project', 'agent', 'typeOf']);
117
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['project', 'agent', 'typeOf']);
125
118
  // const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
126
119
  // if (typeof orderNumber !== 'string') {
127
120
  // // 事前に発行されているはず
@@ -14,10 +14,7 @@ const factory_2 = require("../../../factory");
14
14
  */
15
15
  function authorize(params) {
16
16
  return async (repos) => {
17
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
18
- typeOf: factory_2.factory.transactionType.PlaceOrder,
19
- id: params.transaction.id
20
- }, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
17
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
21
18
  if (transaction.agent.id !== params.agent.id) {
22
19
  throw new factory_2.factory.errors.Forbidden('Transaction not yours');
23
20
  }
@@ -14,10 +14,7 @@ const factory_2 = require("../../../factory");
14
14
  */
15
15
  function changeOffers(params) {
16
16
  return async (repos) => {
17
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
18
- typeOf: factory_2.factory.transactionType.PlaceOrder,
19
- id: params.transaction.id
20
- }, ['typeOf', 'agent', 'project', 'seller']);
17
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['typeOf', 'agent', 'project', 'seller']);
21
18
  if (transaction.agent.id !== params.agent.id) {
22
19
  throw new factory_2.factory.errors.Forbidden('Transaction not yours');
23
20
  }
@@ -101,8 +101,7 @@ function createInformTasks(params, setting) {
101
101
  const informEvents = setting?.onResourceUpdated?.informResource;
102
102
  if (params.typeOf === factory_1.factory.eventType.ScreeningEvent) {
103
103
  const screeningEvents4inform = await repos.event.projectEventFields({
104
- id: { $in: params.ids },
105
- typeOf: params.typeOf
104
+ id: { $in: params.ids }
106
105
  }, [
107
106
  'project', 'organizer', 'typeOf', 'name', 'doorTime', 'endDate',
108
107
  'eventStatus', 'location', 'startDate', 'superEvent', 'offers', 'additionalProperty', 'identifier'
@@ -296,8 +295,7 @@ function syncEventEndDate2pendingReservations(params) {
296
295
  const events = await repos.event.projectEventFields({
297
296
  limit: 1,
298
297
  page: 1,
299
- id: { $eq: eventId },
300
- typeOf: params.typeOf
298
+ id: { $eq: eventId }
301
299
  }, ['endDate']);
302
300
  const endDate = events.shift()?.endDate;
303
301
  if (endDate instanceof Date) {
@@ -169,8 +169,7 @@ function findEventSeatOffersBySection(params) {
169
169
  page: 1,
170
170
  project: { id: { $eq: projectId } },
171
171
  organizer: { id: { $eq: sellerId } },
172
- id: { $eq: eventId },
173
- typeOf: factory_1.factory.eventType.ScreeningEvent
172
+ id: { $eq: eventId }
174
173
  }, ['startDate', 'offers.itemOffered', 'location', 'superEvent'])).shift();
175
174
  if (event === undefined) {
176
175
  throw new factory_1.factory.errors.NotFound(factory_1.factory.eventType.ScreeningEvent);
@@ -59,7 +59,7 @@ function authorize(params) {
59
59
  if (purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
60
60
  throw new factory_1.factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
61
61
  }
62
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
62
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
63
63
  if (project.id !== transaction.project.id) {
64
64
  throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
65
65
  }
@@ -12,10 +12,7 @@ function invalidatePaymentUrl(params) {
12
12
  if (params.purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
13
13
  throw new factory_1.factory.errors.Argument('purpose.typeOf', `must be ${factory_1.factory.transactionType.PlaceOrder}`);
14
14
  }
15
- const transaction = await repos.placeOrder.findPlaceOrderById({
16
- typeOf: params.purpose.typeOf,
17
- id: params.purpose.id
18
- }, ['typeOf', 'status', 'object', 'project', 'seller', 'agent']);
15
+ const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'object', 'project', 'seller', 'agent']);
19
16
  // const orderCancelled: boolean = params.purpose.result?.order?.orderStatus === factory.orderStatus.OrderCancelled;
20
17
  // if (transaction.status === factory.transactionStatusType.Confirmed) {
21
18
  // if (!orderCancelled) {
@@ -50,10 +50,10 @@ function processVoidPayTransaction(params) {
50
50
  let transaction;
51
51
  // アクションID指定の場合、進行中取引検証(2023-02-24~)
52
52
  if (typeof params.id === 'string') {
53
- transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status']);
53
+ transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['typeOf', 'status']);
54
54
  }
55
55
  else {
56
- transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'result']);
56
+ transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'result']);
57
57
  }
58
58
  // 承認アクションを取得
59
59
  let authorizeActions;
@@ -48,7 +48,7 @@ function publishPaymentUrl(params) {
48
48
  throw new factory_1.factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
49
49
  }
50
50
  try {
51
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
51
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: purpose.id }, ['expires', 'seller', 'project']);
52
52
  if (project.id !== transaction.project.id) {
53
53
  throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
54
54
  }
@@ -63,7 +63,7 @@ function confirm(params, options) {
63
63
  // status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
64
64
  object: { orderDate: params.result.order.orderDate }
65
65
  })(repos);
66
- const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: factory_1.factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
66
+ const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
67
67
  // 注文ドキュメントから注文番号を参照(取引開始時に発行済の前提)(2026-06-26~)
68
68
  const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
69
69
  identifier: params.id,
@@ -169,7 +169,6 @@ function confirm(params, options) {
169
169
  // ステータス変更
170
170
  try {
171
171
  await repos.placeOrder.confirmPlaceOrder({
172
- typeOf: transaction.typeOf,
173
172
  id: transaction.id,
174
173
  object: {
175
174
  orderDate: params.result.order.orderDate,
@@ -12,10 +12,7 @@ const factory_2 = require("./exportTasks/factory");
12
12
  */
13
13
  function exportTasksById(params) {
14
14
  return async (repos) => {
15
- const transaction = await repos.placeOrder.findPlaceOrderById({
16
- typeOf: factory_1.factory.transactionType.PlaceOrder,
17
- id: params.id
18
- }, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
15
+ const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.id }, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
19
16
  // タスク実行日時バッファの指定があれば調整
20
17
  let taskRunsAt = new Date();
21
18
  if (typeof params.runsTasksAfterInSeconds === 'number') {
@@ -8,10 +8,7 @@ const fixCustomer_1 = require("./updateAgent/fixCustomer");
8
8
  */
9
9
  function updateAgent(params) {
10
10
  return async (repos) => {
11
- const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
12
- typeOf: factory_1.factory.transactionType.PlaceOrder,
13
- id: params.id
14
- }, ['agent', 'object', 'typeOf', 'project']);
11
+ const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.id }, ['agent', 'object', 'typeOf', 'project']);
15
12
  if (transaction.agent.id !== params.agent.id) {
16
13
  throw new factory_1.factory.errors.Forbidden('Transaction not yours');
17
14
  }
@@ -36,8 +36,7 @@ function preStart(params) {
36
36
  let events = [];
37
37
  if (eventIds.length > 0) {
38
38
  events = await repos.event.projectEventFields({
39
- id: { $in: eventIds },
40
- typeOf: factory_1.factory.eventType.ScreeningEvent
39
+ id: { $in: eventIds }
41
40
  }, ['startDate']);
42
41
  }
43
42
  let returnPolicies = [];
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.1090.0",
13
13
  "@aws-sdk/credential-providers": "3.1090.0",
14
- "@chevre/factory": "11.0.0-alpha.1",
14
+ "@chevre/factory": "11.0.0-alpha.2",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "28.0.0-alpha.3"
91
+ "version": "28.0.0-alpha.5"
92
92
  }