@chevre/domain 23.0.0-alpha.2 → 23.0.0-alpha.21

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 (62) hide show
  1. package/example/src/chevre/assetTransaction/processReserve.ts +102 -40
  2. package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
  3. package/example/src/chevre/note/findNotes.ts +34 -0
  4. package/example/src/chevre/note/upsertNotesByIdentifier.ts +10 -5
  5. package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
  6. package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
  7. package/example/src/chevre/product/findHasOfferCatalog.ts +31 -0
  8. package/example/src/chevre/reIndex.ts +1 -3
  9. package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +48 -0
  10. package/example/src/chevre/roles/{addAdminProductOfferPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +20 -19
  11. package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
  12. package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
  13. package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
  14. package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
  15. package/example/src/chevre/unsetUnnecessaryFields.ts +5 -7
  16. package/example/src/objectId.ts +12 -0
  17. package/example/src/signPayload.ts +12 -7
  18. package/lib/chevre/errorHandler.d.ts +6 -2
  19. package/lib/chevre/errorHandler.js +18 -2
  20. package/lib/chevre/repo/categoryCode.d.ts +50 -7
  21. package/lib/chevre/repo/categoryCode.js +56 -15
  22. package/lib/chevre/repo/event.d.ts +14 -11
  23. package/lib/chevre/repo/event.js +44 -35
  24. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
  25. package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
  26. package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +2 -2
  27. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +5 -14
  28. package/lib/chevre/repo/mongoose/schemas/note.js +9 -0
  29. package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
  30. package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
  31. package/lib/chevre/repo/note.d.ts +2 -9
  32. package/lib/chevre/repo/note.js +52 -18
  33. package/lib/chevre/repo/noteAboutOrder.d.ts +4 -0
  34. package/lib/chevre/repo/noteAboutOrder.js +17 -0
  35. package/lib/chevre/repo/offerCatalog.d.ts +17 -2
  36. package/lib/chevre/repo/offerCatalog.js +5 -2
  37. package/lib/chevre/repo/product.js +15 -14
  38. package/lib/chevre/repo/productHasOfferCatalog.d.ts +43 -0
  39. package/lib/chevre/repo/productHasOfferCatalog.js +71 -0
  40. package/lib/chevre/repository.d.ts +5 -0
  41. package/lib/chevre/repository.js +14 -1
  42. package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
  43. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
  44. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
  45. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
  46. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
  47. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
  48. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -138
  49. package/lib/chevre/service/event.js +1 -1
  50. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
  51. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
  52. package/lib/chevre/service/offer/onEventChanged.js +2 -1
  53. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +19 -105
  54. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  55. package/lib/chevre/service/task/onResourceUpdated.js +1 -1
  56. package/package.json +4 -4
  57. package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
  58. package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
  59. package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
  60. package/example/src/chevre/searchPaymentServices.ts +0 -32
  61. package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +0 -50
  62. package/example/src/chevre/unsetUnnecessaryFieldsInTransaction.ts +0 -46
@@ -10,118 +10,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.validateStartRequest = validateStartRequest;
13
- const jwt = require("jsonwebtoken");
14
13
  const moment = require("moment");
15
14
  const factory = require("../../../factory");
16
- function verifyOfferedByToken(params) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- let result;
19
- const { issuer, secret, token } = params;
20
- try {
21
- result = yield new Promise((resolve, reject) => {
22
- jwt.verify(token, secret, {
23
- issuer
24
- // ...(Array.isArray(params.audience)) ? { audience: params.audience } : undefined
25
- }, (err, decoded) => {
26
- if (err instanceof Error) {
27
- reject(err);
28
- }
29
- else {
30
- resolve(decoded);
31
- }
32
- });
33
- });
34
- }
35
- catch (error) {
36
- // JWTエラーをハンドリング
37
- if (error instanceof jwt.TokenExpiredError) {
38
- throw new factory.errors.Argument('memberOfToken', `invalid token. [${error.message} expiredAt:${error.expiredAt}]`);
39
- }
40
- else if (error instanceof jwt.JsonWebTokenError) {
41
- throw new factory.errors.Argument('memberOfToken', `invalid token. [${error.message}]`);
42
- }
43
- throw error;
44
- }
45
- return result;
46
- });
47
- }
15
+ const validateIssuedOfferIfExists_1 = require("./validateStartRequest/validateIssuedOfferIfExists");
16
+ const validateMemberTierIfExists_1 = require("./validateStartRequest/validateMemberTierIfExists");
48
17
  function validateStartRequest(params) {
49
18
  return (repos) => __awaiter(this, void 0, void 0, function* () {
50
- var _a, _b, _c;
19
+ var _a;
51
20
  const now = params.now;
52
21
  const event = params.event;
53
22
  if (params.validateEventOfferPeriod === true) {
54
23
  if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
55
24
  throw new factory.errors.NotFound('store.id');
56
25
  }
57
- const tokenizedMemberProgramTier = (_c = (_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.offers) === null || _c === void 0 ? void 0 : _c.validForMemberTier;
58
- yield validateEventOfferPeriod(Object.assign({ event,
59
- now, availableAt: { id: params.store.id } }, (typeof (tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token) === 'string') ? { tokenizedMemberProgramTier } : undefined))(repos);
26
+ yield validateApplicationOffer({
27
+ event,
28
+ now,
29
+ availableAt: { id: params.store.id },
30
+ object: params.object
31
+ })(repos);
60
32
  }
61
33
  if (params.validateEvent === true) {
62
34
  validateEvent({ event, object: params.object });
63
35
  }
64
36
  });
65
37
  }
66
- function validateMemberTier(params) {
67
- return (repos) => __awaiter(this, void 0, void 0, function* () {
68
- var _a, _b, _c, _d, _e;
69
- const { acceptedDate, event, verifiedValidForMemberTier, memberProgramIdentifierMustBe, aggregateOfferIdentifier } = params;
70
- const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
71
- const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
72
- if (typeof tierIdentifier !== 'string') {
73
- throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'tier identifier must be string');
74
- }
75
- if (typeof memberProgramIdentifier !== 'string') {
76
- throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program must be string');
77
- }
78
- if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
79
- throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program not matched');
80
- }
81
- const sellerId = event.offers.seller.id;
82
- if (typeof sellerId !== 'string' || sellerId === '') {
83
- throw new factory.errors.NotFound('event.offers.seller.id');
84
- }
85
- // 有効なプロダクトオファーを検証
86
- const productOfferForMemberTier = (yield repos.productOffer.findProductOffers({
87
- limit: 1,
88
- page: 1,
89
- project: { id: { $eq: event.project.id } },
90
- // availableAtOrFrom: { id: { $eq: availableAt.id } },
91
- itemOffered: { identifier: { $eq: aggregateOfferIdentifier } }, // オファーコレクションコード
92
- validForMemberTier: { identifier: { $eq: tierIdentifier } },
93
- validFrom: { $lte: acceptedDate.toDate() },
94
- validThrough: { $gte: acceptedDate.toDate() },
95
- offeredBy: { id: { $eq: sellerId } } // オファー提供者も検証する
96
- }, ['identifier'])).shift();
97
- if (productOfferForMemberTier === undefined) {
98
- throw new factory.errors.NotFound(factory.offerType.Offer, 'valid product offers for member tier not found');
99
- }
100
- // let validThroughMoment: moment.Moment;
101
- // let validFromMoment: moment.Moment;
102
- // validThroughMoment = moment(productOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
103
- // validFromMoment = moment(productOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
104
- // if (acceptedDate.isBefore(validFromMoment)) {
105
- // throw new factory.errors.Argument(
106
- // 'reservationFor.offers.validForMemberTier',
107
- // `the offer id valid from ${validFromMoment}`
108
- // );
109
- // }
110
- // if (acceptedDate.isAfter(validThroughMoment)) {
111
- // throw new factory.errors.Argument(
112
- // 'reservationFor.offers.validForMemberTier',
113
- // `the offer id valid through ${validThroughMoment}`
114
- // );
115
- // }
116
- });
117
- }
118
38
  /**
119
- * イベントのオファー有効期間を検証する
39
+ * アプリケーションごとのオファーを検証する
120
40
  */
121
- function validateEventOfferPeriod(params) {
41
+ function validateApplicationOffer(params) {
122
42
  return (repos) => __awaiter(this, void 0, void 0, function* () {
123
- var _a, _b;
124
- const { event, availableAt, tokenizedMemberProgramTier } = params;
43
+ const { event, availableAt } = params;
125
44
  const acceptedDate = moment(params.now);
126
45
  const eventOffers = event.offers;
127
46
  // アプリケーションごとの設定を参照する(2022-11-19~)
@@ -149,51 +68,19 @@ function validateEventOfferPeriod(params) {
149
68
  }
150
69
  }
151
70
  // 有効メンバープログラムティアが存在する場合
152
- // support validForMemberTier(2025-05-14~)
153
- const validForMemberTierExists = ((_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.typeOf) === 'MemberProgramTier';
154
- if (validForMemberTierExists) {
155
- const validForMemberTierToken = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token;
156
- const memberProgramIdentifierMustBe = (_b = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.isTierOf) === null || _b === void 0 ? void 0 : _b.identifier;
157
- // ティアトークンが必須
158
- if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
159
- throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.token');
160
- }
161
- // メンバープログラムコード指定が必須
162
- if (typeof memberProgramIdentifierMustBe !== 'string' || memberProgramIdentifierMustBe === '') {
163
- throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.isTierOf.identifier');
164
- }
165
- // 有効メンバープログラムティアが存在する場合、オファーコレクションコードが必須
166
- const aggregateOfferIdentifier = eventOffers.identifier;
167
- if (typeof aggregateOfferIdentifier !== 'string' || aggregateOfferIdentifier === '') {
168
- throw new factory.errors.NotFound('makesOfferOnApplication.identifier');
169
- }
170
- // トークン検証
171
- const memberProgram = (yield repos.memberProgram.projectMemberPrograms({
172
- limit: 1,
173
- page: 1,
174
- project: { id: { $eq: params.event.project.id } },
175
- identifier: { $eq: memberProgramIdentifierMustBe }
176
- })).shift();
177
- if (memberProgram === undefined) {
178
- throw new factory.errors.NotFound('MemberProgram', `MemberProgram '${memberProgramIdentifierMustBe}' not found`);
179
- }
180
- const issuer = yield repos.issuer.findByIdentifier({
181
- project: { id: params.event.project.id },
182
- identifier: memberProgram.hostingOrganization.identifier
183
- });
184
- if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
185
- throw new factory.errors.NotFound('issuer.tokenSecret');
186
- }
187
- const verifiedValidForMemberTier = yield verifyOfferedByToken({
188
- secret: issuer.tokenSecret,
189
- issuer: issuer.url,
190
- token: validForMemberTierToken
191
- });
192
- yield validateMemberTier({
193
- event, acceptedDate, verifiedValidForMemberTier,
194
- memberProgramIdentifierMustBe, aggregateOfferIdentifier
195
- })(repos);
196
- }
71
+ yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
72
+ event,
73
+ now: params.now,
74
+ object: params.object,
75
+ makesOfferOnApplication
76
+ })(repos);
77
+ // オファートークン検証(2025-10-21~)
78
+ yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
79
+ event,
80
+ now: params.now,
81
+ object: params.object,
82
+ makesOfferOnApplication
83
+ })(repos);
197
84
  });
198
85
  }
199
86
  /**
@@ -239,7 +239,7 @@ function saveScreeningEventSeries(params) {
239
239
  kubunClass: '043'
240
240
  });
241
241
  debug('kubunNames found.');
242
- const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
242
+ const availablePaymentMethodTypes = yield repos.categoryCode.projectCategoryCodeFields({
243
243
  project: { id: { $eq: params.project.id } },
244
244
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
245
245
  }, ['additionalProperty', 'codeValue']);
@@ -53,15 +53,15 @@ function authorize(params) {
53
53
  'superEvent', 'typeOf', 'identifier', 'name'
54
54
  ] // optimize(2024-07-18~)
55
55
  );
56
- const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
56
+ const availablePaymentMethodTypes = yield repos.categoryCode.projectCategoryCodeFields({
57
57
  project: { id: { $eq: transaction.project.id } },
58
58
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
59
59
  }, []);
60
- const seatingTypes = yield repos.categoryCode.projectFields({
60
+ const seatingTypes = yield repos.categoryCode.projectCategoryCodeFields({
61
61
  project: { id: { $eq: transaction.project.id } },
62
62
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
63
63
  }, []);
64
- const videoFormatTypes = yield repos.categoryCode.projectFields({
64
+ const videoFormatTypes = yield repos.categoryCode.projectCategoryCodeFields({
65
65
  project: { id: { $eq: transaction.project.id } },
66
66
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
67
67
  }, []);
@@ -79,15 +79,15 @@ function changeOffers(params) {
79
79
  'superEvent', 'typeOf', 'identifier', 'name'
80
80
  ] // optimize(2024-07-18~)
81
81
  );
82
- const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
82
+ const availablePaymentMethodTypes = yield repos.categoryCode.projectCategoryCodeFields({
83
83
  project: { id: { $eq: transaction.project.id } },
84
84
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
85
85
  }, []);
86
- const seatingTypes = yield repos.categoryCode.projectFields({
86
+ const seatingTypes = yield repos.categoryCode.projectCategoryCodeFields({
87
87
  project: { id: { $eq: transaction.project.id } },
88
88
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
89
89
  }, []);
90
- const videoFormatTypes = yield repos.categoryCode.projectFields({
90
+ const videoFormatTypes = yield repos.categoryCode.projectCategoryCodeFields({
91
91
  project: { id: { $eq: transaction.project.id } },
92
92
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
93
93
  }, []);
@@ -160,7 +160,8 @@ function createInformTasks(params, setting) {
160
160
  );
161
161
  // 最適化(2024-03-25~)
162
162
  events4inform = screeningEventSeries4inform.map(({ project, organizer, typeOf, name, location, id, videoFormat, soundFormat, workPerformed, kanaName, eventStatus, endDate, startDate, additionalProperty, subtitleLanguage, dubLanguage, alternativeHeadline, description, duration, headline }) => {
163
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ project, organizer, typeOf, name, location, id, videoFormat, soundFormat, workPerformed, kanaName, eventStatus }, (endDate !== undefined) ? { endDate } : undefined), (startDate !== undefined) ? { startDate } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (subtitleLanguage !== undefined) ? {} : undefined), (dubLanguage !== undefined) ? { dubLanguage } : undefined), (alternativeHeadline !== undefined) ? { alternativeHeadline } : undefined), (description !== undefined) ? { description } : undefined), (typeof duration === 'string') ? { duration } : undefined), (headline !== undefined) ? { headline } : undefined);
163
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ project, organizer, typeOf, name, location, id, videoFormat, soundFormat, workPerformed, kanaName, eventStatus,
164
+ endDate, startDate }, (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (subtitleLanguage !== undefined) ? {} : undefined), (dubLanguage !== undefined) ? { dubLanguage } : undefined), (alternativeHeadline !== undefined) ? { alternativeHeadline } : undefined), (description !== undefined) ? { description } : undefined), (typeof duration === 'string') ? { duration } : undefined), (headline !== undefined) ? { headline } : undefined);
164
165
  });
165
166
  }
166
167
  if (events4inform.length > 0) {
@@ -4,105 +4,7 @@ exports.tour2creatingEvent = tour2creatingEvent;
4
4
  exports.schedule2tours = schedule2tours;
5
5
  const moment = require("moment-timezone");
6
6
  const factory = require("../../../../factory");
7
- // tslint:disable-next-line:max-func-body-length
8
- // function schedule2createEventParams(
9
- // schedule: factory.schedule.IEventWithSchedule,
10
- // createDate: Date
11
- // ): factory.event.screeningEvent.ICreateParams[] {
12
- // const eventServiceId = schedule.offers?.itemOffered?.id;
13
- // const makesOffer = schedule.offers?.seller?.makesOffer;
14
- // const applicationIds: string[] = (Array.isArray(makesOffer))
15
- // ? makesOffer.map(({ availableAtOrFrom }) => availableAtOrFrom.id)
16
- // : [];
17
- // const eventSeriesId = schedule.superEvent?.id;
18
- // if (typeof eventServiceId !== 'string' || eventServiceId === '') {
19
- // throw new factory.errors.NotFound('schedule.offers.itemOffered.id');
20
- // }
21
- // if (typeof eventSeriesId !== 'string' || eventSeriesId === '') {
22
- // throw new factory.errors.NotFound('schedule.superEvent.id');
23
- // }
24
- // // 引数情報取得
25
- // if (schedule.eventSchedule === undefined) {
26
- // throw new factory.errors.NotFound('eventSchedule');
27
- // }
28
- // const targetInfo = getTargetInfoByEventWithSchedule(schedule, createDate);
29
- // debug(targetInfo.length, 'targetInfos ->', targetInfo);
30
- // const createParams: factory.event.screeningEvent.ICreateParams[] = [];
31
- // for (const performanceInfo of targetInfo) {
32
- // const oldEventId = [
33
- // // tslint:disable-next-line:no-magic-numbers
34
- // performanceInfo.day.slice(-6),
35
- // workPerformedIdentifier,
36
- // movieTheater.branchCode,
37
- // screeningRoom.branchCode,
38
- // performanceInfo.start_time
39
- // ].join('');
40
- // const maxValue = movieTheater.offers?.eligibleQuantity?.maxValue;
41
- // const availabilityEnds: Date = moment(performanceInfo.end_date)
42
- // .tz('Asia/Tokyo')
43
- // .endOf('date')
44
- // .toDate();
45
- // const availabilityStarts: Date = moment(performanceInfo.start_date)
46
- // .tz('Asia/Tokyo')
47
- // .startOf('date')
48
- // // tslint:disable-next-line:no-magic-numbers
49
- // .add(-3, 'months')
50
- // .toDate();
51
- // const validThrough: Date = moment(performanceInfo.end_date)
52
- // .tz('Asia/Tokyo')
53
- // .endOf('date')
54
- // .toDate();
55
- // const validFrom: Date = moment(performanceInfo.start_date)
56
- // .tz('Asia/Tokyo')
57
- // .startOf('date')
58
- // // tslint:disable-next-line:no-magic-numbers
59
- // .add(-3, 'months')
60
- // .toDate();
61
- // // イベント作成
62
- // createParams.push({
63
- // eventStatus: factory.eventStatusType.EventScheduled,
64
- // doorTime: performanceInfo.door_time,
65
- // startDate: performanceInfo.start_date,
66
- // endDate: performanceInfo.end_date,
67
- // offers: {
68
- // eligibleQuantity: {
69
- // ...(typeof maxValue === 'number') ? { maxValue } : undefined // ひとまず全座席予約可能なように
70
- // },
71
- // itemOffered: {
72
- // // 興行ID追加(2022-09-01~)
73
- // id: eventServiceId,
74
- // serviceOutput: {
75
- // typeOf: factory.reservationType.EventReservation,
76
- // reservedTicket: {
77
- // typeOf: 'Ticket',
78
- // ticketedSeat: { typeOf: factory.placeType.Seat }
79
- // }
80
- // },
81
- // },
82
- // seller: {
83
- // // event.offersにseller.makesOfferを追加(2022-11-18~)
84
- // makesOffer: applicationIds.map((applicationId) => {
85
- // return {
86
- // typeOf: factory.offerType.Offer,
87
- // availableAtOrFrom: { id: applicationId }, // support no-array(2024-10-13~),
88
- // availabilityEnds,
89
- // availabilityStarts,
90
- // validFrom,
91
- // validThrough
92
- // };
93
- // })
94
- // }
95
- // },
96
- // // 旧フォーマットIDを追加特性に追加(2022-09-08~)
97
- // additionalProperty: [
98
- // { name: 'tourNumber', value: String(performanceInfo.tour_number) },
99
- // { name: 'oldEventId', value: oldEventId }
100
- // ],
101
- // identifier: oldEventId
102
- // });
103
- // }
104
- // return createParams;
105
- // }
7
+ const TIMEZONE = 'Asia/Tokyo';
106
8
  // tslint:disable-next-line:max-func-body-length
107
9
  function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicationMembers, maxValue, eventService, screeningEventSeries, project) {
108
10
  var _a;
@@ -115,22 +17,34 @@ function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicati
115
17
  screeningRoom.branchCode,
116
18
  tour.start_time
117
19
  ].join('');
20
+ // 00:00:00で再実装(2025-10-09~)
21
+ // const availabilityEnds: Date = moment(tour.end_date)
22
+ // .tz(TIMEZONE)
23
+ // .endOf('date')
24
+ // .toDate();
118
25
  const availabilityEnds = moment(tour.end_date)
119
- .tz('Asia/Tokyo')
120
- .endOf('date')
26
+ .tz(TIMEZONE)
27
+ .startOf('date')
28
+ .add(1, 'day')
121
29
  .toDate();
122
30
  const availabilityStarts = moment(tour.start_date)
123
- .tz('Asia/Tokyo')
31
+ .tz(TIMEZONE)
124
32
  .startOf('date')
125
33
  // tslint:disable-next-line:no-magic-numbers
126
34
  .add(-3, 'months')
127
35
  .toDate();
36
+ // 00:00:00で再実装(2025-10-09~)
37
+ // const validThrough: Date = moment(tour.end_date)
38
+ // .tz(TIMEZONE)
39
+ // .endOf('date')
40
+ // .toDate();
128
41
  const validThrough = moment(tour.end_date)
129
- .tz('Asia/Tokyo')
130
- .endOf('date')
42
+ .tz(TIMEZONE)
43
+ .startOf('date')
44
+ .add(1, 'day')
131
45
  .toDate();
132
46
  const validFrom = moment(tour.start_date)
133
- .tz('Asia/Tokyo')
47
+ .tz(TIMEZONE)
134
48
  .startOf('date')
135
49
  // tslint:disable-next-line:no-magic-numbers
136
50
  .add(-3, 'months')
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
29
29
  }
30
30
  else {
31
31
  for (const categoryCodeId of params.ids) {
32
- const syncingCategoryCode = (yield repos.categoryCode.projectFields({
32
+ const syncingCategoryCode = (yield repos.categoryCode.projectCategoryCodeFields({
33
33
  limit: 1,
34
34
  page: 1,
35
35
  project: { id: { $eq: params.project.id } },
@@ -348,7 +348,7 @@ function createInformCategoryCodeTasks(params, setting) {
348
348
  // settings: Settings
349
349
  ) => __awaiter(this, void 0, void 0, function* () {
350
350
  var _a;
351
- const categoryCodes4inform = yield repos.categoryCode.projectFields({
351
+ const categoryCodes4inform = yield repos.categoryCode.projectCategoryCodeFields({
352
352
  id: { $in: params.ids },
353
353
  // ひとまずDistributorTypeのみ
354
354
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
package/package.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "5.0.0-alpha.2",
15
- "@cinerino/sdk": "12.5.0-alpha.2",
14
+ "@chevre/factory": "5.1.0",
15
+ "@cinerino/sdk": "12.6.0-alpha.5",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
18
18
  "@sendgrid/client": "8.1.4",
@@ -27,7 +27,7 @@
27
27
  "moment-timezone": "^0.5.33",
28
28
  "node-fpe": "1.0.0",
29
29
  "pug": "^2.0.4",
30
- "uniqid": "^5.4.0",
30
+ "uniqid": "5.4.0",
31
31
  "uuid": "^3.4.0"
32
32
  },
33
33
  "description": "Chevre Domain Library for Node.js",
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "23.0.0-alpha.2"
118
+ "version": "23.0.0-alpha.21"
119
119
  }
@@ -1,32 +0,0 @@
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 eventSellerMakesOfferRepo = await chevre.repository.EventSellerMakesOffer.createInstance(mongoose.connection);
12
- const result = await eventSellerMakesOfferRepo.aggregateMakesOffer(
13
- {
14
- limit: 10,
15
- page: 1,
16
- // id: { $eq: 'bm0f0cadu' },
17
- // typeOf: chevre.factory.eventType.ScreeningEvent,
18
- project: { id: { $eq: project.id } },
19
- availableAtOrFrom: { id: { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' } },
20
- itemOffered: {
21
- serviceOutput: { reservationFor: { id: { $in: ['bm0f0cadu', 'blco2394l'] } } }
22
- }
23
- }
24
- );
25
- // tslint:disable-next-line:no-null-keyword
26
- console.dir(result, { depth: null });
27
- console.dir(result.length, 'results found');
28
- }
29
-
30
- main()
31
- .then(console.log)
32
- .catch(console.error);
@@ -1,31 +0,0 @@
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 categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
12
-
13
- const categoryCodes = await categoryCodeRepo.searchByAggregate(
14
- {
15
- limit: 100,
16
- page: 1,
17
- sort: { codeValue: chevre.factory.sortType.Ascending }
18
- // id: { $eq: 'xxx' }
19
- // project: { id: { $eq: project.id } }
20
- // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
21
- // hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
22
- },
23
- ['id']
24
- );
25
- console.log('categoryCodes found', categoryCodes[0]);
26
- console.log(categoryCodes.length, 'categoryCodes found');
27
- }
28
-
29
- main()
30
- .then()
31
- .catch(console.error);
@@ -1,59 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- // const PROJECT_ID = process.env.PROJECT_ID;
7
- mongoose.Model.on('index', (...args) => {
8
- console.error('******** index event emitted. ********\n', args);
9
- });
10
-
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
15
- const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
16
- const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
17
- const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
18
-
19
- const result = await (await chevre.service.offer.createService()).event.searchOfferCatalogItems({
20
- event: {
21
- id: 'bm0f0cadm'
22
- },
23
- limit: 10,
24
- page: 1,
25
- options: { includedInDataCatalog: { id: 'blpj322ni' } }
26
- })({
27
- event: eventRepo,
28
- offerCatalog: offerCatalogRepo,
29
- offerCatalogItem: offerCatalogItemRepo,
30
- product: productRepo
31
- });
32
- console.log(result);
33
- console.log(result.length);
34
-
35
- // console.log('searching...');
36
- // const catalogs = await catalogItemRepo.search(
37
- // {
38
- // project: { id: { $eq: PROJECT_ID } },
39
- // sort: { identifier: chevre.factory.sortType.Descending },
40
- // limit: 2,
41
- // page: 1,
42
- // itemListElement: { typeOf: { $eq: 'Offer' } }
43
- // }
44
- // );
45
- // console.log(catalogs[0]?.id, typeof catalogs[0]?.id);
46
- // console.log(catalogs.length);
47
-
48
- // const numCatalogs = await catalogItemRepo.count(
49
- // {
50
- // project: { id: { $eq: PROJECT_ID } },
51
- // itemListElement: { typeOf: { $eq: 'Offer' } }
52
- // }
53
- // );
54
- // console.log('numCatalogs:', numCatalogs);
55
- }
56
-
57
- main()
58
- .then(console.log)
59
- .catch(console.error);
@@ -1,32 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import * as mongoose from 'mongoose';
3
- import { chevre } from '../../../lib/index';
4
-
5
- const project = { id: String(process.env.PROJECT_ID) };
6
-
7
- async function main() {
8
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
-
10
- const paymentServiceRepo = await chevre.repository.PaymentService.createInstance(mongoose.connection);
11
-
12
- const limit = 10;
13
- const page = 1;
14
- const docs = await paymentServiceRepo.projectFields(
15
- {
16
- limit,
17
- page,
18
- project: { id: { $eq: project.id } },
19
- availableChannel: { id: { $eq: 'xxx' } }
20
- },
21
- ['availableChannel', 'productID']
22
- );
23
- // tslint:disable-next-line:no-null-keyword
24
- console.dir(docs, { depth: null });
25
- console.log(docs.length, 'docs found');
26
- }
27
-
28
- main()
29
- .then(() => {
30
- console.log('success!');
31
- })
32
- .catch(console.error);