@chevre/domain 22.0.0-alpha.8 → 22.0.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.
- package/example/src/chevre/aggregateAllEvents2.ts +13 -6
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +56 -52
- package/example/src/chevre/changeOrderStatus.ts +29 -0
- package/example/src/chevre/projectEventFieldsById.ts +35 -0
- package/example/src/chevre/projectOrderFieldsById.ts +41 -0
- package/example/src/chevre/searchEvents.ts +8 -7
- package/example/src/chevre/searchOrders.ts +14 -4
- package/example/src/chevre/sendGrid/filterEmailActivity.ts +33 -0
- package/lib/chevre/credentials/customSearch.d.ts +13 -0
- package/lib/chevre/credentials/customSearch.js +14 -0
- package/lib/chevre/credentials/lineNotify.d.ts +17 -0
- package/lib/chevre/credentials/lineNotify.js +16 -0
- package/lib/chevre/credentials/sendGrid.d.ts +11 -0
- package/lib/chevre/credentials/sendGrid.js +13 -0
- package/lib/chevre/credentials.d.ts +15 -18
- package/lib/chevre/credentials.js +42 -72
- package/lib/chevre/emailMessageBuilder.d.ts +3 -5
- package/lib/chevre/factory/event.d.ts +3 -1
- package/lib/chevre/index.d.ts +1 -0
- package/lib/chevre/repo/aggregateReservation.js +14 -4
- package/lib/chevre/repo/event.d.ts +13 -6
- package/lib/chevre/repo/event.js +58 -68
- package/lib/chevre/repo/order.d.ts +16 -7
- package/lib/chevre/repo/order.js +93 -56
- package/lib/chevre/repo/rateLimit/offer.js +0 -8
- package/lib/chevre/repo/stockHolder.js +0 -7
- package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +0 -2
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +6 -4
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +12 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +5 -7
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +7 -3
- package/lib/chevre/service/assetTransaction/pay.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +2 -3
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +2 -1
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +4 -4
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +14 -15
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +1 -1
- package/lib/chevre/service/assetTransaction.d.ts +2 -1
- package/lib/chevre/service/assetTransaction.js +2 -2
- package/lib/chevre/service/notification.d.ts +14 -6
- package/lib/chevre/service/notification.js +24 -24
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +4 -1
- package/lib/chevre/service/offer/event/authorize.js +9 -11
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +13 -5
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +16 -5
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +4 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +5 -1
- package/lib/chevre/service/offer/event.js +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +5 -3
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +5 -2
- package/lib/chevre/service/offer/factory.js +2 -3
- package/lib/chevre/service/offer/onEventChanged.js +20 -22
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -6
- package/lib/chevre/service/offer.js +3 -2
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +29 -18
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +2 -2
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +3 -6
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +6 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +13 -2
- package/lib/chevre/service/payment/movieTicket/factory.js +12 -5
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +6 -2
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +11 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +12 -5
- package/lib/chevre/service/payment/movieTicket/validation.js +5 -5
- package/lib/chevre/service/payment.js +2 -2
- package/lib/chevre/service/reserve/searchByOrder.js +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -17
- package/lib/chevre/service/task/aggregateOffers.js +11 -13
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +9 -9
- package/lib/chevre/service/task/authorizePayment.js +3 -3
- package/lib/chevre/service/task/cancelMoneyTransfer.js +5 -5
- package/lib/chevre/service/task/cancelPendingReservation.js +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -2
- package/lib/chevre/service/task/confirmMoneyTransfer.js +6 -6
- package/lib/chevre/service/task/confirmPayTransaction.js +10 -14
- package/lib/chevre/service/task/confirmRegisterService.js +4 -4
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +6 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +9 -17
- package/lib/chevre/service/task/createAccountingReport.js +5 -2
- package/lib/chevre/service/task/createEvent.js +5 -5
- package/lib/chevre/service/task/deleteTransaction.js +13 -13
- package/lib/chevre/service/task/givePointAward.js +7 -7
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -13
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -13
- package/lib/chevre/service/task/importOffersFromCOA.js +5 -14
- package/lib/chevre/service/task/moneyTransfer.js +5 -5
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +0 -3
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +0 -3
- package/lib/chevre/service/task/pay.js +2 -2
- package/lib/chevre/service/task/placeOrder.js +2 -2
- package/lib/chevre/service/task/refund.js +2 -2
- package/lib/chevre/service/task/registerService.js +6 -6
- package/lib/chevre/service/task/reserve.js +2 -2
- package/lib/chevre/service/task/returnMoneyTransfer.js +9 -9
- package/lib/chevre/service/task/returnPayTransaction.js +12 -12
- package/lib/chevre/service/task/returnPointAward.js +7 -7
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -14
- package/lib/chevre/service/task/sendEmailMessage.js +7 -7
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/task/triggerWebhook.js +5 -5
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -6
- package/lib/chevre/service/task/voidPayTransaction.js +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -2
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +6 -9
- package/lib/chevre/service/task/voidReserveTransaction.js +7 -15
- package/lib/chevre/service/task.d.ts +26 -9
- package/lib/chevre/service/task.js +6 -20
- package/lib/chevre/service/transaction/moneyTransfer.js +6 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.js +60 -71
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -28
- package/lib/chevre/service/transaction/returnOrder/preStart.js +5 -2
- package/lib/chevre/service/transaction/returnOrder.js +9 -6
- package/lib/chevre/service/validation/validateOrder.js +4 -2
- package/lib/chevre/settings.d.ts +34 -13
- package/lib/chevre/settings.js +6 -54
- package/package.json +3 -4
- package/lib/chevre/credentials/coa.d.ts +0 -17
- package/lib/chevre/credentials/coa.js +0 -17
|
@@ -35,12 +35,15 @@ export async function aggregateScreeningEvent() {
|
|
|
35
35
|
try {
|
|
36
36
|
console.log('executing...', count);
|
|
37
37
|
await (await chevre.service.task.createService()).executeByName({
|
|
38
|
-
name: chevre.factory.taskName.AggregateScreeningEvent
|
|
38
|
+
name: chevre.factory.taskName.AggregateScreeningEvent,
|
|
39
|
+
executor: { name: 'sample' }
|
|
39
40
|
})({
|
|
40
41
|
connection: mongoose.connection,
|
|
41
42
|
redisClient,
|
|
43
|
+
credentials: {
|
|
44
|
+
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
|
|
45
|
+
},
|
|
42
46
|
settings: new chevre.settings.Settings({
|
|
43
|
-
transactionWebhookUrls: [],
|
|
44
47
|
onEventChanged: {
|
|
45
48
|
informEvent: []
|
|
46
49
|
},
|
|
@@ -53,8 +56,9 @@ export async function aggregateScreeningEvent() {
|
|
|
53
56
|
onReservationStatusChanged: {
|
|
54
57
|
informReservation: []
|
|
55
58
|
},
|
|
56
|
-
|
|
57
|
-
timeout: 1000
|
|
59
|
+
notification: {
|
|
60
|
+
timeout: 1000,
|
|
61
|
+
useFetchAPI: true
|
|
58
62
|
},
|
|
59
63
|
userPoolIdOld: '',
|
|
60
64
|
userPoolIdNew: '',
|
|
@@ -63,11 +67,14 @@ export async function aggregateScreeningEvent() {
|
|
|
63
67
|
useOfferRateLimitProjects: [],
|
|
64
68
|
defaultSenderEmail: 'test@example.com',
|
|
65
69
|
deliverOrderLimit: 1,
|
|
66
|
-
transaction: { confirmedStoragePeriodInDays: 365, canceledStoragePeriodInDays: 365 },
|
|
70
|
+
transaction: { informUrls: [], confirmedStoragePeriodInDays: 365, canceledStoragePeriodInDays: 365 },
|
|
67
71
|
abortedTasksWithoutReport: [],
|
|
72
|
+
coa: { timeout: 1000 },
|
|
68
73
|
gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
|
|
69
74
|
movieticketReserve: { timeout: 1000, timeoutCheck: 1000 },
|
|
70
|
-
numTryConfirmReserveTransaction: 10
|
|
75
|
+
numTryConfirmReserveTransaction: 10,
|
|
76
|
+
useAssetTransactionSyncProcessing: true,
|
|
77
|
+
useExperimentalFeature: false
|
|
71
78
|
})
|
|
72
79
|
});
|
|
73
80
|
console.log('executed', count);
|
|
@@ -1,78 +1,82 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
|
-
import * as redis from 'redis';
|
|
3
|
+
// import * as redis from 'redis';
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../../lib/index';
|
|
6
6
|
|
|
7
7
|
const project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
-
const EVENT_ID = String(process.env.EVENT_ID);
|
|
8
|
+
// const EVENT_ID = String(process.env.EVENT_ID);
|
|
9
9
|
|
|
10
10
|
// tslint:disable-next-line:max-func-body-length
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
await client.connect();
|
|
13
|
+
// const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
14
|
+
// socket: {
|
|
15
|
+
// port: Number(<string>process.env.REDIS_PORT),
|
|
16
|
+
// host: <string>process.env.REDIS_HOST
|
|
17
|
+
// },
|
|
18
|
+
// password: <string>process.env.REDIS_KEY
|
|
19
|
+
// });
|
|
20
|
+
// await client.connect();
|
|
21
21
|
|
|
22
22
|
const aggregateReservationRepo = await chevre.repository.AggregateReservation.createInstance(mongoose.connection);
|
|
23
|
-
|
|
23
|
+
const aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
|
|
24
24
|
{
|
|
25
|
-
limit:
|
|
25
|
+
limit: 10,
|
|
26
26
|
page: 1,
|
|
27
27
|
project: { id: { $eq: project.id } },
|
|
28
28
|
reservationFor: {
|
|
29
|
-
id: {
|
|
29
|
+
id: {
|
|
30
|
+
$in: [
|
|
31
|
+
'blvcj2vfl', 'blvcj2w48',
|
|
32
|
+
'blvcj2wqj', 'blvcj2y1n',
|
|
33
|
+
'blvcj2ylh', 'blvcj2z7k',
|
|
34
|
+
'blvcj2zqz', 'blvcj30d3',
|
|
35
|
+
'blvcj30wo', 'blvcj32as'
|
|
36
|
+
]
|
|
37
|
+
},
|
|
30
38
|
typeOf: chevre.factory.eventType.ScreeningEvent
|
|
31
|
-
}
|
|
39
|
+
},
|
|
40
|
+
sort: { 'reservationFor.startDate': 1 }
|
|
32
41
|
},
|
|
33
42
|
['aggregateEntranceGate', 'aggregateOffer']
|
|
34
43
|
);
|
|
35
44
|
console.log('aggregateReservations:', aggregateReservations);
|
|
45
|
+
console.log('aggregateReservations:', aggregateReservations.map(({ id }) => id));
|
|
36
46
|
|
|
37
|
-
await (await chevre.service.aggregation.createService()).event.aggregateOffers({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
console.log('aggregateReserveAction processed.');
|
|
47
|
+
// await (await chevre.service.aggregation.createService()).event.aggregateOffers({
|
|
48
|
+
// id: EVENT_ID,
|
|
49
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent
|
|
50
|
+
// })({
|
|
51
|
+
// aggregateReservation: aggregateReservationRepo,
|
|
52
|
+
// event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
53
|
+
// stockHolder: await chevre.repository.StockHolder.createInstance(client, mongoose.connection),
|
|
54
|
+
// offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
55
|
+
// offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
|
|
56
|
+
// offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(client),
|
|
57
|
+
// screeningRoom: await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection),
|
|
58
|
+
// product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
59
|
+
// reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
|
|
60
|
+
// });
|
|
61
|
+
// console.log('aggregateReserveAction processed.');
|
|
53
62
|
|
|
54
|
-
aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[]
|
|
74
|
-
);
|
|
75
|
-
console.log('aggregateReservations:', aggregateReservations);
|
|
63
|
+
// aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
|
|
64
|
+
// {
|
|
65
|
+
// limit: 1,
|
|
66
|
+
// page: 1,
|
|
67
|
+
// sort: { 'reservationFor.startDate': 1 },
|
|
68
|
+
// project: { id: { $eq: project.id } },
|
|
69
|
+
// reservationFor: {
|
|
70
|
+
// id: {
|
|
71
|
+
// $eq: EVENT_ID,
|
|
72
|
+
// $in: [EVENT_ID]
|
|
73
|
+
// },
|
|
74
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent
|
|
75
|
+
// }
|
|
76
|
+
// },
|
|
77
|
+
// []
|
|
78
|
+
// );
|
|
79
|
+
// console.log('aggregateReservations:', aggregateReservations);
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
main()
|
|
@@ -0,0 +1,29 @@
|
|
|
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 orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
12
|
+
const result = await orderRepo.changeStatus(
|
|
13
|
+
{
|
|
14
|
+
project: {
|
|
15
|
+
id: project.id
|
|
16
|
+
},
|
|
17
|
+
orderNumber: 'CIN1-3723005-2440693',
|
|
18
|
+
orderStatus: chevre.factory.orderStatus.OrderDelivered,
|
|
19
|
+
previousOrderStatus: chevre.factory.orderStatus.OrderInTransit
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
// tslint:disable-next-line:no-null-keyword
|
|
23
|
+
console.dir(result, { depth: null });
|
|
24
|
+
console.log(result);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main()
|
|
28
|
+
.then(console.log)
|
|
29
|
+
.catch(console.error);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
const startTime = process.hrtime();
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
const diff = process.hrtime(startTime);
|
|
7
|
+
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
8
|
+
|
|
9
|
+
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const event = await eventRepo.projectFieldsById(
|
|
17
|
+
{
|
|
18
|
+
// id: '120162210202407171202250'
|
|
19
|
+
id: 'blxonxv1m'
|
|
20
|
+
},
|
|
21
|
+
// [
|
|
22
|
+
// 'project', 'organizer', 'typeOf',
|
|
23
|
+
// 'name', 'doorTime', 'endDate', 'eventStatus',
|
|
24
|
+
// 'location', 'startDate', 'superEvent',
|
|
25
|
+
// 'offers'
|
|
26
|
+
// ]
|
|
27
|
+
['project', 'startDate', 'typeOf', 'superEvent.location.id']
|
|
28
|
+
);
|
|
29
|
+
// tslint:disable-next-line:no-null-keyword
|
|
30
|
+
console.dir(event, { depth: null });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(console.log)
|
|
35
|
+
.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
|
+
mongoose.Model.on('index', (...args) => {
|
|
9
|
+
console.error('******** index event emitted. ********\n', args);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
+
|
|
15
|
+
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
16
|
+
const result = await orderRepo.projectFieldsById(
|
|
17
|
+
{
|
|
18
|
+
id: '66a04d962582d528b3ba6521',
|
|
19
|
+
inclusion: ['orderNumber']
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
// tslint:disable-next-line:no-null-keyword
|
|
23
|
+
console.dir(result, { depth: null });
|
|
24
|
+
|
|
25
|
+
const findByOrderNumberResult = await orderRepo.projectFieldsByOrderNumber(
|
|
26
|
+
{
|
|
27
|
+
orderNumber: 'CIN0-2152162-0949752',
|
|
28
|
+
project: { id: project.id },
|
|
29
|
+
inclusion: [
|
|
30
|
+
// 'orderNumber', 'orderStatus', 'typeOf',
|
|
31
|
+
'project'
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
// tslint:disable-next-line:no-null-keyword
|
|
36
|
+
console.log(findByOrderNumberResult);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main()
|
|
40
|
+
.then(console.log)
|
|
41
|
+
.catch(console.error);
|
|
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
const diff = process.hrtime(startTime);
|
|
7
7
|
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
8
8
|
|
|
9
|
-
const PROJECT_ID = process.env.PROJECT_ID;
|
|
9
|
+
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
@@ -15,18 +15,19 @@ async function main() {
|
|
|
15
15
|
|
|
16
16
|
const events = await eventRepo.search<chevre.factory.eventType.ScreeningEvent>(
|
|
17
17
|
{
|
|
18
|
-
limit:
|
|
18
|
+
limit: 1,
|
|
19
19
|
page: 1,
|
|
20
20
|
// sort: { startDate: 1 },
|
|
21
21
|
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
22
|
-
project: { id: { $eq: PROJECT_ID } }
|
|
23
|
-
// id: { $eq: '
|
|
24
|
-
|
|
22
|
+
// project: { id: { $eq: PROJECT_ID } },
|
|
23
|
+
// id: { $eq: '120162210202407171202250' }
|
|
24
|
+
id: { $eq: 'blxonxv1m' }
|
|
25
25
|
},
|
|
26
|
-
['
|
|
26
|
+
['location', 'project', 'startDate', 'typeOf', 'superEvent.location.id', 'offers.itemOffered'],
|
|
27
27
|
[]
|
|
28
28
|
);
|
|
29
|
-
|
|
29
|
+
// tslint:disable-next-line:no-null-keyword
|
|
30
|
+
console.dir(events, { depth: null });
|
|
30
31
|
console.log(events.length, 'events found');
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -21,7 +21,7 @@ async function main() {
|
|
|
21
21
|
|
|
22
22
|
const orders = await orderRepo.search(
|
|
23
23
|
{
|
|
24
|
-
limit:
|
|
24
|
+
limit: 1,
|
|
25
25
|
project: { id: { $eq: project.id } },
|
|
26
26
|
acceptedOffers: {
|
|
27
27
|
// itemOffered: {
|
|
@@ -48,11 +48,21 @@ async function main() {
|
|
|
48
48
|
// }
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
inclusion: {
|
|
52
|
+
confirmationNumber: 1,
|
|
53
|
+
// customer: 1,
|
|
54
|
+
identifier: 1, orderDate: 1, orderNumber: 1, orderStatus: 1,
|
|
55
|
+
// orderedItem: 1,
|
|
56
|
+
// paymentMethods: 1,
|
|
57
|
+
price: 1, priceCurrency: 1, project: 1,
|
|
58
|
+
// seller: 1,
|
|
59
|
+
typeOf: 1
|
|
60
|
+
},
|
|
61
|
+
exclusion: {}
|
|
53
62
|
}
|
|
54
63
|
);
|
|
55
|
-
|
|
64
|
+
// tslint:disable-next-line:no-null-keyword
|
|
65
|
+
console.dir(orders, { depth: null });
|
|
56
66
|
console.log(orders.length, 'orders found');
|
|
57
67
|
}
|
|
58
68
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as client from '@sendgrid/client';
|
|
4
|
+
|
|
5
|
+
// tslint:disable-next-line:max-func-body-length
|
|
6
|
+
async function main() {
|
|
7
|
+
client.setApiKey(<string>process.env.SENDGRID_API_KEY);
|
|
8
|
+
|
|
9
|
+
const queryParams = {
|
|
10
|
+
// "query": "from_email=\"email@example.com\"",
|
|
11
|
+
// "limit": 10
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const request = {
|
|
15
|
+
url: `/v3/messages`,
|
|
16
|
+
method: 'GET',
|
|
17
|
+
qs: queryParams
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
client.request(request)
|
|
21
|
+
.then(([response, body]) => {
|
|
22
|
+
console.log(response.statusCode);
|
|
23
|
+
console.log(response.body, body);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
console.error(error);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main()
|
|
32
|
+
.then()
|
|
33
|
+
.catch(console.error);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface IOptions {
|
|
2
|
+
engineId: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* GoogleCustomSearch認証情報
|
|
7
|
+
*/
|
|
8
|
+
declare class CustomSearchCredentials {
|
|
9
|
+
readonly engineId: string;
|
|
10
|
+
readonly apiKey: string;
|
|
11
|
+
constructor(options: IOptions);
|
|
12
|
+
}
|
|
13
|
+
export { CustomSearchCredentials };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomSearchCredentials = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* GoogleCustomSearch認証情報
|
|
6
|
+
*/
|
|
7
|
+
class CustomSearchCredentials {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
const { engineId, apiKey } = options;
|
|
10
|
+
this.engineId = engineId;
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CustomSearchCredentials = CustomSearchCredentials;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface IOptions {
|
|
2
|
+
url: string;
|
|
3
|
+
accessToken: string;
|
|
4
|
+
accessTokenAlert: string;
|
|
5
|
+
accessTokenInfo: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 通知認証情報
|
|
9
|
+
*/
|
|
10
|
+
declare class LINENotifyCredentials {
|
|
11
|
+
readonly url: string;
|
|
12
|
+
readonly accessToken: string;
|
|
13
|
+
readonly accessTokenAlert: string;
|
|
14
|
+
readonly accessTokenInfo: string;
|
|
15
|
+
constructor(options: IOptions);
|
|
16
|
+
}
|
|
17
|
+
export { LINENotifyCredentials };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LINENotifyCredentials = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 通知認証情報
|
|
6
|
+
*/
|
|
7
|
+
class LINENotifyCredentials {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
const { url, accessToken, accessTokenAlert, accessTokenInfo } = options;
|
|
10
|
+
this.url = url;
|
|
11
|
+
this.accessToken = accessToken;
|
|
12
|
+
this.accessTokenAlert = accessTokenAlert;
|
|
13
|
+
this.accessTokenInfo = accessTokenInfo;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.LINENotifyCredentials = LINENotifyCredentials;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendGridCredentials = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* SendGrid認証情報
|
|
6
|
+
*/
|
|
7
|
+
class SendGridCredentials {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
const { apiKey } = options;
|
|
10
|
+
this.apiKey = apiKey;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SendGridCredentials = SendGridCredentials;
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CustomSearchCredentials } from './credentials/customSearch';
|
|
2
2
|
import type { JWTCredentials } from './credentials/jwt';
|
|
3
|
+
import type { LINENotifyCredentials } from './credentials/lineNotify';
|
|
4
|
+
import type { SendGridCredentials } from './credentials/sendGrid';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* 外部サービス認証情報
|
|
5
7
|
*/
|
|
6
8
|
export declare namespace credentials {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
const lineNotify: {
|
|
12
|
-
url: string | undefined;
|
|
13
|
-
accessToken: string | undefined;
|
|
14
|
-
accessTokenAlert: string | undefined;
|
|
15
|
-
accessTokenInfo: string | undefined;
|
|
16
|
-
};
|
|
17
|
-
const sendGrid: {
|
|
18
|
-
apiKey: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
type COA = COACredentials;
|
|
21
|
-
namespace COA {
|
|
22
|
-
function createInstance(...params: ConstructorParameters<typeof COACredentials>): Promise<COACredentials>;
|
|
9
|
+
type CustomSearch = CustomSearchCredentials;
|
|
10
|
+
namespace CustomSearch {
|
|
11
|
+
function createInstance(...params: ConstructorParameters<typeof CustomSearchCredentials>): Promise<CustomSearchCredentials>;
|
|
23
12
|
}
|
|
24
13
|
type JWT = JWTCredentials;
|
|
25
14
|
namespace JWT {
|
|
26
15
|
function createInstance(...params: ConstructorParameters<typeof JWTCredentials>): Promise<JWTCredentials>;
|
|
27
16
|
}
|
|
17
|
+
type LINENotify = LINENotifyCredentials;
|
|
18
|
+
namespace LINENotify {
|
|
19
|
+
function createInstance(...params: ConstructorParameters<typeof LINENotifyCredentials>): Promise<LINENotifyCredentials>;
|
|
20
|
+
}
|
|
21
|
+
type SendGrid = SendGridCredentials;
|
|
22
|
+
namespace SendGrid {
|
|
23
|
+
function createInstance(...params: ConstructorParameters<typeof SendGridCredentials>): Promise<SendGridCredentials>;
|
|
24
|
+
}
|
|
28
25
|
}
|