@chevre/domain 20.1.0-alpha.4 → 20.1.0-alpha.41

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 (107) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  2. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
  3. package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
  4. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  5. package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
  6. package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
  7. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
  8. package/example/src/chevre/searchEvents.ts +36 -16
  9. package/lib/chevre/repo/accountAction.d.ts +0 -18
  10. package/lib/chevre/repo/accountAction.js +402 -355
  11. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  12. package/lib/chevre/repo/accountTitle.js +6 -1
  13. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  14. package/lib/chevre/repo/additionalProperty.js +205 -0
  15. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  16. package/lib/chevre/repo/categoryCode.js +15 -1
  17. package/lib/chevre/repo/creativeWork.js +10 -1
  18. package/lib/chevre/repo/customer.d.ts +1 -0
  19. package/lib/chevre/repo/customer.js +5 -0
  20. package/lib/chevre/repo/event.d.ts +12 -4
  21. package/lib/chevre/repo/event.js +84 -48
  22. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  23. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  24. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  25. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  26. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  27. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  28. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  29. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  30. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  31. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  32. package/lib/chevre/repo/mongoose/model/place.js +42 -0
  33. package/lib/chevre/repo/offer.js +10 -1
  34. package/lib/chevre/repo/offerCatalog.js +10 -10
  35. package/lib/chevre/repo/place.d.ts +1 -0
  36. package/lib/chevre/repo/place.js +54 -7
  37. package/lib/chevre/repo/reservation.d.ts +16 -2
  38. package/lib/chevre/repo/reservation.js +29 -1
  39. package/lib/chevre/repo/transaction.js +20 -5
  40. package/lib/chevre/repository.d.ts +6 -3
  41. package/lib/chevre/repository.js +10 -5
  42. package/lib/chevre/service/account.d.ts +0 -4
  43. package/lib/chevre/service/account.js +24 -22
  44. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  45. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  46. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  47. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  48. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  49. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  50. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +9 -19
  51. package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
  52. package/lib/chevre/service/assetTransaction/reserve.js +99 -89
  53. package/lib/chevre/service/delivery/factory.js +2 -1
  54. package/lib/chevre/service/event.js +20 -6
  55. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  56. package/lib/chevre/service/offer/event/authorize.js +65 -27
  57. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  58. package/lib/chevre/service/offer/event/factory.js +17 -12
  59. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  60. package/lib/chevre/service/offer/factory.js +7 -20
  61. package/lib/chevre/service/offer.js +6 -6
  62. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +4 -2
  63. package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
  64. package/lib/chevre/service/order/placeOrder.js +13 -5
  65. package/lib/chevre/service/order/returnOrder.js +2 -1
  66. package/lib/chevre/service/order/sendOrder.js +2 -1
  67. package/lib/chevre/service/reserve/cancelReservation.js +135 -84
  68. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  69. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  70. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +67 -30
  71. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  72. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  73. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  74. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  75. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  76. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  77. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  78. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  79. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
  80. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  81. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  82. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  83. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  84. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  85. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  86. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  87. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  88. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  89. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  90. package/lib/chevre/service/transaction.js +1 -14
  91. package/package.json +4 -4
  92. package/example/src/chevre/accountBlanceTest.ts +0 -24
  93. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  94. package/example/src/chevre/createSeats.ts +0 -59
  95. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  96. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  97. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  98. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  99. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  100. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  101. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  102. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  103. package/example/src/chevre/renameTransaction.ts +0 -22
  104. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  105. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  106. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  107. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
@@ -0,0 +1,64 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+ const DELETING_PROPERTY_NAME: string = 'COA_ENDPOINT';
8
+
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const eventRepo = new chevre.repository.Event(mongoose.connection);
13
+
14
+ const cursor = eventRepo.getCursor(
15
+ {
16
+ 'project.id': { $eq: project.id },
17
+ typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
18
+ // typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
19
+ // startDate: { $gte: new Date() }
20
+ },
21
+ {
22
+ // _id: 1,
23
+ }
24
+ );
25
+ console.log('events found');
26
+
27
+ let i = 0;
28
+ let updateCount = 0;
29
+ await cursor.eachAsync(async (doc) => {
30
+ i += 1;
31
+ const event: chevre.factory.event.IEvent<chevre.factory.eventType> = doc.toObject();
32
+
33
+ const coaEndpointPropert = event.additionalProperty?.find((p) => p.name === DELETING_PROPERTY_NAME);
34
+
35
+ if (coaEndpointPropert !== undefined) {
36
+ const newAdditionalProperty: chevre.factory.propertyValue.IPropertyValue<string>[] =
37
+ (Array.isArray(event.additionalProperty))
38
+ ? event.additionalProperty.filter((p) => {
39
+ return p.name !== DELETING_PROPERTY_NAME;
40
+ })
41
+ : [];
42
+ console.log(
43
+ 'updating event...', event.project.id, event.id, event.startDate, coaEndpointPropert.value, newAdditionalProperty, i);
44
+ await eventRepo.updatePartiallyById({
45
+ id: event.id,
46
+ attributes: <any>{
47
+ typeOf: event.typeOf,
48
+ additionalProperty: newAdditionalProperty
49
+ }
50
+ });
51
+ updateCount += 1;
52
+ console.log('event updated', event.project.id, event.id, event.startDate, i);
53
+ } else {
54
+ console.log('no property...', event.project.id, event.id, event.startDate, i);
55
+ }
56
+ });
57
+
58
+ console.log(i, 'events checked');
59
+ console.log(updateCount, 'events updated');
60
+ }
61
+
62
+ main()
63
+ .then()
64
+ .catch(console.error);
@@ -1,5 +1,5 @@
1
1
  // tslint:disable:no-console
2
- // import * as redis from 'redis';
2
+ import * as moment from 'moment';
3
3
  import * as mongoose from 'mongoose';
4
4
 
5
5
  import { chevre } from '../../../lib/index';
@@ -15,22 +15,42 @@ async function main() {
15
15
  limit: 100,
16
16
  page: 1,
17
17
  sort: { startDate: 1 },
18
- typeOf: chevre.factory.eventType.ScreeningEventSeries,
18
+ typeOf: chevre.factory.eventType.ScreeningEvent,
19
19
  project: { id: { $eq: PROJECT_ID } },
20
- workPerformed: { identifiers: ['xxx', 'xxx2', 'xxx3', 'xxx4'] }
21
- // eventStatuses: [chevre.factory.eventStatusType.EventScheduled]
22
- // offers: {
23
- // itemOffered: {
24
- // serviceOutput: {
25
- // reservedTicket: {
26
- // ticketedSeat: {
27
- // // 座席指定有のみの検索の場合
28
- // typeOfs: [chevre.factory.placeType.Seat]
29
- // }
30
- // }
31
- // }
32
- // }
33
- // }
20
+ offers: {
21
+ seller: {
22
+ makesOffer: {
23
+ $elemMatch: {
24
+ 'availableAtOrFrom.id': { $eq: '5h3gs22mu9j3ok7o63uog9o9i3' },
25
+ availabilityEnds: {
26
+ $gte: moment('2022-11-18T02:20:00.000Z')
27
+ .toDate(),
28
+ $lte: moment('2022-11-18T02:20:00.000Z')
29
+ .toDate()
30
+ },
31
+ availabilityStarts: {
32
+ $gte: moment('2022-11-15T15:00:00.000Z')
33
+ .toDate(),
34
+ $lte: moment('2022-11-15T15:00:00.000Z')
35
+ .toDate()
36
+ },
37
+ validFrom: {
38
+ $gte: moment('2022-11-15T15:00:00.000Z')
39
+ .toDate(),
40
+ $lte: moment('2022-11-15T15:00:00.000Z')
41
+ .toDate()
42
+ },
43
+ validThrough: {
44
+ $gte: moment('2022-11-18T02:20:00.000Z')
45
+ .toDate(),
46
+ $lte: moment('2022-11-18T02:20:00.000Z')
47
+ .toDate()
48
+ }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ id: { $in: ['al6aff83y'] }
34
54
  });
35
55
  console.log(events);
36
56
  console.log(events.length);
@@ -9,46 +9,28 @@ export declare type IAction<T extends factory.actionType> = T extends factory.ac
9
9
  export declare class MongoRepository {
10
10
  private readonly actionModel;
11
11
  constructor(connection: Connection);
12
- static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params: factory.account.action.moneyTransfer.ISearchConditions): any[];
13
12
  /**
14
13
  * アクション開始
15
14
  */
16
- startByIdentifier<T extends factory.actionType>(params: factory.account.action.moneyTransfer.IAttributes): Promise<IAction<T>>;
17
15
  /**
18
16
  * アクション完了
19
17
  */
20
- complete<T extends factory.actionType>(typeOf: T, actionId: string, result: any): Promise<IAction<T>>;
21
18
  /**
22
19
  * アクション中止
23
20
  */
24
- cancel<T extends factory.actionType>(typeOf: T, actionId: string): Promise<IAction<T>>;
25
21
  /**
26
22
  * アクション失敗
27
23
  */
28
- giveUp<T extends factory.actionType>(typeOf: T, actionId: string, error: any): Promise<IAction<T>>;
29
24
  /**
30
25
  * アクション検索
31
26
  */
32
- findById<T extends factory.actionType>(typeOf: T, actionId: string): Promise<IAction<T>>;
33
- countTransferActions(params: factory.account.action.moneyTransfer.ISearchConditions): Promise<number>;
34
27
  /**
35
28
  * 転送アクションを検索する
36
29
  */
37
- searchTransferActions(params: factory.account.action.moneyTransfer.ISearchConditions): Promise<factory.account.action.moneyTransfer.IAction[]>;
38
30
  /**
39
31
  * アクションを検索する
40
32
  * @param searchConditions 検索条件
41
33
  */
42
- search<T extends factory.actionType>(searchConditions: {
43
- typeOf: T;
44
- actionStatuses?: factory.account.AccountStatusType[];
45
- startDateFrom?: Date;
46
- startDateThrough?: Date;
47
- purposeTypeOfs?: factory.account.transactionType[];
48
- fromLocationAccountNumbers?: string[];
49
- toLocationAccountNumbers?: string[];
50
- limit: number;
51
- }): Promise<IAction<T>[]>;
52
34
  clean(params: {
53
35
  project?: {
54
36
  id?: string;