@chevre/domain 24.0.0-alpha.26 → 24.0.0-alpha.28

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 (88) hide show
  1. package/lib/chevre/errorHandler.js +1 -1
  2. package/lib/chevre/repo/accountTitle.d.ts +7 -3
  3. package/lib/chevre/repo/action/acceptCOAOffer.js +0 -2
  4. package/lib/chevre/repo/action/acceptPay.d.ts +4 -0
  5. package/lib/chevre/repo/action/acceptPay.js +40 -52
  6. package/lib/chevre/repo/action/actionProcess.d.ts +31 -1
  7. package/lib/chevre/repo/action/actionProcess.js +499 -4
  8. package/lib/chevre/repo/action/authorizeInvoice.d.ts +14 -1
  9. package/lib/chevre/repo/action/authorizeInvoice.js +36 -0
  10. package/lib/chevre/repo/action/authorizePaymentMethod.js +9 -47
  11. package/lib/chevre/repo/action.d.ts +8 -8
  12. package/lib/chevre/repo/action.js +2 -510
  13. package/lib/chevre/repo/aggregateOffer.d.ts +7 -3
  14. package/lib/chevre/repo/assetTransaction.d.ts +48 -22
  15. package/lib/chevre/repo/categoryCode.d.ts +8 -3
  16. package/lib/chevre/repo/comment.d.ts +7 -3
  17. package/lib/chevre/repo/creativeWork.d.ts +8 -7
  18. package/lib/chevre/repo/customer.d.ts +8 -3
  19. package/lib/chevre/repo/event.d.ts +11 -23
  20. package/lib/chevre/repo/event.js +22 -23
  21. package/lib/chevre/repo/eventSeries.d.ts +10 -4
  22. package/lib/chevre/repo/identity.d.ts +12 -3
  23. package/lib/chevre/repo/identityProvider.d.ts +7 -18
  24. package/lib/chevre/repo/issuer.d.ts +8 -8
  25. package/lib/chevre/repo/member.d.ts +7 -3
  26. package/lib/chevre/repo/merchantReturnPolicy.d.ts +7 -3
  27. package/lib/chevre/repo/message.js +1 -1
  28. package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +1 -1
  29. package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
  30. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +2 -2
  31. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +1 -1
  32. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +1 -1
  33. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +2 -2
  34. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +2 -2
  35. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +2 -2
  36. package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +2 -2
  37. package/lib/chevre/repo/mongoose/schemas/eventOffer.d.ts +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/identity.d.ts +1 -1
  39. package/lib/chevre/repo/mongoose/schemas/identityProvider.d.ts +1 -1
  40. package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +1 -1
  41. package/lib/chevre/repo/mongoose/schemas/member/global.d.ts +1 -1
  42. package/lib/chevre/repo/mongoose/schemas/message.d.ts +2 -2
  43. package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +1 -1
  44. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +1 -1
  45. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -1
  46. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +2 -2
  47. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +2 -2
  48. package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +1 -1
  49. package/lib/chevre/repo/mongoose/schemas/paymentServiceChannel.d.ts +1 -1
  50. package/lib/chevre/repo/mongoose/schemas/potentialAction.d.ts +1 -1
  51. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +3 -1
  52. package/lib/chevre/repo/mongoose/schemas/product.d.ts +1 -1
  53. package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +1 -1
  54. package/lib/chevre/repo/mongoose/schemas/project.d.ts +1 -1
  55. package/lib/chevre/repo/mongoose/schemas/schedule.d.ts +1 -1
  56. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +1 -1
  57. package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.d.ts +1 -1
  58. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +1 -1
  59. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +1 -1
  60. package/lib/chevre/repo/mongoose/schemas/task.d.ts +1 -1
  61. package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +1 -1
  62. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +5 -2
  63. package/lib/chevre/repo/mongoose/schemas/webSite.d.ts +1 -1
  64. package/lib/chevre/repo/movieTicketType.d.ts +2 -1
  65. package/lib/chevre/repo/offerCatalog.d.ts +8 -4
  66. package/lib/chevre/repo/order.d.ts +10 -4
  67. package/lib/chevre/repo/ownershipInfo.d.ts +8 -7
  68. package/lib/chevre/repo/paymentService.d.ts +8 -8
  69. package/lib/chevre/repo/place/movieTheater.d.ts +7 -3
  70. package/lib/chevre/repo/place/screeningRoom.d.ts +7 -3
  71. package/lib/chevre/repo/potentialAction.d.ts +7 -26
  72. package/lib/chevre/repo/priceSpecification.d.ts +47 -22
  73. package/lib/chevre/repo/priceSpecification.js +0 -6
  74. package/lib/chevre/repo/product.d.ts +7 -3
  75. package/lib/chevre/repo/project.d.ts +8 -11
  76. package/lib/chevre/repo/reservation.d.ts +18 -6
  77. package/lib/chevre/repo/reserveInterface.js +4 -4
  78. package/lib/chevre/repo/role.d.ts +39 -3
  79. package/lib/chevre/repo/schedule.js +1 -1
  80. package/lib/chevre/repo/seller.d.ts +7 -50
  81. package/lib/chevre/repo/task.d.ts +7 -67
  82. package/lib/chevre/repo/transaction.d.ts +103 -13
  83. package/lib/chevre/service/order/sendOrder.js +0 -1
  84. package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +9 -8
  85. package/lib/chevre/service/payment/creditCard/voidTransaction.js +15 -7
  86. package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +2 -0
  87. package/lib/chevre/service/task/voidPayment.js +2 -0
  88. package/package.json +3 -3
@@ -84,7 +84,7 @@ async function handleMongoError(error) {
84
84
  // handle CastError(2025-10-27~)
85
85
  // CastError: Cast to ObjectId failed for value "xxx" (type string) at path "_id" for model "xxxxxxxxxxxxx"
86
86
  if (handledError instanceof mongooseError.CastError) {
87
- handledError = new factory_1.errors.Argument(`${handledError.model?.modelName}.${handledError.path}`, (handledError.reason instanceof Error) ? handledError.reason.message : handledError.message);
87
+ handledError = new factory_1.errors.Argument(`${handledError.path}`, (handledError.reason instanceof Error) ? handledError.reason.message : handledError.message);
88
88
  }
89
89
  return handledError;
90
90
  }
@@ -12,11 +12,15 @@ export declare class AccountTitleRepo {
12
12
  id: string;
13
13
  };
14
14
  }): Promise<void>;
15
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & factory.accountTitle.IAccountTitle & {
15
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle, {}, {}> & factory.accountTitle.IAccountTitle & {
16
16
  _id: import("mongoose").Types.ObjectId;
17
- }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & factory.accountTitle.IAccountTitle & {
17
+ } & {
18
+ __v: number;
19
+ }, import("mongoose").QueryOptions<factory.accountTitle.IAccountTitle>, (import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle, {}, {}> & factory.accountTitle.IAccountTitle & {
18
20
  _id: import("mongoose").Types.ObjectId;
19
- }>>;
21
+ } & {
22
+ __v: number;
23
+ }) | null>;
20
24
  unsetUnnecessaryFields(params: {
21
25
  filter: any;
22
26
  $unset: any;
@@ -25,8 +25,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.AcceptCOAOfferActionRepo = void 0;
27
27
  const factory = __importStar(require("../../factory"));
28
- // import { MONGO_MAX_TIME_MS } from '../settings';
29
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
30
28
  // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
31
29
  const actionProcess_1 = require("./actionProcess");
32
30
  /**
@@ -7,6 +7,7 @@ export type IAcceptPayAction = factory.action.accept.pay.IAction;
7
7
  export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAction, IActionRecipe<factory.recipe.RecipeCategory.publishPaymentUrl>> {
8
8
  /**
9
9
  * 注文取引から検索する
10
+ * 件数はlimitされない
10
11
  */
11
12
  findAcceptActionsByPurpose(params: {
12
13
  project: {
@@ -27,6 +28,9 @@ export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAct
27
28
  id: string;
28
29
  };
29
30
  object: {
31
+ /**
32
+ * 決済取引番号
33
+ */
30
34
  transactionNumber: string;
31
35
  };
32
36
  }, inclusion: IKeyOfProjection[]): Promise<IAcceptPayAction[]>;
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.AcceptPayActionRepo = void 0;
27
27
  const factory = __importStar(require("../../factory"));
28
- const settings_1 = require("../../settings");
28
+ // import { MONGO_MAX_TIME_MS } from '../../settings';
29
29
  // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
30
30
  // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
31
31
  const actionProcess_1 = require("./actionProcess");
@@ -35,65 +35,53 @@ const actionProcess_1 = require("./actionProcess");
35
35
  class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
36
36
  /**
37
37
  * 注文取引から検索する
38
+ * 件数はlimitされない
38
39
  */
39
40
  async findAcceptActionsByPurpose(params, inclusion) {
40
- const andConditions = [
41
- { typeOf: { $eq: factory.actionType.AcceptAction } },
42
- { 'project.id': { $eq: params.project.id } },
43
- { 'object.typeOf': { $exists: true, $eq: factory.assetTransactionType.Pay } },
44
- { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
45
- ];
46
- let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
47
- if (Array.isArray(inclusion) && inclusion.length > 0) {
48
- positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
49
- }
50
- const projection = {
51
- _id: 0,
52
- id: { $toString: '$_id' },
53
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
54
- };
55
- const query = this.actionModel.find({ $and: andConditions }, projection);
56
- // if (typeof params.limit === 'number' && params.limit > 0) {
57
- // const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
58
- // query.limit(params.limit)
59
- // .skip(params.limit * (page - 1));
41
+ return this.findAnyActions({
42
+ project: { id: { $eq: params.project.id } },
43
+ typeOf: { $eq: factory.actionType.AcceptAction }, // 採用アクション
44
+ purpose: { id: { $in: [params.purpose.id] } },
45
+ object: {
46
+ typeOf: { $eq: factory.assetTransactionType.Pay } // 対象が決済取引
47
+ }
48
+ }, inclusion);
49
+ // const andConditions: FilterQuery<IAcceptPayAction>[] = [
50
+ // { typeOf: { $eq: factory.actionType.AcceptAction } },
51
+ // { 'project.id': { $eq: params.project.id } },
52
+ // { 'object.typeOf': { $exists: true, $eq: factory.assetTransactionType.Pay } },
53
+ // { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
54
+ // ];
55
+ // let positiveProjectionFields: IKeyOfProjection[] = AVAILABLE_PROJECT_FIELDS;
56
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
57
+ // positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
60
58
  // }
61
- // /* istanbul ignore else */
62
- // if (params.sort?.startDate !== undefined) {
63
- // query.sort({ startDate: params.sort.startDate });
64
- // }
65
- // const explainResult = await (<any>query).explain();
66
- // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
67
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
68
- .lean()
69
- .exec();
59
+ // const projection: ProjectionType<IAcceptPayAction> = {
60
+ // _id: 0,
61
+ // id: { $toString: '$_id' },
62
+ // ...Object.fromEntries<1>(positiveProjectionFields.map((key) => ([key, 1])))
63
+ // };
64
+ // const query = this.actionModel.find({ $and: andConditions }, projection);
65
+ // return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
66
+ // .lean<IAcceptPayAction[]>()
67
+ // .exec();
70
68
  }
71
69
  /**
72
70
  * 決済取引番号から完了済の決済採用アクションを参照する
73
71
  */
74
72
  async findCompletedAcceptActionsByTransactionNumber(params, inclusion) {
75
- const andConditions = [
76
- { typeOf: { $eq: factory.actionType.AcceptAction } },
77
- { actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus } },
78
- { 'project.id': { $eq: params.project.id } },
79
- { 'purpose.id': { $exists: true, $eq: params.purpose.id } },
80
- { 'object.typeOf': { $exists: true, $eq: factory.assetTransactionType.Pay } },
81
- { 'object.transactionNumber': { $exists: true, $eq: params.object.transactionNumber } }
82
- ];
83
- let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
84
- if (Array.isArray(inclusion) && inclusion.length > 0) {
85
- positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
86
- }
87
- const projection = {
88
- _id: 0,
89
- id: { $toString: '$_id' },
90
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
91
- };
92
- const query = this.actionModel.find({ $and: andConditions }, projection);
93
- query.limit(1); // ひとまず1つだけでよい
94
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
95
- .lean()
96
- .exec();
73
+ return this.findAnyActions({
74
+ limit: 1, // ひとまず1つだけでよい
75
+ page: 1,
76
+ project: { id: { $eq: params.project.id } },
77
+ typeOf: { $eq: factory.actionType.AcceptAction }, // 採用アクション
78
+ actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
79
+ purpose: { id: { $in: [params.purpose.id] } },
80
+ object: {
81
+ transactionNumber: { $eq: params.object.transactionNumber },
82
+ typeOf: { $eq: factory.assetTransactionType.Pay } // 対象が決済取引
83
+ }
84
+ }, inclusion);
97
85
  }
98
86
  }
99
87
  exports.AcceptPayActionRepo = AcceptPayActionRepo;
@@ -39,6 +39,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
39
39
  protected readonly actionModel: IActionModel;
40
40
  protected readonly actionRecipeModel: IActionRecipeModel;
41
41
  constructor(connection: Connection);
42
+ static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions): any[];
42
43
  /**
43
44
  * アクション開始
44
45
  */
@@ -111,5 +112,34 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
111
112
  };
112
113
  }): Promise<Pick<TAction, 'id' | 'actionStatus' | 'error' | 'purpose'>[]>;
113
114
  private findActionStatusById;
114
- protected upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<import("mongoose").UpdateWriteOpResult>;
115
+ /**
116
+ * 汎用アクション検索
117
+ * 継承クラスから呼ぶ想定
118
+ */
119
+ protected findAnyActions(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<TAction[]>;
120
+ /**
121
+ * 取引に対する汎用アクション検索
122
+ * 継承クラスから呼ぶ想定
123
+ * 件数はlimitされない
124
+ */
125
+ protected findAnyActionsByPurpose<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction>(params: {
126
+ typeOf?: T;
127
+ purpose: {
128
+ typeOf: factory.transactionType;
129
+ id: string;
130
+ };
131
+ object?: {
132
+ typeOf?: {
133
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
134
+ };
135
+ paymentMethodId?: {
136
+ $eq?: string;
137
+ };
138
+ };
139
+ actionStatus?: {
140
+ $eq?: factory.actionStatusType.CompletedActionStatus;
141
+ };
142
+ sort?: factory.action.ISortOrder;
143
+ }): Promise<TAction[]>;
144
+ protected upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<void>;
115
145
  }