@chevre/domain 21.13.0-alpha.1 → 21.13.0-alpha.3

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 (66) hide show
  1. package/example/src/chevre/searchEvents.ts +4 -1
  2. package/example/src/chevre/task/executeTasks.ts +1 -1
  3. package/example/src/chevre/transaction/findPaymentCardPermit.ts +2 -2
  4. package/example/src/chevre/transaction/processReturnOrder.ts +1 -1
  5. package/lib/chevre/errorHandler.d.ts +2 -2
  6. package/lib/chevre/errorHandler.js +38 -19
  7. package/lib/chevre/factory/transaction.d.ts +42 -0
  8. package/lib/chevre/factory/transaction.js +2 -0
  9. package/lib/chevre/index.d.ts +5 -4
  10. package/lib/chevre/index.js +31 -11
  11. package/lib/chevre/repo/account.d.ts +1 -1
  12. package/lib/chevre/repo/accountTitle.d.ts +1 -1
  13. package/lib/chevre/repo/accountTransaction.d.ts +1 -1
  14. package/lib/chevre/repo/accountingReport.d.ts +1 -1
  15. package/lib/chevre/repo/accountingReport.js +1 -1
  16. package/lib/chevre/repo/action.d.ts +1 -1
  17. package/lib/chevre/repo/additionalProperty.d.ts +1 -1
  18. package/lib/chevre/repo/aggregateOffer.d.ts +1 -1
  19. package/lib/chevre/repo/aggregation.d.ts +1 -1
  20. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  21. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  22. package/lib/chevre/repo/code.d.ts +1 -1
  23. package/lib/chevre/repo/comment.d.ts +1 -1
  24. package/lib/chevre/repo/creativeWork.d.ts +1 -1
  25. package/lib/chevre/repo/customer.d.ts +1 -1
  26. package/lib/chevre/repo/emailMessage.d.ts +1 -1
  27. package/lib/chevre/repo/event.js +2 -2
  28. package/lib/chevre/repo/member.d.ts +1 -1
  29. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -1
  30. package/lib/chevre/repo/mongoose/writeConcern.d.ts +1 -1
  31. package/lib/chevre/repo/offerItemCondition.d.ts +1 -1
  32. package/lib/chevre/repo/order.d.ts +1 -1
  33. package/lib/chevre/repo/order.js +1 -1
  34. package/lib/chevre/repo/ownershipInfo.d.ts +1 -1
  35. package/lib/chevre/repo/ownershipInfo.js +1 -1
  36. package/lib/chevre/repo/permit.d.ts +1 -1
  37. package/lib/chevre/repo/place.d.ts +1 -1
  38. package/lib/chevre/repo/priceSpecification.d.ts +1 -1
  39. package/lib/chevre/repo/product.d.ts +1 -1
  40. package/lib/chevre/repo/project.d.ts +1 -1
  41. package/lib/chevre/repo/reservation.d.ts +1 -1
  42. package/lib/chevre/repo/role.d.ts +1 -1
  43. package/lib/chevre/repo/serviceOutput.d.ts +1 -1
  44. package/lib/chevre/repo/stockHolder.d.ts +2 -2
  45. package/lib/chevre/repo/task.d.ts +1 -1
  46. package/lib/chevre/repo/telemetry.d.ts +1 -1
  47. package/lib/chevre/repo/transaction.d.ts +1 -1
  48. package/lib/chevre/repo/trip.d.ts +1 -1
  49. package/lib/chevre/repository.d.ts +36 -27
  50. package/lib/chevre/repository.js +117 -48
  51. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
  52. package/lib/chevre/service/task.d.ts +2 -2
  53. package/lib/chevre/service/task.js +9 -3
  54. package/lib/chevre/service/transaction/moneyTransfer.d.ts +2 -4
  55. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +5 -32
  56. package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
  57. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  58. package/lib/chevre/service/transaction/validation.d.ts +1 -3
  59. package/lib/chevre/service.d.ts +75 -39
  60. package/lib/chevre/service.js +258 -39
  61. package/package.json +1 -1
  62. package/example/src/chevre/searchSendEmailActions.ts +0 -44
  63. package/example/src/chevre/searchTasks.ts +0 -31
  64. package/example/src/chevre/searchTransactions.ts +0 -25
  65. package/example/src/chevre/sendEmailMessage.ts +0 -80
  66. package/example/src/chevre/syncCatalogs2aggregateOffers.ts +0 -87
@@ -33,23 +33,23 @@ import type { MongoRepository as PriceSpecificationRepo } from './repo/priceSpec
33
33
  import type { MongoRepository as ProductRepo } from './repo/product';
34
34
  import type { MongoRepository as ProductOfferRepo } from './repo/productOffer';
35
35
  import type { MongoRepository as ProjectRepo } from './repo/project';
36
- import { RedisRepository as OfferRateLimitRepo } from './repo/rateLimit/offer';
36
+ import type { RedisRepository as OfferRateLimitRepo } from './repo/rateLimit/offer';
37
37
  import type { MongoRepository as ReservationRepo } from './repo/reservation';
38
38
  import type { MongoRepository as RoleRepo } from './repo/role';
39
39
  import type { MongoRepository as SellerRepo } from './repo/seller';
40
40
  import type { MongoRepository as ServiceOutputRepo } from './repo/serviceOutput';
41
- import { RedisRepository as ServiceOutputIdentifierRepo } from './repo/serviceOutputIdentifier';
42
- import { StockHolderRepository as StockHolderRepo } from './repo/stockHolder';
41
+ import type { RedisRepository as ServiceOutputIdentifierRepo } from './repo/serviceOutputIdentifier';
42
+ import type { StockHolderRepository as StockHolderRepo } from './repo/stockHolder';
43
43
  import type { MongoRepository as TaskRepo } from './repo/task';
44
44
  import type { MongoRepository as TelemetryRepo } from './repo/telemetry';
45
45
  import type { MongoRepository as TransactionRepo } from './repo/transaction';
46
- import { RedisRepository as TransactionNumberRepo } from './repo/transactionNumber';
46
+ import type { RedisRepository as TransactionNumberRepo } from './repo/transactionNumber';
47
47
  import type { MongoRepository as TripRepo } from './repo/trip';
48
- import { RedisRepository as RegisterServiceActionInProgress } from './repo/action/registerServiceInProgress';
49
- import { RedisRepository as ConfirmationNumberRepo } from './repo/confirmationNumber';
50
- import { RedisRepository as OrderNumberRepo } from './repo/orderNumber';
51
- import { GMORepository as CreditCardRepo } from './repo/paymentMethod/creditCard';
52
- import { CognitoRepository as PersonRepo } from './repo/person';
48
+ import type { RedisRepository as RegisterServiceActionInProgress } from './repo/action/registerServiceInProgress';
49
+ import type { RedisRepository as ConfirmationNumberRepo } from './repo/confirmationNumber';
50
+ import type { RedisRepository as OrderNumberRepo } from './repo/orderNumber';
51
+ import type { GMORepository as CreditCardRepo } from './repo/paymentMethod/creditCard';
52
+ import type { CognitoRepository as PersonRepo } from './repo/person';
53
53
  export type Account = AccountRepo;
54
54
  export declare namespace Account {
55
55
  function createInstance(...params: ConstructorParameters<typeof AccountRepo>): Promise<AccountRepo>;
@@ -83,7 +83,9 @@ export declare namespace Aggregation {
83
83
  function createInstance(...params: ConstructorParameters<typeof AggregationRepo>): Promise<AggregationRepo>;
84
84
  }
85
85
  export declare namespace action {
86
- class RegisterServiceInProgress extends RegisterServiceActionInProgress {
86
+ type RegisterServiceInProgress = RegisterServiceActionInProgress;
87
+ namespace RegisterServiceInProgress {
88
+ function createInstance(...params: ConstructorParameters<typeof RegisterServiceActionInProgress>): Promise<RegisterServiceActionInProgress>;
87
89
  }
88
90
  }
89
91
  export type AssetTransaction = AssetTransactionRepo;
@@ -102,10 +104,9 @@ export type Comment = CommentRepo;
102
104
  export declare namespace Comment {
103
105
  function createInstance(...params: ConstructorParameters<typeof CommentRepo>): Promise<CommentRepo>;
104
106
  }
105
- /**
106
- * 確認番号リポジトリ
107
- */
108
- export declare class ConfirmationNumber extends ConfirmationNumberRepo {
107
+ export type ConfirmationNumber = ConfirmationNumberRepo;
108
+ export declare namespace ConfirmationNumber {
109
+ function createInstance(...params: ConstructorParameters<typeof ConfirmationNumberRepo>): Promise<ConfirmationNumberRepo>;
109
110
  }
110
111
  export type CreativeWork = CreativeWorkRepo;
111
112
  export declare namespace CreativeWork {
@@ -151,10 +152,9 @@ export type Order = OrderRepo;
151
152
  export declare namespace Order {
152
153
  function createInstance(...params: ConstructorParameters<typeof OrderRepo>): Promise<OrderRepo>;
153
154
  }
154
- /**
155
- * 注文番号リポジトリ
156
- */
157
- export declare class OrderNumber extends OrderNumberRepo {
155
+ export type OrderNumber = OrderNumberRepo;
156
+ export declare namespace OrderNumber {
157
+ function createInstance(...params: ConstructorParameters<typeof OrderNumberRepo>): Promise<OrderNumberRepo>;
158
158
  }
159
159
  export type OwnershipInfo = OwnershipInfoRepo;
160
160
  export declare namespace OwnershipInfo {
@@ -168,13 +168,14 @@ export declare namespace paymentMethod {
168
168
  /**
169
169
  * クレジットカードリポジトリ
170
170
  */
171
- class CreditCard extends CreditCardRepo {
171
+ type CreditCard = CreditCardRepo;
172
+ namespace CreditCard {
173
+ function createInstance(...params: ConstructorParameters<typeof CreditCardRepo>): Promise<CreditCardRepo>;
172
174
  }
173
175
  }
174
- /**
175
- * 会員リポジトリ
176
- */
177
- export declare class Person extends PersonRepo {
176
+ export type Person = PersonRepo;
177
+ export declare namespace Person {
178
+ function createInstance(...params: ConstructorParameters<typeof PersonRepo>): Promise<PersonRepo>;
178
179
  }
179
180
  export type Permit = PermitRepo;
180
181
  export declare namespace Permit {
@@ -222,9 +223,13 @@ export type ServiceOutput = ServiceOutputRepo;
222
223
  export declare namespace ServiceOutput {
223
224
  function createInstance(...params: ConstructorParameters<typeof ServiceOutputRepo>): Promise<ServiceOutputRepo>;
224
225
  }
225
- export declare class ServiceOutputIdentifier extends ServiceOutputIdentifierRepo {
226
+ export type ServiceOutputIdentifier = ServiceOutputIdentifierRepo;
227
+ export declare namespace ServiceOutputIdentifier {
228
+ function createInstance(...params: ConstructorParameters<typeof ServiceOutputIdentifierRepo>): Promise<ServiceOutputIdentifierRepo>;
226
229
  }
227
- export declare class StockHolder extends StockHolderRepo {
230
+ export type StockHolder = StockHolderRepo;
231
+ export declare namespace StockHolder {
232
+ function createInstance(...params: ConstructorParameters<typeof StockHolderRepo>): Promise<StockHolderRepo>;
228
233
  }
229
234
  export type Task = TaskRepo;
230
235
  export declare namespace Task {
@@ -238,13 +243,17 @@ export type Transaction = TransactionRepo;
238
243
  export declare namespace Transaction {
239
244
  function createInstance(...params: ConstructorParameters<typeof TransactionRepo>): Promise<TransactionRepo>;
240
245
  }
241
- export declare class TransactionNumber extends TransactionNumberRepo {
246
+ export type TransactionNumber = TransactionNumberRepo;
247
+ export declare namespace TransactionNumber {
248
+ function createInstance(...params: ConstructorParameters<typeof TransactionNumberRepo>): Promise<TransactionNumberRepo>;
242
249
  }
243
250
  export type Trip = TripRepo;
244
251
  export declare namespace Trip {
245
252
  function createInstance(...params: ConstructorParameters<typeof TripRepo>): Promise<TripRepo>;
246
253
  }
247
254
  export declare namespace rateLimit {
248
- class Offer extends OfferRateLimitRepo {
255
+ type Offer = OfferRateLimitRepo;
256
+ namespace Offer {
257
+ function createInstance(...params: ConstructorParameters<typeof OfferRateLimitRepo>): Promise<OfferRateLimitRepo>;
249
258
  }
250
259
  }
@@ -10,15 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.ProductOffer = exports.Product = exports.PriceSpecification = exports.place = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
13
- const offer_1 = require("./repo/rateLimit/offer");
14
- const serviceOutputIdentifier_1 = require("./repo/serviceOutputIdentifier");
15
- const stockHolder_1 = require("./repo/stockHolder");
16
- const transactionNumber_1 = require("./repo/transactionNumber");
17
- const registerServiceInProgress_1 = require("./repo/action/registerServiceInProgress");
18
- const confirmationNumber_1 = require("./repo/confirmationNumber");
19
- const orderNumber_1 = require("./repo/orderNumber");
20
- const creditCard_1 = require("./repo/paymentMethod/creditCard");
21
- const person_1 = require("./repo/person");
22
13
  var Account;
23
14
  (function (Account) {
24
15
  let repo;
@@ -125,9 +116,19 @@ var Aggregation;
125
116
  })(Aggregation = exports.Aggregation || (exports.Aggregation = {}));
126
117
  var action;
127
118
  (function (action) {
128
- class RegisterServiceInProgress extends registerServiceInProgress_1.RedisRepository {
129
- }
130
- action.RegisterServiceInProgress = RegisterServiceInProgress;
119
+ let RegisterServiceInProgress;
120
+ (function (RegisterServiceInProgress) {
121
+ let repo;
122
+ function createInstance(...params) {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ if (repo === undefined) {
125
+ repo = (yield Promise.resolve().then(() => require('./repo/action/registerServiceInProgress'))).RedisRepository;
126
+ }
127
+ return new repo(...params);
128
+ });
129
+ }
130
+ RegisterServiceInProgress.createInstance = createInstance;
131
+ })(RegisterServiceInProgress = action.RegisterServiceInProgress || (action.RegisterServiceInProgress = {}));
131
132
  })(action = exports.action || (exports.action = {}));
132
133
  var AssetTransaction;
133
134
  (function (AssetTransaction) {
@@ -181,12 +182,19 @@ var Comment;
181
182
  }
182
183
  Comment.createInstance = createInstance;
183
184
  })(Comment = exports.Comment || (exports.Comment = {}));
184
- /**
185
- * 確認番号リポジトリ
186
- */
187
- class ConfirmationNumber extends confirmationNumber_1.RedisRepository {
188
- }
189
- exports.ConfirmationNumber = ConfirmationNumber;
185
+ var ConfirmationNumber;
186
+ (function (ConfirmationNumber) {
187
+ let repo;
188
+ function createInstance(...params) {
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ if (repo === undefined) {
191
+ repo = (yield Promise.resolve().then(() => require('./repo/confirmationNumber'))).RedisRepository;
192
+ }
193
+ return new repo(...params);
194
+ });
195
+ }
196
+ ConfirmationNumber.createInstance = createInstance;
197
+ })(ConfirmationNumber = exports.ConfirmationNumber || (exports.ConfirmationNumber = {}));
190
198
  var CreativeWork;
191
199
  (function (CreativeWork) {
192
200
  let repo;
@@ -330,12 +338,19 @@ var Order;
330
338
  }
331
339
  Order.createInstance = createInstance;
332
340
  })(Order = exports.Order || (exports.Order = {}));
333
- /**
334
- * 注文番号リポジトリ
335
- */
336
- class OrderNumber extends orderNumber_1.RedisRepository {
337
- }
338
- exports.OrderNumber = OrderNumber;
341
+ var OrderNumber;
342
+ (function (OrderNumber) {
343
+ let repo;
344
+ function createInstance(...params) {
345
+ return __awaiter(this, void 0, void 0, function* () {
346
+ if (repo === undefined) {
347
+ repo = (yield Promise.resolve().then(() => require('./repo/orderNumber'))).RedisRepository;
348
+ }
349
+ return new repo(...params);
350
+ });
351
+ }
352
+ OrderNumber.createInstance = createInstance;
353
+ })(OrderNumber = exports.OrderNumber || (exports.OrderNumber = {}));
339
354
  var OwnershipInfo;
340
355
  (function (OwnershipInfo) {
341
356
  let repo;
@@ -364,19 +379,33 @@ var PaymentServiceProvider;
364
379
  })(PaymentServiceProvider = exports.PaymentServiceProvider || (exports.PaymentServiceProvider = {}));
365
380
  var paymentMethod;
366
381
  (function (paymentMethod) {
367
- /**
368
- * クレジットカードリポジトリ
369
- */
370
- class CreditCard extends creditCard_1.GMORepository {
371
- }
372
- paymentMethod.CreditCard = CreditCard;
382
+ let CreditCard;
383
+ (function (CreditCard) {
384
+ let repo;
385
+ function createInstance(...params) {
386
+ return __awaiter(this, void 0, void 0, function* () {
387
+ if (repo === undefined) {
388
+ repo = (yield Promise.resolve().then(() => require('./repo/paymentMethod/creditCard'))).GMORepository;
389
+ }
390
+ return new repo(...params);
391
+ });
392
+ }
393
+ CreditCard.createInstance = createInstance;
394
+ })(CreditCard = paymentMethod.CreditCard || (paymentMethod.CreditCard = {}));
373
395
  })(paymentMethod = exports.paymentMethod || (exports.paymentMethod = {}));
374
- /**
375
- * 会員リポジトリ
376
- */
377
- class Person extends person_1.CognitoRepository {
378
- }
379
- exports.Person = Person;
396
+ var Person;
397
+ (function (Person) {
398
+ let repo;
399
+ function createInstance(...params) {
400
+ return __awaiter(this, void 0, void 0, function* () {
401
+ if (repo === undefined) {
402
+ repo = (yield Promise.resolve().then(() => require('./repo/person'))).CognitoRepository;
403
+ }
404
+ return new repo(...params);
405
+ });
406
+ }
407
+ Person.createInstance = createInstance;
408
+ })(Person = exports.Person || (exports.Person = {}));
380
409
  var Permit;
381
410
  (function (Permit) {
382
411
  let repo;
@@ -523,12 +552,32 @@ var ServiceOutput;
523
552
  }
524
553
  ServiceOutput.createInstance = createInstance;
525
554
  })(ServiceOutput = exports.ServiceOutput || (exports.ServiceOutput = {}));
526
- class ServiceOutputIdentifier extends serviceOutputIdentifier_1.RedisRepository {
527
- }
528
- exports.ServiceOutputIdentifier = ServiceOutputIdentifier;
529
- class StockHolder extends stockHolder_1.StockHolderRepository {
530
- }
531
- exports.StockHolder = StockHolder;
555
+ var ServiceOutputIdentifier;
556
+ (function (ServiceOutputIdentifier) {
557
+ let repo;
558
+ function createInstance(...params) {
559
+ return __awaiter(this, void 0, void 0, function* () {
560
+ if (repo === undefined) {
561
+ repo = (yield Promise.resolve().then(() => require('./repo/serviceOutputIdentifier'))).RedisRepository;
562
+ }
563
+ return new repo(...params);
564
+ });
565
+ }
566
+ ServiceOutputIdentifier.createInstance = createInstance;
567
+ })(ServiceOutputIdentifier = exports.ServiceOutputIdentifier || (exports.ServiceOutputIdentifier = {}));
568
+ var StockHolder;
569
+ (function (StockHolder) {
570
+ let repo;
571
+ function createInstance(...params) {
572
+ return __awaiter(this, void 0, void 0, function* () {
573
+ if (repo === undefined) {
574
+ repo = (yield Promise.resolve().then(() => require('./repo/stockHolder'))).StockHolderRepository;
575
+ }
576
+ return new repo(...params);
577
+ });
578
+ }
579
+ StockHolder.createInstance = createInstance;
580
+ })(StockHolder = exports.StockHolder || (exports.StockHolder = {}));
532
581
  var Task;
533
582
  (function (Task) {
534
583
  let repo;
@@ -568,9 +617,19 @@ var Transaction;
568
617
  }
569
618
  Transaction.createInstance = createInstance;
570
619
  })(Transaction = exports.Transaction || (exports.Transaction = {}));
571
- class TransactionNumber extends transactionNumber_1.RedisRepository {
572
- }
573
- exports.TransactionNumber = TransactionNumber;
620
+ var TransactionNumber;
621
+ (function (TransactionNumber) {
622
+ let repo;
623
+ function createInstance(...params) {
624
+ return __awaiter(this, void 0, void 0, function* () {
625
+ if (repo === undefined) {
626
+ repo = (yield Promise.resolve().then(() => require('./repo/transactionNumber'))).RedisRepository;
627
+ }
628
+ return new repo(...params);
629
+ });
630
+ }
631
+ TransactionNumber.createInstance = createInstance;
632
+ })(TransactionNumber = exports.TransactionNumber || (exports.TransactionNumber = {}));
574
633
  var Trip;
575
634
  (function (Trip) {
576
635
  let repo;
@@ -587,7 +646,17 @@ var Trip;
587
646
  var rateLimit;
588
647
  (function (rateLimit) {
589
648
  // tslint:disable-next-line:no-shadowed-variable
590
- class Offer extends offer_1.RedisRepository {
591
- }
592
- rateLimit.Offer = Offer;
649
+ let Offer;
650
+ (function (Offer) {
651
+ let repo;
652
+ function createInstance(...params) {
653
+ return __awaiter(this, void 0, void 0, function* () {
654
+ if (repo === undefined) {
655
+ repo = (yield Promise.resolve().then(() => require('./repo/rateLimit/offer'))).RedisRepository;
656
+ }
657
+ return new repo(...params);
658
+ });
659
+ }
660
+ Offer.createInstance = createInstance;
661
+ })(Offer = rateLimit.Offer || (rateLimit.Offer = {}));
593
662
  })(rateLimit = exports.rateLimit || (exports.rateLimit = {}));
@@ -13,7 +13,7 @@ exports.exportTasksById = exports.startAndConfirm = exports.confirm = exports.st
13
13
  /**
14
14
  * 予約取消取引サービス
15
15
  */
16
- const mongoose = require("mongoose");
16
+ const mongoose_1 = require("mongoose");
17
17
  const factory = require("../../factory");
18
18
  const factory_1 = require("./cancelReservation/factory");
19
19
  function validateStartParams(params) {
@@ -153,7 +153,7 @@ function startAndConfirm(params) {
153
153
  transaction: reserveTransaction,
154
154
  reservations: reservations
155
155
  });
156
- const transactionId = new mongoose.Types.ObjectId().toHexString();
156
+ const transactionId = new mongoose_1.Types.ObjectId().toHexString();
157
157
  const transaction = Object.assign(Object.assign({}, startParams), { id: transactionId, startDate: new Date(), status: factory.transactionStatusType.InProgress, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported });
158
158
  // 事前に取引IDだけ発行
159
159
  const potentialActions = (0, factory_1.createPotentialActions)({
@@ -1,5 +1,5 @@
1
- import { Connection } from 'mongoose';
2
- import { RedisClientType } from 'redis';
1
+ import type { Connection } from 'mongoose';
2
+ import type { RedisClientType } from 'redis';
3
3
  import * as factory from '../factory';
4
4
  import type { MongoRepository as TaskRepo } from '../repo/task';
5
5
  export interface IConnectionSettings {
@@ -15,7 +15,6 @@ exports.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = e
15
15
  */
16
16
  const createDebug = require("debug");
17
17
  const factory = require("../factory");
18
- const NotificationService = require("./notification");
19
18
  const factory_1 = require("./notification/factory");
20
19
  const credentials_1 = require("../credentials");
21
20
  const settings_1 = require("../settings");
@@ -122,6 +121,7 @@ function retry(params) {
122
121
  });
123
122
  }
124
123
  exports.retry = retry;
124
+ let notification;
125
125
  /**
126
126
  * トライ可能回数が0に達したタスクを実行中止する
127
127
  */
@@ -138,9 +138,12 @@ function abort(params) {
138
138
  if (settings_1.ABORTED_TASKS_WITHOUT_REPORT.includes(abortedTask.name)) {
139
139
  return;
140
140
  }
141
+ if (notification === undefined) {
142
+ notification = yield Promise.resolve().then(() => require('./notification'));
143
+ }
141
144
  // 開発者へ報告
142
145
  const message = (0, factory_1.task2lineNotify)({ task: abortedTask });
143
- yield NotificationService.report2developers(message.subject, message.content)({
146
+ yield notification.report2developers(message.subject, message.content)({
144
147
  accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
145
148
  });
146
149
  }
@@ -157,9 +160,12 @@ function notifyAbortedTasks(params) {
157
160
  // return !ABORTED_TASKS_WITHOUT_REPORT.includes(task.name);
158
161
  // });
159
162
  if (abortedTasks.length > 0) {
163
+ if (notification === undefined) {
164
+ notification = yield Promise.resolve().then(() => require('./notification'));
165
+ }
160
166
  // 開発者へ報告
161
167
  const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
162
- yield NotificationService.report2developers(message.subject, message.content)({
168
+ yield notification.report2developers(message.subject, message.content)({
163
169
  accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
164
170
  });
165
171
  }
@@ -8,7 +8,7 @@ import type { MongoRepository as SellerRepo } from '../../repo/seller';
8
8
  import type { MongoRepository as TaskRepo } from '../../repo/task';
9
9
  import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
10
10
  import type { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
11
- import { IPassportValidator as IWaiterPassportValidator } from './validation';
11
+ import { IPassportValidator as IWaiterPassportValidator, moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
12
12
  export interface IStartOperationRepos {
13
13
  action: ActionRepo;
14
14
  order: OrderRepo;
@@ -29,9 +29,7 @@ export type IConfirmOperation<T> = (repos: {
29
29
  transaction: TransactionRepo;
30
30
  }) => Promise<T>;
31
31
  export type IPassportValidator = IWaiterPassportValidator;
32
- export type IStartParams = factory.transaction.moneyTransfer.IStartParamsWithoutDetail & {
33
- passportValidator?: IPassportValidator;
34
- };
32
+ export type IStartParams = MoneyTransferFactory.IStartParams;
35
33
  /**
36
34
  * 取引開始
37
35
  * 通貨転送資産取引サービスを利用して転送取引を開始する
@@ -6,7 +6,7 @@ import type { RedisRepository as OrderNumberRepo } from '../../repo/orderNumber'
6
6
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
7
7
  import type { MongoRepository as SellerRepo } from '../../repo/seller';
8
8
  import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
9
- import { IPassportValidator as IWaiterPassportValidator } from './validation';
9
+ import { IPassportValidator as IWaiterPassportValidator, placeOrder as PlaceOrderFactory } from '../../factory/transaction';
10
10
  export declare const POINT_AWARD_IDENTIFIER_NAME = "pointAwardIdentifiers";
11
11
  export interface IStartOperationRepos {
12
12
  seller: SellerRepo;
@@ -23,41 +23,14 @@ export interface IConfirmOperationRepos {
23
23
  }
24
24
  export type IConfirmOperation<T> = (repos: IConfirmOperationRepos) => Promise<T>;
25
25
  export type IPassportValidator = IWaiterPassportValidator;
26
- export type IStartParams = factory.transaction.placeOrder.IStartParamsWithoutDetail & {
27
- passportValidator?: IPassportValidator;
28
- broker?: factory.order.IBroker;
29
- validateSeller?: boolean;
30
- };
26
+ export type IStartParams = PlaceOrderFactory.IStartParams;
31
27
  /**
32
28
  * 取引開始
33
29
  */
34
30
  export declare function start(params: IStartParams): IStartOperation<factory.transaction.placeOrder.ITransaction>;
35
- export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
36
- export type IResultOrderParams = factory.transaction.placeOrder.IResultOrderParams & {
37
- /**
38
- * 注文日時
39
- */
40
- orderDate: Date;
41
- /**
42
- * 注文確認URLのカスタム指定
43
- */
44
- url?: string | IOrderURLGenerator;
45
- /**
46
- * 注文アイテム数
47
- */
48
- numItems?: {
49
- maxValue?: number;
50
- minValue?: number;
51
- };
52
- };
53
- export type IConfirmParams = factory.transaction.placeOrder.IConfirmParams & {
54
- project: {
55
- id: string;
56
- };
57
- result: {
58
- order: IResultOrderParams;
59
- };
60
- };
31
+ export type IOrderURLGenerator = PlaceOrderFactory.IOrderURLGenerator;
32
+ export type IResultOrderParams = PlaceOrderFactory.IResultOrderParams;
33
+ export type IConfirmParams = PlaceOrderFactory.IConfirmParams;
61
34
  /**
62
35
  * 注文取引を確定する
63
36
  */
@@ -64,7 +64,7 @@ function start(params) {
64
64
  transaction = yield repos.transaction.start(startParams);
65
65
  }
66
66
  catch (error) {
67
- if ((0, errorHandler_1.isMongoError)(error)) {
67
+ if (yield (0, errorHandler_1.isMongoError)(error)) {
68
68
  // no op
69
69
  }
70
70
  throw error;
@@ -139,7 +139,7 @@ function confirm(params) {
139
139
  });
140
140
  }
141
141
  catch (error) {
142
- if ((0, errorHandler_1.isMongoError)(error)) {
142
+ if (yield (0, errorHandler_1.isMongoError)(error)) {
143
143
  // 万が一同一注文番号で確定しようとすると、MongoDBでE11000 duplicate key errorが発生する
144
144
  // message: 'E11000 duplicate key error collection: prodttts.transactions index:result.order.orderNumber_1 dup key:...',
145
145
  if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
@@ -121,7 +121,7 @@ function start(params) {
121
121
  returnOrderTransaction = yield repos.transaction.start(returnOrderAttributes);
122
122
  }
123
123
  catch (error) {
124
- if ((0, errorHandler_1.isMongoError)(error)) {
124
+ if (yield (0, errorHandler_1.isMongoError)(error)) {
125
125
  // 同一取引に対して返品取引を作成しようとすると、MongoDBでE11000 duplicate key errorが発生する
126
126
  // tslint:disable-next-line:no-single-line-block-comment
127
127
  /* istanbul ignore else */
@@ -1,7 +1,5 @@
1
1
  import * as factory from '../../factory';
2
- export type IPassportValidator = (params: {
3
- passport: factory.waiter.passport.IPassport;
4
- }) => boolean;
2
+ import { IPassportValidator } from '../../factory/transaction';
5
3
  export type IStartParams = (factory.transaction.placeOrder.IStartParamsWithoutDetail | factory.transaction.moneyTransfer.IStartParamsWithoutDetail) & {
6
4
  passportValidator?: IPassportValidator;
7
5
  };