@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
@@ -1,5 +1,6 @@
1
1
  import { FilterQuery, UpdateQuery } from 'mongoose';
2
2
  import * as factory from '../factory';
3
+ import type { IDocType } from './mongoose/schemas/action';
3
4
  import { IAction, IKeyOfProjection, ActionProcessRepo, ICancelActionAction, IActionRecipe } from './action/actionProcess';
4
5
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
5
6
  export { ICancelActionAction };
@@ -12,7 +13,6 @@ type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategor
12
13
  * アクションリポジトリ
13
14
  */
14
15
  export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActionType>, IAvailableActionRecipe> {
15
- static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions): any[];
16
16
  /**
17
17
  * アクション検索
18
18
  */
@@ -102,19 +102,19 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
102
102
  }): Promise<{
103
103
  deletedCount?: number;
104
104
  } | null>;
105
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
106
- identifier?: string;
107
- }> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
105
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, IDocType, {}, {}> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
108
106
  identifier?: string;
109
107
  } & {
110
108
  _id: import("mongoose").Types.ObjectId;
111
- }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
112
- identifier?: string;
113
- }> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
109
+ } & {
110
+ __v: number;
111
+ }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, {}, IDocType, {}, {}> & Omit<import("@chevre/factory/lib/action").IAction<import("@chevre/factory/lib/action").IAttributes<factory.actionType, any, any>>, "id"> & {
114
112
  identifier?: string;
115
113
  } & {
116
114
  _id: import("mongoose").Types.ObjectId;
117
- }>>;
115
+ } & {
116
+ __v: number;
117
+ }) | null>;
118
118
  unsetUnnecessaryFields(params: {
119
119
  filter: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>>;
120
120
  $unset: any;
@@ -29,8 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.ActionRepo = void 0;
30
30
  const moment_1 = __importDefault(require("moment"));
31
31
  const factory = __importStar(require("../factory"));
32
- const settings_1 = require("../settings");
33
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
34
32
  // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
35
33
  const actionProcess_1 = require("./action/actionProcess");
36
34
  /**
@@ -43,441 +41,11 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
43
41
  // this.actionModel = connection.model(modelName, createSchema());
44
42
  // this.actionRecipeModel = connection.model(recipeModelName, createRecipeSchema());
45
43
  // }
46
- static CREATE_MONGO_CONDITIONS(params) {
47
- const andConditions = [];
48
- const idIn = params.id?.$in;
49
- if (Array.isArray(idIn)) {
50
- andConditions.push({ _id: { $in: idIn } });
51
- }
52
- const idNin = params.id?.$nin;
53
- if (Array.isArray(idNin)) {
54
- andConditions.push({ _id: { $nin: idNin } });
55
- }
56
- const projectIdEq = params.project?.id?.$eq;
57
- if (typeof projectIdEq === 'string') {
58
- andConditions.push({
59
- 'project.id': {
60
- $eq: projectIdEq
61
- }
62
- });
63
- }
64
- const agentTypeOfIn = params.agent?.typeOf?.$in;
65
- if (Array.isArray(agentTypeOfIn)) {
66
- andConditions.push({
67
- 'agent.typeOf': {
68
- $exists: true,
69
- $in: agentTypeOfIn
70
- }
71
- });
72
- }
73
- const agentIdIn = params.agent?.id?.$in;
74
- if (Array.isArray(agentIdIn)) {
75
- andConditions.push({
76
- 'agent.id': {
77
- $exists: true,
78
- $in: agentIdIn
79
- }
80
- });
81
- }
82
- const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
83
- if (typeof instrumentTransactionNumberEq === 'string') {
84
- andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
85
- }
86
- const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
87
- if (typeof instrumentTypeOfEq === 'string') {
88
- andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
89
- }
90
- const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
91
- if (typeof instrumentIdentifierEq === 'string') {
92
- andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
93
- }
94
- const instrumentIdEq = params.instrument?.id?.$eq;
95
- if (typeof instrumentIdEq === 'string') {
96
- andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
97
- }
98
- const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
99
- if (typeof instrumentOrderNumberEq === 'string') {
100
- andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
101
- }
102
- const locationIdEq = params.location?.id?.$eq;
103
- if (typeof locationIdEq === 'string') {
104
- andConditions.push({
105
- 'location.id': {
106
- $exists: true,
107
- $eq: locationIdEq
108
- }
109
- });
110
- }
111
- const locationIdentifierEq = params.location?.identifier?.$eq;
112
- if (typeof locationIdentifierEq === 'string') {
113
- andConditions.push({
114
- 'location.identifier': {
115
- $exists: true,
116
- $eq: locationIdentifierEq
117
- }
118
- });
119
- }
120
- const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
121
- if (typeof objectMovieTicketsIdentifierEq === 'string') {
122
- andConditions.push({
123
- 'object.movieTickets.identifier': {
124
- $exists: true,
125
- $eq: objectMovieTicketsIdentifierEq
126
- }
127
- });
128
- }
129
- const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
130
- if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
131
- andConditions.push({
132
- 'object.movieTickets.serviceOutput.reservationFor.id': {
133
- $exists: true,
134
- $eq: objectMovieTicketsServiceOutputReservationForIdEq
135
- }
136
- });
137
- }
138
- const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
139
- if (typeof objectPaymentMethodIdEq === 'string') {
140
- andConditions.push({
141
- 'object.paymentMethodId': {
142
- $exists: true,
143
- $eq: objectPaymentMethodIdEq
144
- }
145
- });
146
- }
147
- const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
148
- if (typeof objectObjectPaymentMethodIdEq === 'string') {
149
- andConditions.push({
150
- 'object.object.paymentMethodId': {
151
- $exists: true,
152
- $eq: objectObjectPaymentMethodIdEq
153
- }
154
- });
155
- }
156
- const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
157
- if (typeof objectReservationForIdEq === 'string') {
158
- andConditions.push({
159
- 'object.reservationFor.id': {
160
- $exists: true,
161
- $eq: objectReservationForIdEq
162
- }
163
- });
164
- }
165
- const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
166
- if (typeof objectReservationNumberEq === 'string') {
167
- andConditions.push({
168
- 'object.reservationNumber': {
169
- $exists: true,
170
- $eq: objectReservationNumberEq
171
- }
172
- });
173
- }
174
- const objectReservationNumberIn = params.object?.reservationNumber?.$in;
175
- if (Array.isArray(objectReservationNumberIn)) {
176
- andConditions.push({
177
- 'object.reservationNumber': {
178
- $exists: true,
179
- $in: objectReservationNumberIn
180
- }
181
- });
182
- }
183
- const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
184
- if (typeof objectPaymentMethodAccountIdEq === 'string') {
185
- andConditions.push({
186
- 'object.paymentMethod.accountId': {
187
- $exists: true,
188
- $eq: objectPaymentMethodAccountIdEq
189
- }
190
- });
191
- }
192
- const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
193
- if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
194
- andConditions.push({
195
- 'object.paymentMethod.paymentMethodId': {
196
- $exists: true,
197
- $eq: objectPaymentMethodPaymentMethodIdEq
198
- }
199
- });
200
- }
201
- const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
202
- if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
203
- andConditions.push({
204
- 'object.paymentMethod.paymentMethodId': {
205
- $exists: true,
206
- $in: objectPaymentMethodPaymentMethodIdIn
207
- }
208
- });
209
- }
210
- const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
211
- if (typeof objectPaymentMethodTypeOfEq === 'string') {
212
- andConditions.push({
213
- 'object.paymentMethod.typeOf': {
214
- $exists: true,
215
- $eq: objectPaymentMethodTypeOfEq
216
- }
217
- });
218
- }
219
- const objectTypeOfEq = params.object?.typeOf?.$eq;
220
- if (typeof objectTypeOfEq === 'string') {
221
- andConditions.push({
222
- 'object.typeOf': {
223
- $exists: true,
224
- $eq: objectTypeOfEq
225
- }
226
- });
227
- }
228
- const objectTypeOfIn = params.object?.typeOf?.$in;
229
- if (Array.isArray(objectTypeOfIn)) {
230
- andConditions.push({
231
- 'object.typeOf': {
232
- $exists: true,
233
- $in: objectTypeOfIn
234
- }
235
- });
236
- }
237
- const objectIdEq = params.object?.id?.$eq;
238
- if (typeof objectIdEq === 'string') {
239
- andConditions.push({
240
- 'object.id': {
241
- $exists: true,
242
- $eq: objectIdEq
243
- }
244
- });
245
- }
246
- const objectIdIn = params.object?.id?.$in;
247
- if (Array.isArray(objectIdIn)) {
248
- andConditions.push({
249
- 'object.id': {
250
- $exists: true,
251
- $in: objectIdIn
252
- }
253
- });
254
- }
255
- const objectOrderNumberIn = params.object?.orderNumber?.$in;
256
- if (Array.isArray(objectOrderNumberIn)) {
257
- andConditions.push({
258
- 'object.orderNumber': {
259
- $exists: true,
260
- $in: objectOrderNumberIn
261
- }
262
- });
263
- }
264
- const objectEventIdIn = params.object?.event?.id?.$in;
265
- if (Array.isArray(objectEventIdIn)) {
266
- andConditions.push({
267
- 'object.event.id': {
268
- $exists: true,
269
- $in: objectEventIdIn
270
- }
271
- });
272
- }
273
- // discontinue(2024-06-18~)
274
- // const objectAcceptedOfferSeatNumberIn =
275
- // params.object?.acceptedOffer?.itemOffered?.serviceOutput?.reservedTicket?.ticketedSeat?.seatNumber?.$in;
276
- // if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
277
- // andConditions.push({
278
- // 'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
279
- // $exists: true,
280
- // $in: objectAcceptedOfferSeatNumberIn
281
- // }
282
- // });
283
- // }
284
- const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
285
- if (typeof objectTransactionNumberEq === 'string') {
286
- andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
287
- }
288
- if (typeof params.typeOf === 'string') {
289
- andConditions.push({
290
- typeOf: params.typeOf
291
- });
292
- }
293
- else {
294
- const typeOfEq = params.typeOf?.$eq;
295
- if (typeof typeOfEq === 'string') {
296
- andConditions.push({
297
- typeOf: { $eq: typeOfEq }
298
- });
299
- }
300
- }
301
- const actionStatusIn = params.actionStatus?.$in;
302
- if (Array.isArray(actionStatusIn)) {
303
- andConditions.push({
304
- actionStatus: { $in: actionStatusIn }
305
- });
306
- }
307
- if (Array.isArray(params.actionStatusTypes)) {
308
- andConditions.push({
309
- actionStatus: { $in: params.actionStatusTypes }
310
- });
311
- }
312
- const startDateGte = params.startFrom;
313
- if (startDateGte instanceof Date) {
314
- andConditions.push({
315
- startDate: { $gte: startDateGte }
316
- });
317
- }
318
- const startDateLte = params.startThrough;
319
- if (startDateLte instanceof Date) {
320
- andConditions.push({
321
- startDate: { $lte: startDateLte }
322
- });
323
- }
324
- const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
325
- if (Array.isArray(fromLocationTypeOfIn)) {
326
- andConditions.push({
327
- 'fromLocation.typeOf': {
328
- $exists: true,
329
- $in: fromLocationTypeOfIn
330
- }
331
- });
332
- }
333
- const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
334
- if (Array.isArray(fromLocationAccountNumberIn)) {
335
- andConditions.push({
336
- 'fromLocation.accountNumber': {
337
- $exists: true,
338
- $in: fromLocationAccountNumberIn
339
- }
340
- });
341
- }
342
- const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
343
- if (Array.isArray(fromLocationAccountTypeIn)) {
344
- andConditions.push({
345
- 'fromLocation.accountType': {
346
- $exists: true,
347
- $in: fromLocationAccountTypeIn
348
- }
349
- });
350
- }
351
- const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
352
- if (Array.isArray(toLocationTypeOfIn)) {
353
- andConditions.push({
354
- 'toLocation.typeOf': {
355
- $exists: true,
356
- $in: toLocationTypeOfIn
357
- }
358
- });
359
- }
360
- const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
361
- if (Array.isArray(toLocationAccountNumberIn)) {
362
- andConditions.push({
363
- 'toLocation.accountNumber': {
364
- $exists: true,
365
- $in: toLocationAccountNumberIn
366
- }
367
- });
368
- }
369
- const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
370
- if (Array.isArray(toLocationAccountTypeIn)) {
371
- andConditions.push({
372
- 'toLocation.accountType': {
373
- $exists: true,
374
- $in: toLocationAccountTypeIn
375
- }
376
- });
377
- }
378
- const purposeTypeOfIn = params.purpose?.typeOf?.$in;
379
- if (Array.isArray(purposeTypeOfIn)) {
380
- andConditions.push({
381
- 'purpose.typeOf': {
382
- $exists: true,
383
- $in: purposeTypeOfIn
384
- }
385
- });
386
- }
387
- const purposeIdIn = params.purpose?.id?.$in;
388
- if (Array.isArray(purposeIdIn)) {
389
- andConditions.push({
390
- 'purpose.id': {
391
- $exists: true,
392
- $in: purposeIdIn
393
- }
394
- });
395
- }
396
- const purposeOrderNumberIn = params.purpose?.orderNumber?.$in;
397
- if (Array.isArray(purposeOrderNumberIn)) {
398
- andConditions.push({
399
- 'purpose.orderNumber': {
400
- $exists: true,
401
- $in: purposeOrderNumberIn
402
- }
403
- });
404
- }
405
- const resultTypeOfIn = params.result?.typeOf?.$in;
406
- if (Array.isArray(resultTypeOfIn)) {
407
- andConditions.push({
408
- 'result.typeOf': {
409
- $exists: true,
410
- $in: resultTypeOfIn
411
- }
412
- });
413
- }
414
- const resultIdIn = params.result?.id?.$in;
415
- if (Array.isArray(resultIdIn)) {
416
- andConditions.push({
417
- 'result.id': {
418
- $exists: true,
419
- $in: resultIdIn
420
- }
421
- });
422
- }
423
- const resultOrderNumberIn = params.result?.orderNumber?.$in;
424
- if (Array.isArray(resultOrderNumberIn)) {
425
- andConditions.push({
426
- 'result.orderNumber': {
427
- $exists: true,
428
- $in: resultOrderNumberIn
429
- }
430
- });
431
- }
432
- const resultCodeIn = params.result?.code?.$in;
433
- if (Array.isArray(resultCodeIn)) {
434
- andConditions.push({
435
- 'result.code': {
436
- $exists: true,
437
- $in: resultCodeIn
438
- }
439
- });
440
- }
441
- // sameAs(2024-04-23~)
442
- const sameAsIdEq = params.sameAs?.id?.$eq;
443
- if (typeof sameAsIdEq === 'string') {
444
- andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
445
- }
446
- const aboutOrderNumberEq = params.about?.orderNumber?.$eq;
447
- if (typeof aboutOrderNumberEq === 'string') {
448
- andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
449
- }
450
- return andConditions;
451
- }
452
44
  /**
453
45
  * アクション検索
454
46
  */
455
47
  async search(params, inclusion) {
456
- const conditions = ActionRepo.CREATE_MONGO_CONDITIONS(params);
457
- let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
458
- if (Array.isArray(inclusion) && inclusion.length > 0) {
459
- positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
460
- }
461
- const projection = {
462
- _id: 0,
463
- id: { $toString: '$_id' },
464
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
465
- };
466
- const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
467
- if (typeof params.limit === 'number' && params.limit > 0) {
468
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
469
- query.limit(params.limit)
470
- .skip(params.limit * (page - 1));
471
- }
472
- /* istanbul ignore else */
473
- if (params.sort?.startDate !== undefined) {
474
- query.sort({ startDate: params.sort.startDate });
475
- }
476
- // const explainResult = await (<any>query).explain();
477
- // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
478
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
479
- .lean() // 2024-08-26~
480
- .exec();
48
+ return (this.findAnyActions(params, inclusion));
481
49
  }
482
50
  // /**
483
51
  // * アクション開始
@@ -729,83 +297,7 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
729
297
  * 取引に対するアクションを検索する
730
298
  */
731
299
  async searchByPurpose(params) {
732
- const andConditions = [
733
- { 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf } },
734
- { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
735
- ];
736
- // const idNin = params.id?.$nin;
737
- // if (Array.isArray(idNin)) {
738
- // andConditions.push({ _id: { $nin: idNin } });
739
- // }
740
- const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
741
- if (typeof objectPaymentMethodIdEq === 'string') {
742
- andConditions.push({ 'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq } });
743
- }
744
- const objectTypeOfEq = params.object?.typeOf?.$eq;
745
- if (typeof objectTypeOfEq === 'string') {
746
- andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
747
- }
748
- if (typeof params.typeOf === 'string') {
749
- andConditions.push({ typeOf: { $eq: params.typeOf } });
750
- }
751
- const actionStatusEq = params.actionStatus?.$eq;
752
- if (typeof actionStatusEq === 'string') {
753
- andConditions.push({ actionStatus: { $eq: actionStatusEq } });
754
- }
755
- const positiveProjectionFields = [
756
- 'project',
757
- 'actionStatus',
758
- 'typeOf',
759
- 'description',
760
- 'agent',
761
- 'recipient',
762
- 'result',
763
- 'error',
764
- 'object',
765
- 'startDate',
766
- 'endDate',
767
- 'purpose',
768
- 'potentialActions',
769
- 'instrument',
770
- 'location',
771
- 'sameAs',
772
- 'cancelAction',
773
- 'identifier'
774
- ];
775
- const projection = {
776
- _id: 0,
777
- id: { $toString: '$_id' },
778
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
779
- };
780
- const query = this.actionModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
781
- if (typeof params.sort?.startDate === 'number') {
782
- query.sort({ startDate: params.sort.startDate });
783
- }
784
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
785
- .lean()
786
- .exec();
787
- // return <Promise<IAction4transaction<T>[]>><Promise<unknown[]>>this.search<T>(
788
- // {
789
- // purpose: {
790
- // id: { $in: [params.purpose.id] },
791
- // typeOf: { $in: [params.purpose.typeOf] }
792
- // },
793
- // object: {
794
- // ...(typeof params.object?.typeOf?.$eq === 'string')
795
- // ? { typeOf: { $eq: params.object.typeOf.$eq } }
796
- // : undefined,
797
- // ...(typeof params.object?.paymentMethodId?.$eq === 'string')
798
- // ? { paymentMethodId: { $eq: params.object.paymentMethodId.$eq } }
799
- // : undefined
800
- // },
801
- // ...(typeof params.actionStatus?.$eq === 'string') ? { actionStatus: { $in: [params.actionStatus.$eq] } } : undefined,
802
- // ...(typeof params.typeOf === 'string') ? { typeOf: { $eq: params.typeOf } } : undefined,
803
- // ...(Array.isArray(params.id?.$nin)) ? { id: { $nin: params.id?.$nin } } : undefined,
804
- // ...(typeof params.sort?.startDate === 'number') ? { sort: params.sort } : undefined
805
- // },
806
- // [],
807
- // []
808
- // );
300
+ return (this.findAnyActionsByPurpose(params));
809
301
  }
810
302
  /**
811
303
  * 注文番号から、注文に対するアクションを検索する
@@ -59,11 +59,15 @@ export declare class AggregateOfferRepo {
59
59
  };
60
60
  id: string;
61
61
  }): Promise<void>;
62
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<Document<unknown, {}, IAggregateOfferDocType> & IAggregateOfferDocType & Required<{
62
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<Document<unknown, {}, IAggregateOfferDocType, {}, {}> & IAggregateOfferDocType & Required<{
63
63
  _id: string;
64
- }>, import("mongoose").QueryOptions<Document<unknown, {}, IAggregateOfferDocType> & IAggregateOfferDocType & Required<{
64
+ }> & {
65
+ __v: number;
66
+ }, import("mongoose").QueryOptions<IAggregateOfferDocType>, (Document<unknown, {}, IAggregateOfferDocType, {}, {}> & IAggregateOfferDocType & Required<{
65
67
  _id: string;
66
- }>>>;
68
+ }> & {
69
+ __v: number;
70
+ }) | null>;
67
71
  unsetUnnecessaryFields(params: {
68
72
  filter: FilterQuery<factory.aggregateOffer.IAggregateOffer>;
69
73
  $unset: any;