@chevre/domain 20.1.0-alpha.8 → 20.1.0

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 (103) hide show
  1. package/example/src/chevre/deleteReservationTicketUnderNames.ts +20 -0
  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/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -4
  10. package/example/src/chevre/transaction/orderMembershipService.ts +0 -4
  11. package/lib/chevre/factory/reservedAgentIdentifireNames.d.ts +1 -0
  12. package/lib/chevre/factory/reservedAgentIdentifireNames.js +12 -0
  13. package/lib/chevre/repo/accountAction.d.ts +0 -18
  14. package/lib/chevre/repo/accountAction.js +402 -355
  15. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  16. package/lib/chevre/repo/accountTitle.js +6 -1
  17. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  18. package/lib/chevre/repo/additionalProperty.js +205 -0
  19. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  20. package/lib/chevre/repo/categoryCode.js +15 -1
  21. package/lib/chevre/repo/creativeWork.js +10 -1
  22. package/lib/chevre/repo/customer.d.ts +1 -0
  23. package/lib/chevre/repo/customer.js +5 -0
  24. package/lib/chevre/repo/event.d.ts +12 -4
  25. package/lib/chevre/repo/event.js +84 -48
  26. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  27. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  28. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  29. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  30. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  31. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  32. package/lib/chevre/repo/mongoose/model/event.js +6 -0
  33. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  34. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  35. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  36. package/lib/chevre/repo/mongoose/model/place.js +24 -0
  37. package/lib/chevre/repo/offer.js +10 -1
  38. package/lib/chevre/repo/offerCatalog.js +10 -10
  39. package/lib/chevre/repo/person.js +4 -1
  40. package/lib/chevre/repo/place.d.ts +1 -0
  41. package/lib/chevre/repo/place.js +54 -7
  42. package/lib/chevre/repo/reservation.d.ts +17 -2
  43. package/lib/chevre/repo/reservation.js +41 -1
  44. package/lib/chevre/repo/transaction.js +20 -5
  45. package/lib/chevre/repository.d.ts +6 -3
  46. package/lib/chevre/repository.js +10 -5
  47. package/lib/chevre/service/account.d.ts +0 -4
  48. package/lib/chevre/service/account.js +24 -22
  49. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  50. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  51. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  52. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  53. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  54. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  55. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +86 -42
  56. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +7 -18
  57. package/lib/chevre/service/assetTransaction/reserve/factory.js +81 -113
  58. package/lib/chevre/service/assetTransaction/reserve.js +41 -95
  59. package/lib/chevre/service/event.js +20 -6
  60. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  61. package/lib/chevre/service/offer/event/authorize.js +65 -27
  62. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  63. package/lib/chevre/service/offer/event/factory.js +17 -12
  64. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  65. package/lib/chevre/service/offer/factory.js +7 -20
  66. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +32 -22
  67. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
  68. package/lib/chevre/service/reserve/cancelReservation.js +260 -107
  69. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  70. package/lib/chevre/service/reserve/factory.d.ts +14 -2
  71. package/lib/chevre/service/reserve/factory.js +13 -6
  72. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  73. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
  74. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  75. package/lib/chevre/service/transaction/orderProgramMembership.js +15 -28
  76. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
  77. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
  78. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  79. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  80. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  81. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  82. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  83. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  84. package/lib/chevre/service.d.ts +2 -0
  85. package/lib/chevre/service.js +2 -0
  86. package/package.json +4 -4
  87. package/example/src/chevre/accountBlanceTest.ts +0 -24
  88. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  89. package/example/src/chevre/createSeats.ts +0 -59
  90. package/example/src/chevre/deleteEvents.ts +0 -50
  91. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  92. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  93. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  94. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  95. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  96. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  97. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  98. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  99. package/example/src/chevre/renameTransaction.ts +0 -22
  100. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  101. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  102. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  103. 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);
@@ -22,10 +22,6 @@ async function main() {
22
22
  typeOf: chevre.factory.personType.Person,
23
23
  id: 'b2bc2b6d-aea2-41fc-9f6e-e4ec89c11d2e',
24
24
  identifier: [
25
- {
26
- name: 'tokenIssuer',
27
- value: String(process.env.ISS)
28
- },
29
25
  {
30
26
  name: 'iss',
31
27
  value: String(process.env.ISS)
@@ -43,10 +43,6 @@ async function main() {
43
43
  typeOf: chevre.factory.personType.Person,
44
44
  id: 'b2bc2b6d-aea2-41fc-9f6e-e4ec89c11d2e',
45
45
  identifier: [
46
- {
47
- name: 'tokenIssuer',
48
- value: String(process.env.ISS)
49
- },
50
46
  {
51
47
  name: 'iss',
52
48
  value: String(process.env.ISS)
@@ -0,0 +1 @@
1
+ export declare const RESERVED_AGENT_IDENTIFIER_NAMES: string[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESERVED_AGENT_IDENTIFIER_NAMES = void 0;
4
+ exports.RESERVED_AGENT_IDENTIFIER_NAMES = [
5
+ 'orderNumber',
6
+ 'tokenIssuer',
7
+ 'iss',
8
+ 'clientId',
9
+ 'sub',
10
+ 'hostname',
11
+ 'username'
12
+ ];
@@ -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;