@chevre/domain 25.2.0-alpha.13 → 25.2.0-alpha.14

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.
@@ -10,6 +10,7 @@ export { ICancelActionAction };
10
10
  type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction>;
11
11
  type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds | factory.recipe.RecipeCategory.payCreditCard | factory.recipe.RecipeCategory.payMovieTicket | factory.recipe.RecipeCategory.refundCreditCard | factory.recipe.RecipeCategory.refundMovieTicket>>;
12
12
  export interface IDeleteActionResult {
13
+ identifier: string;
13
14
  deletedCount?: number;
14
15
  }
15
16
  /**
@@ -325,35 +325,48 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
325
325
  }
326
326
  const filters = [
327
327
  {
328
- 'project.id': { $eq: project.id },
329
- 'object.orderNumber': { $exists: true, $eq: orderNumber }
328
+ identifier: 'byObject',
329
+ filter: {
330
+ 'project.id': { $eq: project.id },
331
+ 'object.orderNumber': { $exists: true, $eq: orderNumber }
332
+ }
330
333
  },
331
334
  {
332
- 'project.id': { $eq: project.id },
333
- 'purpose.orderNumber': { $exists: true, $eq: orderNumber }
335
+ identifier: 'byPurpose',
336
+ filter: {
337
+ 'project.id': { $eq: project.id },
338
+ 'purpose.orderNumber': { $exists: true, $eq: orderNumber }
339
+ }
334
340
  },
335
341
  {
336
- 'project.id': { $eq: project.id },
337
- 'about.orderNumber': { $exists: true, $eq: orderNumber }
342
+ identifier: 'byAbout',
343
+ filter: {
344
+ 'project.id': { $eq: project.id },
345
+ 'about.orderNumber': { $exists: true, $eq: orderNumber }
346
+ }
338
347
  },
339
348
  {
340
- 'project.id': { $eq: project.id },
341
- 'instrument.orderNumber': { $exists: true, $eq: orderNumber }
349
+ identifier: 'byInstrument',
350
+ filter: {
351
+ 'project.id': { $eq: project.id },
352
+ 'instrument.orderNumber': { $exists: true, $eq: orderNumber }
353
+ }
342
354
  },
343
355
  ];
344
- const results = await Promise.all(filters.map(async (filter) => {
356
+ return Promise.all(filters.map(async ({ identifier, filter }) => {
345
357
  return this.actionModel.deleteMany(filter)
346
- .exec();
358
+ .exec()
359
+ .then((result) => {
360
+ return {
361
+ identifier,
362
+ // n: result?.n,
363
+ // opTime: result.opTime,
364
+ // ok: result?.ok,
365
+ // operationTime,
366
+ deletedCount: result?.deletedCount
367
+ };
368
+ });
347
369
  }));
348
- return results.map((result) => {
349
- return {
350
- // n: result?.n,
351
- // opTime: result.opTime,
352
- // ok: result?.ok,
353
- // operationTime,
354
- deletedCount: result?.deletedCount
355
- };
356
- });
357
370
  }
358
371
  async deleteByProject(params) {
359
372
  await this.actionModel.deleteMany({
@@ -408,32 +421,39 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
408
421
  }
409
422
  const filters = [
410
423
  {
411
- 'project.id': { $eq: project.id },
412
- typeOf: { $in: params.typeOf.$in },
413
- 'purpose.id': { $exists: true, $eq: transaction.id },
414
- 'purpose.typeOf': { $exists: true, $eq: transaction.typeOf }
424
+ identifier: 'byPurpose',
425
+ filter: {
426
+ 'project.id': { $eq: project.id },
427
+ typeOf: { $in: params.typeOf.$in },
428
+ 'purpose.id': { $exists: true, $eq: transaction.id },
429
+ 'purpose.typeOf': { $exists: true, $eq: transaction.typeOf }
430
+ }
415
431
  },
416
432
  // instrumentによるアクション削除にも対応(2026-07-10~)
417
433
  {
418
- 'project.id': { $eq: project.id },
419
- // typeOf: { $in: params.typeOf.$in }, // typOfでフィルターしない
420
- 'instrument.id': { $exists: true, $eq: transaction.id },
421
- 'instrument.typeOf': { $exists: true, $eq: transaction.typeOf }
434
+ identifier: 'byInstrument',
435
+ filter: {
436
+ 'project.id': { $eq: project.id },
437
+ // typeOf: { $in: params.typeOf.$in }, // typOfでフィルターしない
438
+ 'instrument.id': { $exists: true, $eq: transaction.id },
439
+ 'instrument.typeOf': { $exists: true, $eq: transaction.typeOf }
440
+ }
422
441
  }
423
442
  ];
424
- const results = await Promise.all(filters.map(async (filter) => {
443
+ return Promise.all(filters.map(async ({ identifier, filter }) => {
425
444
  return this.actionModel.deleteMany(filter)
426
- .exec();
445
+ .exec()
446
+ .then((result) => {
447
+ return {
448
+ identifier,
449
+ // n: result?.n,
450
+ // opTime: result.opTime,
451
+ // ok: result?.ok,
452
+ // operationTime,
453
+ deletedCount: result?.deletedCount
454
+ };
455
+ });
427
456
  }));
428
- return results.map((result) => {
429
- return {
430
- // n: result?.n,
431
- // opTime: result.opTime,
432
- // ok: result?.ok,
433
- // operationTime,
434
- deletedCount: result?.deletedCount
435
- };
436
- });
437
457
  }
438
458
  getCursor(conditions, projection) {
439
459
  return this.actionModel.find(conditions, projection)
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.2.0-alpha.13"
94
+ "version": "25.2.0-alpha.14"
95
95
  }