@chevre/domain 21.18.0-alpha.4 → 21.18.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 (142) hide show
  1. package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +24 -0
  2. package/example/src/chevre/offerCatalog2offerCatalogItem.ts +4 -0
  3. package/example/src/chevre/searchAcceptedOfferIds.ts +57 -0
  4. package/example/src/chevre/searchOffers.ts +41 -37
  5. package/example/src/chevre/searchOrderAcceptedOffers.ts +12 -12
  6. package/example/src/chevre/searchOrders.ts +36 -19
  7. package/example/src/chevre/searchReservationsByOrder.ts +30 -0
  8. package/example/src/chevre/searchTransactions.ts +41 -0
  9. package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
  10. package/example/src/chevre/upsertMoviesByIdentifier.ts +5 -4
  11. package/example/src/chevre/upsertOfferCatalogsByIdentifier.ts +46 -0
  12. package/example/src/chevre/upsertOffersByIdentifier.ts +94 -0
  13. package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +104 -0
  14. package/lib/chevre/credentials.d.ts +0 -3
  15. package/lib/chevre/credentials.js +4 -3
  16. package/lib/chevre/repo/acceptedOffer.d.ts +60 -0
  17. package/lib/chevre/repo/acceptedOffer.js +158 -0
  18. package/lib/chevre/repo/creativeWork.d.ts +12 -2
  19. package/lib/chevre/repo/creativeWork.js +39 -25
  20. package/lib/chevre/repo/event.d.ts +15 -0
  21. package/lib/chevre/repo/event.js +66 -0
  22. package/lib/chevre/repo/offer.d.ts +14 -5
  23. package/lib/chevre/repo/offer.js +94 -19
  24. package/lib/chevre/repo/offerCatalog.d.ts +18 -1
  25. package/lib/chevre/repo/offerCatalog.js +51 -39
  26. package/lib/chevre/repo/order.d.ts +14 -54
  27. package/lib/chevre/repo/order.js +46 -180
  28. package/lib/chevre/repo/paymentService.d.ts +30 -0
  29. package/lib/chevre/repo/paymentService.js +75 -0
  30. package/lib/chevre/repo/place.js +14 -10
  31. package/lib/chevre/repo/product.d.ts +41 -10
  32. package/lib/chevre/repo/product.js +94 -47
  33. package/lib/chevre/repo/transaction.d.ts +5 -4
  34. package/lib/chevre/repository.d.ts +10 -7
  35. package/lib/chevre/repository.js +28 -17
  36. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -1
  37. package/lib/chevre/service/aggregation/event/findEventOffers.js +10 -1
  38. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  39. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +3 -1
  40. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
  41. package/lib/chevre/service/assetTransaction/pay.d.ts +2 -0
  42. package/lib/chevre/service/assetTransaction/pay.js +47 -34
  43. package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
  44. package/lib/chevre/service/assetTransaction/refund/factory.js +0 -5
  45. package/lib/chevre/service/assetTransaction/refund.js +15 -3
  46. package/lib/chevre/service/assetTransaction/registerService.js +18 -2
  47. package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
  48. package/lib/chevre/service/assetTransaction/reserve.js +32 -2
  49. package/lib/chevre/service/delivery/factory.d.ts +3 -1
  50. package/lib/chevre/service/delivery/factory.js +4 -2
  51. package/lib/chevre/service/delivery.d.ts +1 -2
  52. package/lib/chevre/service/delivery.js +1 -3
  53. package/lib/chevre/service/event.js +1 -1
  54. package/lib/chevre/service/moneyTransfer.js +11 -1
  55. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  56. package/lib/chevre/service/offer/event/factory.js +4 -2
  57. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +40 -5
  58. package/lib/chevre/service/offer/product/factory.js +1 -1
  59. package/lib/chevre/service/offer/product/searchProductOffers.js +10 -1
  60. package/lib/chevre/service/offer/product.d.ts +0 -14
  61. package/lib/chevre/service/offer/product.js +61 -44
  62. package/lib/chevre/service/order/confirmPayTransaction.d.ts +2 -0
  63. package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
  64. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +3 -1
  65. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +4 -1
  66. package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
  67. package/lib/chevre/service/order/deleteOrder.js +15 -4
  68. package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +3 -1
  69. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -2
  70. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -3
  71. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +15 -9
  72. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +11 -0
  73. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.js +54 -0
  74. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +10 -0
  75. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +38 -0
  76. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +12 -0
  77. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +111 -0
  78. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +12 -0
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +64 -0
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +10 -0
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +103 -0
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +23 -0
  83. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +180 -0
  84. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +14 -0
  85. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +214 -0
  86. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +10 -0
  87. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +110 -0
  88. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +14 -0
  89. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +164 -0
  90. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +9 -15
  91. package/lib/chevre/service/order/onOrderStatusChanged.js +11 -446
  92. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +6 -0
  93. package/lib/chevre/service/order/onOrderUpdated/factory.js +45 -0
  94. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  95. package/lib/chevre/service/order/payOrder.d.ts +2 -2
  96. package/lib/chevre/service/order/placeOrder.d.ts +2 -3
  97. package/lib/chevre/service/order/placeOrder.js +65 -22
  98. package/lib/chevre/service/order/returnOrder.d.ts +2 -2
  99. package/lib/chevre/service/order/returnOrder.js +34 -13
  100. package/lib/chevre/service/order/sendOrder.d.ts +2 -2
  101. package/lib/chevre/service/order/sendOrder.js +19 -6
  102. package/lib/chevre/service/order.d.ts +2 -2
  103. package/lib/chevre/service/order.js +2 -2
  104. package/lib/chevre/service/payment/any.js +1 -1
  105. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -2
  106. package/lib/chevre/service/payment/paymentCard.js +9 -2
  107. package/lib/chevre/service/reserve/searchByOrder.d.ts +21 -0
  108. package/lib/chevre/service/reserve/searchByOrder.js +113 -0
  109. package/lib/chevre/service/reserve/verifyToken4reservation.js +0 -11
  110. package/lib/chevre/service/reserve.d.ts +2 -1
  111. package/lib/chevre/service/reserve.js +3 -1
  112. package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
  113. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  114. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +5 -6
  115. package/lib/chevre/service/task/onAuthorizationCreated.js +9 -18
  116. package/lib/chevre/service/task/onOrderPaymentCompleted.js +5 -6
  117. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +1 -1
  118. package/lib/chevre/service/task/onResourceUpdated.js +1 -1
  119. package/lib/chevre/service/task/placeOrder.js +10 -17
  120. package/lib/chevre/service/task/returnOrder.js +10 -17
  121. package/lib/chevre/service/task/sendOrder.js +10 -17
  122. package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
  123. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  124. package/lib/chevre/service/transaction/moneyTransfer.js +3 -4
  125. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +0 -4
  126. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -86
  127. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
  128. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
  129. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -0
  130. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +3 -3
  131. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -0
  132. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
  133. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -0
  134. package/lib/chevre/service/transaction/returnOrder.js +73 -55
  135. package/package.json +3 -3
  136. package/example/src/chevre/transaction/findPaymentCardPermit.ts +0 -29
  137. package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
  138. package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
  139. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -42
  140. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +0 -467
  141. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +0 -26
  142. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +0 -65
@@ -0,0 +1,24 @@
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
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
+
13
+ const ownershipInfos = await acceptedOfferRepo.aggreateOwnershipInfosByOrder(
14
+ {
15
+ orderNumber: { $eq: 'CIN4-3943271-4221863' }
16
+ }
17
+ );
18
+ // tslint:disable-next-line:no-null-keyword
19
+ console.dir(ownershipInfos, { depth: 1 });
20
+ }
21
+
22
+ main()
23
+ .then()
24
+ .catch(console.error);
@@ -21,6 +21,7 @@ async function main() {
21
21
  let i = 0;
22
22
  let maxOfferCatalogItemNumItemListElement = 0;
23
23
  let maxIdentifierLength = 0;
24
+ let maxOfferCatalogItemLength = 0;
24
25
  for (const offerCatalog of offerCatalogs) {
25
26
  i += 1;
26
27
  maxIdentifierLength = Math.max(maxIdentifierLength, offerCatalog.identifier.length);
@@ -145,11 +146,14 @@ async function main() {
145
146
  maxOfferCatalogItemNumItemListElement =
146
147
  Math.max(maxOfferCatalogItemNumItemListElement, offerCatalogItem.itemListElement.length);
147
148
  });
149
+
150
+ maxOfferCatalogItemLength = Math.max(maxOfferCatalogItemLength, offerCatalogItems.length);
148
151
  }
149
152
 
150
153
  console.log(i, 'offerCatalogs checked');
151
154
  console.log('maxOfferCatalogItemNumItemListElement:', maxOfferCatalogItemNumItemListElement);
152
155
  console.log('maxIdentifierLength:', maxIdentifierLength);
156
+ console.log('maxOfferCatalogItemLength:', maxOfferCatalogItemLength);
153
157
  }
154
158
 
155
159
  main()
@@ -0,0 +1,57 @@
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
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
+
13
+ let offerIds: string[];
14
+
15
+ // const searchConditions: chevre.factory.order.ISearchConditions = {
16
+ // limit: 10,
17
+ // page: 1,
18
+ // project: { id: { $eq: project.id } },
19
+ // orderNumbers: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'],
20
+ // acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
+ // };
22
+ // let offerIds = await acceptedOfferRepo.__searchAcceptedOfferIds(searchConditions);
23
+ // console.log(offerIds);
24
+ offerIds = await acceptedOfferRepo.distinctValues(
25
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
26
+ 'acceptedOffers.id'
27
+ );
28
+ console.log(offerIds);
29
+
30
+ const productIds = await acceptedOfferRepo.distinctValues(
31
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
32
+ 'acceptedOffers.itemOffered.issuedThrough.id'
33
+ );
34
+ console.log(productIds);
35
+
36
+ const locationBranchCodes = await acceptedOfferRepo.distinctValues(
37
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
38
+ 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode'
39
+ );
40
+ console.log(locationBranchCodes);
41
+
42
+ const offeredThroughIdentifiers = await acceptedOfferRepo.distinctValues(
43
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
44
+ 'acceptedOffers.offeredThrough.identifier'
45
+ );
46
+ console.log(offeredThroughIdentifiers);
47
+
48
+ const invalidValues = await acceptedOfferRepo.distinctValues(
49
+ { orderNumber: { $in: ['CIN1-3743286-2441943', 'CIN4-3943511-3323473'] } },
50
+ <any>'invalidValues'
51
+ );
52
+ console.log(invalidValues);
53
+ }
54
+
55
+ main()
56
+ .then()
57
+ .catch(console.error);
@@ -10,52 +10,56 @@ mongoose.Model.on('index', (...args) => {
10
10
  async function main() {
11
11
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
12
 
13
- const indexes = await mongoose.connection.db.collection('aggregateOffers')
14
- .indexes();
15
- console.log(indexes);
16
- console.log(indexes.length);
13
+ // const indexes = await mongoose.connection.db.collection('aggregateOffers')
14
+ // .indexes();
15
+ // console.log(indexes);
16
+ // console.log(indexes.length);
17
17
 
18
18
  const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
19
19
 
20
- const offers = await offerRepo.search({
21
- limit: 100,
22
- // page: 1,
23
- project: { id: { $eq: String(process.env.PROJECT_ID) } },
24
- availability: { $eq: chevre.factory.itemAvailability.InStock },
25
- acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
26
- parentOffer: {
27
- },
28
- priceSpecification: {
29
- appliesToMovieTicket: {
30
- serviceOutput: {
31
- typeOf: {
32
- // $eq: '',
33
- // $all: []
20
+ const offers = await offerRepo.search(
21
+ {
22
+ limit: 100,
23
+ // page: 1,
24
+ project: { id: { $eq: String(process.env.PROJECT_ID) } },
25
+ availability: { $eq: chevre.factory.itemAvailability.InStock },
26
+ // acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
27
+ parentOffer: {
28
+ },
29
+ priceSpecification: {
30
+ appliesToMovieTicket: {
31
+ serviceOutput: {
32
+ typeOf: {
33
+ // $eq: '',
34
+ // $all: []
35
+ }
34
36
  }
35
37
  }
36
38
  }
39
+ // includedInDataCatalog: { id: { $in: ['0001'] } }
40
+ // additionalProperty: {
41
+ // $all: [
42
+ // {
43
+ // $elemMatch: {
44
+ // name: { $eq: 'theaterCode' },
45
+ // value: { $in: ['120'] }
46
+ // }
47
+ // },
48
+ // {
49
+ // $elemMatch: {
50
+ // name: { $eq: 'ticketCode' },
51
+ // value: { $in: ['10', '1001'] }
52
+ // }
53
+ // }
54
+ // ]
55
+ // }
37
56
  }
38
- // includedInDataCatalog: { id: { $in: ['0001'] } }
39
- // additionalProperty: {
40
- // $all: [
41
- // {
42
- // $elemMatch: {
43
- // name: { $eq: 'theaterCode' },
44
- // value: { $in: ['120'] }
45
- // }
46
- // },
47
- // {
48
- // $elemMatch: {
49
- // name: { $eq: 'ticketCode' },
50
- // value: { $in: ['10', '1001'] }
51
- // }
52
- // }
53
- // ]
54
- // }
55
- });
57
+ // { identifier: 1 }
58
+ );
56
59
  console.log(offers.map((offer) => {
57
- return `${offer.project.id} ${offer.id} ${offer.identifier} ${offer.name.ja}`;
60
+ return `${offer.project?.id} ${offer.id} ${offer.parentOffer?.id} ${offer.identifier} ${offer.name?.ja}`;
58
61
  }));
62
+ // console.log(offers);
59
63
  console.log(offers.length);
60
64
  }
61
65
 
@@ -8,19 +8,19 @@ const project = { id: String(process.env.PROJECT_ID) };
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
10
 
11
- const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
11
+ const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
12
 
13
- const searchConditions: chevre.factory.order.ISearchConditions = {
14
- // tslint:disable-next-line:no-magic-numbers
15
- limit: 10,
16
- page: 1,
17
- project: { id: { $eq: project.id } },
18
- confirmationNumbers: ['36684'],
19
- orderNumbers: ['CIN1-3743286-2441943'],
20
- acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
- // ...(typeof req.seller?.id === 'string') ? { seller: { id: { $eq: req.seller.id } } } : undefined // req.seller.idを考慮
22
- };
23
- const acceptedOffers = await orderRepo.searchAcceptedOffers(searchConditions, ['itemOffered', 'id']);
13
+ const acceptedOffers = await acceptedOfferRepo.searchAcceptedOffersByOrderNumber(
14
+ {
15
+ // tslint:disable-next-line:no-magic-numbers
16
+ limit: 10,
17
+ page: 1,
18
+ project: { id: { $eq: project.id } },
19
+ orderNumber: { $eq: 'CIN3-0760465-8981560' },
20
+ acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
+ },
22
+ ['itemOffered', 'id']
23
+ );
24
24
  // tslint:disable-next-line:no-null-keyword
25
25
  console.dir(acceptedOffers, { depth: 1 });
26
26
  const reservationIds = acceptedOffers.map((acceptedOffer) => {
@@ -10,28 +10,45 @@ async function main() {
10
10
 
11
11
  const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
12
12
 
13
- const orders = await orderRepo.search({
14
- limit: 10,
15
- project: { id: { $eq: project.id } },
16
- acceptedOffers: {
17
- // $size: 1
18
- // itemOffered: {
19
- // issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
13
+ const order = await orderRepo.findByOrderNumber({
14
+ orderNumber: 'CIN4-3943271-4221863',
15
+ project: { id: project.id },
16
+ inclusion: [
17
+ // 'project', 'typeOf', 'orderNumber', 'dateReturned', 'id',
18
+ // 'customer', 'returner', 'seller', 'price', 'priceCurrency', 'orderDate'
19
+ ],
20
+ exclusion: ['acceptedOffers']
21
+ });
22
+ console.log(order);
23
+
24
+ const orders = await orderRepo.search(
25
+ {
26
+ limit: 10,
27
+ project: { id: { $eq: project.id } },
28
+ acceptedOffers: {
29
+ // $size: 1
30
+ // itemOffered: {
31
+ // issuedThrough: { typeOf: { $eq: chevre.factory.product.ProductType.MembershipService } }
32
+ // }
33
+ },
34
+ orderedItem: {
35
+ $size: 3
36
+ }
37
+ // paymentMethods: {
38
+ // paymentMethod: { identifier: { $in: ['Cash'] } }
39
+ // additionalProperty: {
40
+ // $in: [
41
+ // { name: 'orderId', value: '0102022031518442020' },
42
+ // { name: 'orderId', value: '0102022031518423030' }
43
+ // ]
20
44
  // }
45
+ // }
21
46
  },
22
- orderedItem: {
23
- $size: 3
47
+ {
48
+ orderNumber: 1,
49
+ customer: 1
24
50
  }
25
- // paymentMethods: {
26
- // paymentMethod: { identifier: { $in: ['Cash'] } }
27
- // additionalProperty: {
28
- // $in: [
29
- // { name: 'orderId', value: '0102022031518442020' },
30
- // { name: 'orderId', value: '0102022031518423030' }
31
- // ]
32
- // }
33
- // }
34
- });
51
+ );
35
52
  console.log('orders found', orders);
36
53
  console.log(orders.length, 'orders found');
37
54
  }
@@ -0,0 +1,30 @@
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
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
12
+ limit: 10,
13
+ page: 1,
14
+ project: { id: project.id },
15
+ orderNumber: 'CIN3-0760465-8981560',
16
+ // orderNumber: 'SSK1-3743647-5975553',
17
+ // orderNumber: 'SSK9-4864565-8689164',
18
+ typeOf: chevre.factory.reservationType.EventReservation
19
+ })({
20
+ acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
21
+ order: await chevre.repository.Order.createInstance(mongoose.connection),
22
+ reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
23
+ });
24
+ console.log(reservations);
25
+ console.log(reservations.length, 'reservations found');
26
+ }
27
+
28
+ main()
29
+ .then(console.log)
30
+ .catch(console.error);
@@ -0,0 +1,41 @@
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
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
12
+
13
+ const transactions = await transactionRepo.search<chevre.factory.transactionType.PlaceOrder>({
14
+ limit: 1,
15
+ page: 1,
16
+ project: { id: { $eq: project.id } },
17
+ typeOf: chevre.factory.transactionType.PlaceOrder,
18
+ statuses: [chevre.factory.transactionStatusType.Confirmed],
19
+ result: {
20
+ order: {
21
+ confirmationNumber: { $eq: '14438' },
22
+ orderNumbers: ['CIN3-0760465-8981560']
23
+ }
24
+ },
25
+ inclusion: ['id'],
26
+ exclusion: []
27
+ });
28
+ console.log('transactions found', transactions);
29
+ console.log(transactions.length, 'transactions found');
30
+
31
+ const transaction = await transactionRepo.findById({
32
+ typeOf: chevre.factory.transactionType.PlaceOrder,
33
+ id: '6570f9d7834f9638ceec86ad',
34
+ inclusion: ['_id', 'typeOf', 'status']
35
+ });
36
+ console.log('transaction found', transaction);
37
+ }
38
+
39
+ main()
40
+ .then()
41
+ .catch(console.error);
@@ -23,6 +23,7 @@ async function main() {
23
23
  id: 'xxx'
24
24
  }
25
25
  })({
26
+ acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
26
27
  event: await chevre.repository.Event.createInstance(mongoose.connection),
27
28
  merchantReturnPolicy: await chevre.repository.MerchantReturnPolicy.createInstance(mongoose.connection),
28
29
  offer: await chevre.repository.Offer.createInstance(mongoose.connection),
@@ -14,9 +14,9 @@ async function main() {
14
14
  const result = await creativeWorkRepo.upsertMoviesByIdentifier(
15
15
  [
16
16
  {
17
- attributes: {
17
+ $set: {
18
18
  id: '',
19
- identifier: '00001',
19
+ identifier: '20231215',
20
20
  typeOf: chevre.factory.creativeWorkType.Movie,
21
21
  duration: 'PT2H',
22
22
  name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
@@ -34,7 +34,7 @@ async function main() {
34
34
  value: 'https://iwiz-movies.c.yimg.jp/c/movies/pict/p/p/90/cb/174755_02.jpg'
35
35
  }
36
36
  ],
37
- headline: 'サブタイトルサブタイトルサブタイトル',
37
+ // headline: 'サブタイトルサブタイトル',
38
38
  datePublished: moment('2018-11-04T15:00:00.000Z')
39
39
  .toDate(),
40
40
  distributor: {
@@ -44,7 +44,8 @@ async function main() {
44
44
  distributorType: '001'
45
45
  }
46
46
  }
47
- }
47
+ },
48
+ $unset: { headline: 1 }
48
49
  }
49
50
  ],
50
51
  { replace: true }
@@ -0,0 +1,46 @@
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
+
8
+ // tslint:disable-next-line:max-func-body-length
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
13
+
14
+ const result = await offerCatalogRepo.upsertManyByIdentifier(
15
+ [
16
+ {
17
+ $set: {
18
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
19
+ typeOf: 'OfferCatalog',
20
+ id: '',
21
+ identifier: '2023121501',
22
+ itemListElement: [
23
+ { id: '1001', typeOf: chevre.factory.offerType.Offer }
24
+ ],
25
+ itemOffered: { typeOf: chevre.factory.product.ProductType.EventService },
26
+ name: {
27
+ en: '2023121501',
28
+ ja: '2023121501'
29
+ },
30
+ description: {
31
+ en: '2023121501',
32
+ ja: '2023121501'
33
+ },
34
+ additionalProperty: []
35
+ },
36
+ $unset: {}
37
+ }
38
+ ]
39
+ // { replace: true }
40
+ );
41
+ console.log('result:', result);
42
+ }
43
+
44
+ main()
45
+ .then(console.log)
46
+ .catch(console.error);
@@ -0,0 +1,94 @@
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
+
8
+ // tslint:disable-next-line:max-func-body-length
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
13
+
14
+ const result = await offerRepo.upsertByIdentifier(
15
+ [
16
+ {
17
+ additionalProperty: [],
18
+ addOn: [],
19
+ alternateName: { en: '', ja: '20231213' },
20
+ availability: chevre.factory.itemAvailability.InStock,
21
+ availableAtOrFrom: [],
22
+ itemOffered: {
23
+ typeOf: chevre.factory.product.ProductType.EventService,
24
+ serviceOutput: {}
25
+ },
26
+ name: { ja: '20231213', en: '20231213' },
27
+ priceCurrency: chevre.factory.priceCurrency.JPY,
28
+ priceSpecification: {
29
+ name: { en: '20231213', ja: '20231213' },
30
+ price: 20231213,
31
+ priceCurrency: chevre.factory.priceCurrency.JPY,
32
+ referenceQuantity: {
33
+ typeOf: 'QuantitativeValue',
34
+ value: 1,
35
+ unitCode: chevre.factory.unitCode.C62
36
+ },
37
+ typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
38
+ valueAddedTaxIncluded: true,
39
+ accounting: {
40
+ typeOf: 'Accounting',
41
+ accountsReceivable: 20231213
42
+ }
43
+ },
44
+ settings: { ignoreCategoryCodeChargeSpec: false },
45
+ description: { en: '', ja: '' },
46
+ hasMerchantReturnPolicy: [],
47
+ identifier: '20231213',
48
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
49
+ typeOf: chevre.factory.offerType.Offer
50
+ },
51
+ {
52
+ additionalProperty: [],
53
+ addOn: [],
54
+ alternateName: { en: '', ja: '2023121302' },
55
+ availability: chevre.factory.itemAvailability.InStock,
56
+ availableAtOrFrom: [],
57
+ itemOffered: {
58
+ typeOf: chevre.factory.product.ProductType.EventService,
59
+ serviceOutput: {}
60
+ },
61
+ name: { ja: '2023121302', en: '2023121302' },
62
+ priceCurrency: chevre.factory.priceCurrency.JPY,
63
+ priceSpecification: {
64
+ name: { en: '2023121302', ja: '2023121302' },
65
+ price: 20231213,
66
+ priceCurrency: chevre.factory.priceCurrency.JPY,
67
+ referenceQuantity: {
68
+ typeOf: 'QuantitativeValue',
69
+ value: 1,
70
+ unitCode: chevre.factory.unitCode.C62
71
+ },
72
+ typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
73
+ valueAddedTaxIncluded: true,
74
+ accounting: {
75
+ typeOf: 'Accounting',
76
+ accountsReceivable: 20231213
77
+ }
78
+ },
79
+ settings: { ignoreCategoryCodeChargeSpec: false },
80
+ description: { en: '', ja: '' },
81
+ hasMerchantReturnPolicy: [],
82
+ identifier: '2023121302',
83
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
84
+ typeOf: chevre.factory.offerType.Offer
85
+ }
86
+ ]
87
+ // { replace: true }
88
+ );
89
+ console.log('result:', result);
90
+ }
91
+
92
+ main()
93
+ .then(console.log)
94
+ .catch(console.error);
@@ -0,0 +1,104 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ const PROJECT_ID = String(process.env.PROJECT_ID);
8
+
9
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
14
+
15
+ const result = await eventRepo.upsertScreeningEventSeriesByVersion(
16
+ [
17
+ {
18
+ $set: {
19
+ eventStatus: chevre.factory.eventStatusType.EventScheduled,
20
+ videoFormat: [],
21
+ soundFormat: [],
22
+ kanaName: '',
23
+ startDate: moment('2023-12-08T15:00:00Z')
24
+ .toDate(),
25
+ endDate: moment('2123-12-08T15:00:00Z')
26
+ .toDate(),
27
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
28
+ duration: 'PT2H',
29
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
30
+ offers: {
31
+ typeOf: chevre.factory.offerType.Offer
32
+ },
33
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
34
+ additionalProperty: [
35
+ ],
36
+ location: {
37
+ branchCode: '118',
38
+ id: '5bfb841d5a78d7948369979a',
39
+ kanaName: 'シネモーションアカサカ',
40
+ name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
41
+ typeOf: chevre.factory.placeType.MovieTheater
42
+ },
43
+ workPerformed: {
44
+ typeOf: chevre.factory.creativeWorkType.Movie,
45
+ id: '5bfb841d5a78d79483699801',
46
+ identifier: '071953',
47
+ name: {
48
+ ja: '男はつらいよ 純情篇'
49
+ },
50
+ duration: 'PT1H29M',
51
+ version: '2'
52
+ },
53
+ organizer: { id: '59d20831e53ebc2b4e774466' },
54
+ headline: { ja: 'xxx', en: '' }
55
+ },
56
+ $unset: {}
57
+ },
58
+ {
59
+ $set: {
60
+ eventStatus: chevre.factory.eventStatusType.EventScheduled,
61
+ videoFormat: [],
62
+ soundFormat: [],
63
+ kanaName: '',
64
+ startDate: moment('2023-12-08T15:00:00Z')
65
+ .toDate(),
66
+ endDate: moment('2123-12-08T15:00:00Z')
67
+ .toDate(),
68
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
69
+ duration: 'PT2H',
70
+ name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
71
+ offers: {
72
+ typeOf: chevre.factory.offerType.Offer
73
+ },
74
+ project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
75
+ additionalProperty: [
76
+ ],
77
+ location: {
78
+ branchCode: '118',
79
+ id: '5bfb841d5a78d7948369979a',
80
+ kanaName: 'シネモーションアカサカ',
81
+ name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
82
+ typeOf: chevre.factory.placeType.MovieTheater
83
+ },
84
+ workPerformed: {
85
+ typeOf: chevre.factory.creativeWorkType.Movie,
86
+ id: '5bfb841d5a78d79483699801',
87
+ identifier: '071953',
88
+ name: {
89
+ ja: '男はつらいよ 純情篇'
90
+ },
91
+ duration: 'PT1H29M',
92
+ version: '6'
93
+ },
94
+ organizer: { id: '59d20831e53ebc2b4e774466' }
95
+ }
96
+ }
97
+ ]
98
+ );
99
+ console.log('result:', result);
100
+ }
101
+
102
+ main()
103
+ .then(console.log)
104
+ .catch(console.error);
@@ -35,9 +35,6 @@ export declare const credentials: {
35
35
  sendGrid: {
36
36
  apiKey: string | undefined;
37
37
  };
38
- hub: {
39
- clientId: string;
40
- };
41
38
  jwt: {
42
39
  secret: string;
43
40
  issuer: string;