@chevre/domain 26.0.0-alpha.26 → 26.0.0-alpha.28

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 (34) hide show
  1. package/lib/chevre/repo/action.d.ts +1 -1
  2. package/lib/chevre/repo/action.js +0 -260
  3. package/lib/chevre/repo/adminTransaction.d.ts +131 -0
  4. package/lib/chevre/repo/adminTransaction.js +237 -0
  5. package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
  6. package/lib/chevre/repo/aggregateTransaction.js +166 -0
  7. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
  8. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +85 -76
  9. package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
  10. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
  11. package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
  12. package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → updateAction.d.ts} +5 -3
  13. package/lib/chevre/repo/mongoose/schemas/updateAction.js +65 -0
  14. package/lib/chevre/repo/transaction.d.ts +1 -187
  15. package/lib/chevre/repo/transaction.js +2 -383
  16. package/lib/chevre/repo/updateAction.d.ts +52 -0
  17. package/lib/chevre/repo/updateAction.js +429 -0
  18. package/lib/chevre/repository.d.ts +15 -5
  19. package/lib/chevre/repository.js +35 -13
  20. package/lib/chevre/service/aggregation/system.d.ts +2 -2
  21. package/lib/chevre/service/aggregation/system.js +2 -2
  22. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +2 -2
  23. package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
  24. package/lib/chevre/service/event.d.ts +2 -2
  25. package/lib/chevre/service/event.js +3 -3
  26. package/lib/chevre/service/task/deleteTransaction.js +2 -4
  27. package/lib/chevre/service/task/importEventsFromCOA.js +2 -2
  28. package/lib/chevre/service/task/syncResourcesFromCOA.js +11 -11
  29. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -2
  30. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  31. package/package.json +2 -2
  32. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -82
  33. package/lib/chevre/repo/ownershipInfo.d.ts +0 -20
  34. package/lib/chevre/repo/ownershipInfo.js +0 -130
@@ -0,0 +1,429 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateActionRepo = void 0;
4
+ const factory_1 = require("../factory");
5
+ const settings_1 = require("../settings");
6
+ const updateAction_1 = require("./mongoose/schemas/updateAction");
7
+ const AVAILABLE_PROJECT_FIELDS = [
8
+ 'project',
9
+ 'actionStatus',
10
+ 'typeOf',
11
+ 'agent',
12
+ 'result',
13
+ 'error',
14
+ 'object',
15
+ 'startDate',
16
+ 'endDate',
17
+ 'instrument',
18
+ 'targetCollection',
19
+ 'sameAs',
20
+ 'replacer',
21
+ ];
22
+ // 内部で正規化関数を定義(または外部ヘルパーを呼び出す)
23
+ function unknown2actionError(e) {
24
+ if (e instanceof Error) {
25
+ // Errorオブジェクトの場合は、既存のロジック通り展開
26
+ return { ...e, name: e.name, message: e.message };
27
+ }
28
+ else {
29
+ // Error以外(文字列など)が投げられた場合のハンドリング
30
+ return { name: 'UnknownError', message: String(e) };
31
+ }
32
+ }
33
+ ;
34
+ /**
35
+ * リソース編集アクションリポジトリ
36
+ */
37
+ class UpdateActionRepo {
38
+ updateActionModel;
39
+ constructor(connection) {
40
+ this.updateActionModel = connection.model(updateAction_1.modelName, (0, updateAction_1.createSchema)());
41
+ }
42
+ static CREATE_MONGO_CONDITIONS(params) {
43
+ const andConditions = [];
44
+ const idIn = params.id?.$in;
45
+ if (Array.isArray(idIn)) {
46
+ andConditions.push({ _id: { $in: idIn } });
47
+ }
48
+ const idNin = params.id?.$nin;
49
+ if (Array.isArray(idNin)) {
50
+ andConditions.push({ _id: { $nin: idNin } });
51
+ }
52
+ const projectIdEq = params.project?.id?.$eq;
53
+ if (typeof projectIdEq === 'string') {
54
+ andConditions.push({
55
+ 'project.id': {
56
+ $eq: projectIdEq
57
+ }
58
+ });
59
+ }
60
+ const agentTypeOfIn = params.agent?.typeOf?.$in;
61
+ if (Array.isArray(agentTypeOfIn)) {
62
+ andConditions.push({
63
+ 'agent.typeOf': {
64
+ $exists: true,
65
+ $in: agentTypeOfIn
66
+ }
67
+ });
68
+ }
69
+ const agentIdIn = params.agent?.id?.$in;
70
+ if (Array.isArray(agentIdIn)) {
71
+ andConditions.push({
72
+ 'agent.id': {
73
+ $exists: true,
74
+ $in: agentIdIn
75
+ }
76
+ });
77
+ }
78
+ const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
79
+ if (typeof instrumentTransactionNumberEq === 'string') {
80
+ andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
81
+ }
82
+ const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
83
+ if (typeof instrumentTypeOfEq === 'string') {
84
+ andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
85
+ }
86
+ const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
87
+ if (typeof instrumentIdentifierEq === 'string') {
88
+ andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
89
+ }
90
+ const instrumentIdEq = params.instrument?.id?.$eq;
91
+ if (typeof instrumentIdEq === 'string') {
92
+ andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
93
+ }
94
+ const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
95
+ if (typeof instrumentOrderNumberEq === 'string') {
96
+ andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
97
+ }
98
+ const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
99
+ if (typeof objectMovieTicketsIdentifierEq === 'string') {
100
+ andConditions.push({
101
+ 'object.movieTickets.identifier': {
102
+ $exists: true,
103
+ $eq: objectMovieTicketsIdentifierEq
104
+ }
105
+ });
106
+ }
107
+ const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
108
+ if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
109
+ andConditions.push({
110
+ 'object.movieTickets.serviceOutput.reservationFor.id': {
111
+ $exists: true,
112
+ $eq: objectMovieTicketsServiceOutputReservationForIdEq
113
+ }
114
+ });
115
+ }
116
+ const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
117
+ if (typeof objectPaymentMethodIdEq === 'string') {
118
+ andConditions.push({
119
+ 'object.paymentMethodId': {
120
+ $exists: true,
121
+ $eq: objectPaymentMethodIdEq
122
+ }
123
+ });
124
+ }
125
+ const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
126
+ if (typeof objectObjectPaymentMethodIdEq === 'string') {
127
+ andConditions.push({
128
+ 'object.object.paymentMethodId': {
129
+ $exists: true,
130
+ $eq: objectObjectPaymentMethodIdEq
131
+ }
132
+ });
133
+ }
134
+ const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
135
+ if (typeof objectReservationForIdEq === 'string') {
136
+ andConditions.push({
137
+ 'object.reservationFor.id': {
138
+ $exists: true,
139
+ $eq: objectReservationForIdEq
140
+ }
141
+ });
142
+ }
143
+ const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
144
+ if (typeof objectReservationNumberEq === 'string') {
145
+ andConditions.push({
146
+ 'object.reservationNumber': {
147
+ $exists: true,
148
+ $eq: objectReservationNumberEq
149
+ }
150
+ });
151
+ }
152
+ const objectReservationNumberIn = params.object?.reservationNumber?.$in;
153
+ if (Array.isArray(objectReservationNumberIn)) {
154
+ andConditions.push({
155
+ 'object.reservationNumber': {
156
+ $exists: true,
157
+ $in: objectReservationNumberIn
158
+ }
159
+ });
160
+ }
161
+ const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
162
+ if (typeof objectPaymentMethodAccountIdEq === 'string') {
163
+ andConditions.push({
164
+ 'object.paymentMethod.accountId': {
165
+ $exists: true,
166
+ $eq: objectPaymentMethodAccountIdEq
167
+ }
168
+ });
169
+ }
170
+ const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
171
+ if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
172
+ andConditions.push({
173
+ 'object.paymentMethod.paymentMethodId': {
174
+ $exists: true,
175
+ $eq: objectPaymentMethodPaymentMethodIdEq
176
+ }
177
+ });
178
+ }
179
+ const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
180
+ if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
181
+ andConditions.push({
182
+ 'object.paymentMethod.paymentMethodId': {
183
+ $exists: true,
184
+ $in: objectPaymentMethodPaymentMethodIdIn
185
+ }
186
+ });
187
+ }
188
+ const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
189
+ if (typeof objectPaymentMethodTypeOfEq === 'string') {
190
+ andConditions.push({
191
+ 'object.paymentMethod.typeOf': {
192
+ $exists: true,
193
+ $eq: objectPaymentMethodTypeOfEq
194
+ }
195
+ });
196
+ }
197
+ const objectTypeOfEq = params.object?.typeOf?.$eq;
198
+ if (typeof objectTypeOfEq === 'string') {
199
+ andConditions.push({
200
+ 'object.typeOf': {
201
+ $exists: true,
202
+ $eq: objectTypeOfEq
203
+ }
204
+ });
205
+ }
206
+ const objectTypeOfIn = params.object?.typeOf?.$in;
207
+ if (Array.isArray(objectTypeOfIn)) {
208
+ andConditions.push({
209
+ 'object.typeOf': {
210
+ $exists: true,
211
+ $in: objectTypeOfIn
212
+ }
213
+ });
214
+ }
215
+ const objectIdEq = params.object?.id?.$eq;
216
+ if (typeof objectIdEq === 'string') {
217
+ andConditions.push({
218
+ 'object.id': {
219
+ $exists: true,
220
+ $eq: objectIdEq
221
+ }
222
+ });
223
+ }
224
+ const objectIdIn = params.object?.id?.$in;
225
+ if (Array.isArray(objectIdIn)) {
226
+ andConditions.push({
227
+ 'object.id': {
228
+ $exists: true,
229
+ $in: objectIdIn
230
+ }
231
+ });
232
+ }
233
+ const objectOrderNumberIn = params.object?.orderNumber?.$in;
234
+ if (Array.isArray(objectOrderNumberIn)) {
235
+ andConditions.push({
236
+ 'object.orderNumber': {
237
+ $exists: true,
238
+ $in: objectOrderNumberIn
239
+ }
240
+ });
241
+ }
242
+ const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
243
+ if (typeof objectTransactionNumberEq === 'string') {
244
+ andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
245
+ }
246
+ if (typeof params.typeOf === 'string') {
247
+ andConditions.push({
248
+ typeOf: params.typeOf
249
+ });
250
+ }
251
+ else {
252
+ const typeOfEq = params.typeOf?.$eq;
253
+ if (typeof typeOfEq === 'string') {
254
+ andConditions.push({
255
+ typeOf: { $eq: typeOfEq }
256
+ });
257
+ }
258
+ }
259
+ const actionStatusIn = params.actionStatus?.$in;
260
+ if (Array.isArray(actionStatusIn)) {
261
+ andConditions.push({
262
+ actionStatus: { $in: actionStatusIn }
263
+ });
264
+ }
265
+ if (Array.isArray(params.actionStatusTypes)) {
266
+ andConditions.push({
267
+ actionStatus: { $in: params.actionStatusTypes }
268
+ });
269
+ }
270
+ const startDateGte = params.startFrom;
271
+ if (startDateGte instanceof Date) {
272
+ andConditions.push({
273
+ startDate: { $gte: startDateGte }
274
+ });
275
+ }
276
+ const startDateLte = params.startThrough;
277
+ if (startDateLte instanceof Date) {
278
+ andConditions.push({
279
+ startDate: { $lte: startDateLte }
280
+ });
281
+ }
282
+ const resultTypeOfIn = params.result?.typeOf?.$in;
283
+ if (Array.isArray(resultTypeOfIn)) {
284
+ andConditions.push({
285
+ 'result.typeOf': {
286
+ $exists: true,
287
+ $in: resultTypeOfIn
288
+ }
289
+ });
290
+ }
291
+ const resultIdIn = params.result?.id?.$in;
292
+ if (Array.isArray(resultIdIn)) {
293
+ andConditions.push({
294
+ 'result.id': {
295
+ $exists: true,
296
+ $in: resultIdIn
297
+ }
298
+ });
299
+ }
300
+ const resultOrderNumberIn = params.result?.orderNumber?.$in;
301
+ if (Array.isArray(resultOrderNumberIn)) {
302
+ andConditions.push({
303
+ 'result.orderNumber': {
304
+ $exists: true,
305
+ $in: resultOrderNumberIn
306
+ }
307
+ });
308
+ }
309
+ const resultCodeIn = params.result?.code?.$in;
310
+ if (Array.isArray(resultCodeIn)) {
311
+ andConditions.push({
312
+ 'result.code': {
313
+ $exists: true,
314
+ $in: resultCodeIn
315
+ }
316
+ });
317
+ }
318
+ const sameAsIdEq = params.sameAs?.id?.$eq;
319
+ if (typeof sameAsIdEq === 'string') {
320
+ andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
321
+ }
322
+ return andConditions;
323
+ }
324
+ /**
325
+ * アクション開始
326
+ */
327
+ async startUpdateAction(attributes) {
328
+ const startDate = new Date();
329
+ const creatingAction = {
330
+ ...attributes,
331
+ actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
332
+ startDate
333
+ };
334
+ const result = await this.updateActionModel.insertMany(creatingAction, { rawResult: true });
335
+ const id = result.insertedIds?.[0]?.toHexString();
336
+ if (typeof id !== 'string') {
337
+ throw new factory_1.factory.errors.Internal('action not saved');
338
+ }
339
+ return { id, startDate, typeOf: creatingAction.typeOf };
340
+ }
341
+ async completeUpdateAction(params) {
342
+ const doc = await this.updateActionModel.findOneAndUpdate({
343
+ _id: { $eq: params.id },
344
+ typeOf: { $eq: params.typeOf }
345
+ }, {
346
+ $set: {
347
+ actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
348
+ result: params.result,
349
+ endDate: new Date()
350
+ }
351
+ }, { new: false, projection: { _id: 1 } })
352
+ .lean()
353
+ .exec();
354
+ if (doc === null) {
355
+ throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
356
+ }
357
+ }
358
+ /**
359
+ * アクション失敗
360
+ */
361
+ async giveUpUpdateAction(params) {
362
+ const actionError = Array.isArray(params.error)
363
+ ? params.error.map(unknown2actionError)
364
+ : unknown2actionError(params.error);
365
+ const doc = await this.updateActionModel.findOneAndUpdate({
366
+ typeOf: { $eq: params.typeOf },
367
+ _id: { $eq: params.id }
368
+ }, {
369
+ $set: {
370
+ actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
371
+ error: actionError,
372
+ endDate: new Date()
373
+ }
374
+ }, { new: true, projection: { _id: 1 } })
375
+ .lean()
376
+ .exec();
377
+ if (doc === null) {
378
+ throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
379
+ }
380
+ }
381
+ async findUpdateActions(params, inclusion) {
382
+ const conditions = UpdateActionRepo.CREATE_MONGO_CONDITIONS(params);
383
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
384
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
385
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
386
+ }
387
+ const projection = {
388
+ _id: 0,
389
+ id: { $toString: '$_id' },
390
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
391
+ };
392
+ const query = this.updateActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
393
+ if (typeof params.limit === 'number' && params.limit > 0) {
394
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
395
+ query.limit(params.limit)
396
+ .skip(params.limit * (page - 1));
397
+ }
398
+ /* istanbul ignore else */
399
+ if (params.sort?.startDate !== undefined) {
400
+ query.sort({ startDate: params.sort.startDate });
401
+ }
402
+ // const explainResult = await (<any>query).explain();
403
+ // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
404
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
405
+ .lean() // 2024-08-26~
406
+ .exec();
407
+ }
408
+ async searchBySameAs(params) {
409
+ const projection = {
410
+ _id: 0,
411
+ id: { $toString: '$_id' },
412
+ actionStatus: 1,
413
+ error: 1,
414
+ purpose: 1
415
+ };
416
+ const query = this.updateActionModel.find({
417
+ typeOf: { $eq: params.typeOf.$eq },
418
+ 'sameAs.id': { $exists: true, $eq: params.sameAs.id.$eq },
419
+ ...(typeof params.purpose?.id.$eq === 'string')
420
+ ? { 'purpose.id': { $exists: true, $eq: params.purpose.id.$eq } }
421
+ : undefined
422
+ }, projection)
423
+ .limit(1);
424
+ return query
425
+ .lean()
426
+ .exec();
427
+ }
428
+ }
429
+ exports.UpdateActionRepo = UpdateActionRepo;
@@ -21,6 +21,7 @@ import type { AdminAssetTransactionRepo } from './repo/adminAssetTransaction';
21
21
  import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
22
22
  import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
23
23
  import type { AdminTaskRepo } from './repo/adminTask';
24
+ import type { AdminTransactionRepo } from './repo/adminTransaction';
24
25
  import type { AggregateActionRepo } from './repo/aggregateAction';
25
26
  import type { AggregateAssetTransactionRepo } from './repo/aggregateAssetTransaction';
26
27
  import type { AggregateOfferRepo } from './repo/aggregateOffer';
@@ -28,6 +29,7 @@ import type { AggregateOrderRepo } from './repo/aggregateOrder';
28
29
  import type { AggregateReservationRepo } from './repo/aggregateReservation';
29
30
  import type { AggregateScheduledTaskRepo } from './repo/aggregateScheduledTask';
30
31
  import type { AggregateTaskRepo } from './repo/aggregateTask';
32
+ import type { AggregateTransactionRepo } from './repo/aggregateTransaction';
31
33
  import type { AggregationRepo } from './repo/aggregation';
32
34
  import type { AssetTransactionRepo } from './repo/assetTransaction';
33
35
  import type { ReserveTransactionRepo } from './repo/assetTransaction/reserve';
@@ -58,7 +60,6 @@ import type { OfferCatalogItemRepo } from './repo/offerCatalogItem';
58
60
  import type { OfferItemConditionRepo } from './repo/offerItemCondition';
59
61
  import type { OrderRepo } from './repo/order';
60
62
  import type { OrderInTransactionRepo } from './repo/orderInTransaction';
61
- import type { OwnershipInfoRepo } from './repo/ownershipInfo';
62
63
  import type { PassportRepo } from './repo/passport';
63
64
  import type { PaymentServiceRepo } from './repo/paymentService';
64
65
  import type { PaymentServiceChannelRepo } from './repo/paymentServiceChannel';
@@ -102,6 +103,7 @@ import type { PlaceOrderRepo } from './repo/transaction/placeOrder';
102
103
  import type { ReturnOrderRepo } from './repo/transaction/returnOrder';
103
104
  import type { TransactionNumberRepo } from './repo/transactionNumber';
104
105
  import type { TransactionProcessRepo } from './repo/transactionProcess';
106
+ import type { UpdateActionRepo } from './repo/updateAction';
105
107
  import type { WebSiteRepo } from './repo/webSite';
106
108
  import type { ConfirmationNumberRepo } from './repo/confirmationNumber';
107
109
  import type { OrderNumberRepo } from './repo/orderNumber';
@@ -184,6 +186,10 @@ export type AdminTask = AdminTaskRepo;
184
186
  export declare namespace AdminTask {
185
187
  function createInstance(...params: ConstructorParameters<typeof AdminTaskRepo>): Promise<AdminTaskRepo>;
186
188
  }
189
+ export type AdminTransaction = AdminTransactionRepo;
190
+ export declare namespace AdminTransaction {
191
+ function createInstance(...params: ConstructorParameters<typeof AdminTransactionRepo>): Promise<AdminTransactionRepo>;
192
+ }
187
193
  export type AggregateAction = AggregateActionRepo;
188
194
  export declare namespace AggregateAction {
189
195
  function createInstance(...params: ConstructorParameters<typeof AggregateActionRepo>): Promise<AggregateActionRepo>;
@@ -196,6 +202,10 @@ export type AggregateTask = AggregateTaskRepo;
196
202
  export declare namespace AggregateTask {
197
203
  function createInstance(...params: ConstructorParameters<typeof AggregateTaskRepo>): Promise<AggregateTaskRepo>;
198
204
  }
205
+ export type AggregateTransaction = AggregateTransactionRepo;
206
+ export declare namespace AggregateTransaction {
207
+ function createInstance(...params: ConstructorParameters<typeof AggregateTransactionRepo>): Promise<AggregateTransactionRepo>;
208
+ }
199
209
  export type AggregateAssetTransaction = AggregateAssetTransactionRepo;
200
210
  export declare namespace AggregateAssetTransaction {
201
211
  function createInstance(...params: ConstructorParameters<typeof AggregateAssetTransactionRepo>): Promise<AggregateAssetTransactionRepo>;
@@ -342,10 +352,6 @@ export type OrderNumber = OrderNumberRepo;
342
352
  export declare namespace OrderNumber {
343
353
  function createInstance(...params: ConstructorParameters<typeof OrderNumberRepo>): Promise<OrderNumberRepo>;
344
354
  }
345
- export type OwnershipInfo = OwnershipInfoRepo;
346
- export declare namespace OwnershipInfo {
347
- function createInstance(...params: ConstructorParameters<typeof OwnershipInfoRepo>): Promise<OwnershipInfoRepo>;
348
- }
349
355
  export type Passport = PassportRepo;
350
356
  export declare namespace Passport {
351
357
  function createInstance(...params: ConstructorParameters<typeof PassportRepo>): Promise<PassportRepo>;
@@ -552,6 +558,10 @@ export declare namespace rateLimit {
552
558
  function createInstance(...params: ConstructorParameters<typeof OfferRateLimitRepo>): Promise<OfferRateLimitRepo>;
553
559
  }
554
560
  }
561
+ export type UpdateAction = UpdateActionRepo;
562
+ export declare namespace UpdateAction {
563
+ function createInstance(...params: ConstructorParameters<typeof UpdateActionRepo>): Promise<UpdateActionRepo>;
564
+ }
555
565
  export type WebSite = WebSiteRepo;
556
566
  export declare namespace WebSite {
557
567
  function createInstance(...params: ConstructorParameters<typeof WebSiteRepo>): Promise<WebSiteRepo>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
4
- exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = void 0;
3
+ exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
4
+ exports.WebSite = exports.UpdateAction = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
5
5
  var AcceptedOffer;
6
6
  (function (AcceptedOffer) {
7
7
  let repo;
@@ -214,6 +214,17 @@ var AdminTask;
214
214
  }
215
215
  AdminTask.createInstance = createInstance;
216
216
  })(AdminTask || (exports.AdminTask = AdminTask = {}));
217
+ var AdminTransaction;
218
+ (function (AdminTransaction) {
219
+ let repo;
220
+ async function createInstance(...params) {
221
+ if (repo === undefined) {
222
+ repo = (await import('./repo/adminTransaction.js')).AdminTransactionRepo;
223
+ }
224
+ return new repo(...params);
225
+ }
226
+ AdminTransaction.createInstance = createInstance;
227
+ })(AdminTransaction || (exports.AdminTransaction = AdminTransaction = {}));
217
228
  var AggregateAction;
218
229
  (function (AggregateAction) {
219
230
  let repo;
@@ -247,6 +258,17 @@ var AggregateTask;
247
258
  }
248
259
  AggregateTask.createInstance = createInstance;
249
260
  })(AggregateTask || (exports.AggregateTask = AggregateTask = {}));
261
+ var AggregateTransaction;
262
+ (function (AggregateTransaction) {
263
+ let repo;
264
+ async function createInstance(...params) {
265
+ if (repo === undefined) {
266
+ repo = (await import('./repo/aggregateTransaction.js')).AggregateTransactionRepo;
267
+ }
268
+ return new repo(...params);
269
+ }
270
+ AggregateTransaction.createInstance = createInstance;
271
+ })(AggregateTransaction || (exports.AggregateTransaction = AggregateTransaction = {}));
250
272
  var AggregateAssetTransaction;
251
273
  (function (AggregateAssetTransaction) {
252
274
  let repo;
@@ -646,17 +668,6 @@ var OrderNumber;
646
668
  }
647
669
  OrderNumber.createInstance = createInstance;
648
670
  })(OrderNumber || (exports.OrderNumber = OrderNumber = {}));
649
- var OwnershipInfo;
650
- (function (OwnershipInfo) {
651
- let repo;
652
- async function createInstance(...params) {
653
- if (repo === undefined) {
654
- repo = (await import('./repo/ownershipInfo.js')).OwnershipInfoRepo;
655
- }
656
- return new repo(...params);
657
- }
658
- OwnershipInfo.createInstance = createInstance;
659
- })(OwnershipInfo || (exports.OwnershipInfo = OwnershipInfo = {}));
660
671
  var Passport;
661
672
  (function (Passport) {
662
673
  let repo;
@@ -1182,6 +1193,17 @@ var rateLimit;
1182
1193
  Offer.createInstance = createInstance;
1183
1194
  })(Offer = rateLimit.Offer || (rateLimit.Offer = {}));
1184
1195
  })(rateLimit || (exports.rateLimit = rateLimit = {}));
1196
+ var UpdateAction;
1197
+ (function (UpdateAction) {
1198
+ let repo;
1199
+ async function createInstance(...params) {
1200
+ if (repo === undefined) {
1201
+ repo = (await import('./repo/updateAction.js')).UpdateActionRepo;
1202
+ }
1203
+ return new repo(...params);
1204
+ }
1205
+ UpdateAction.createInstance = createInstance;
1206
+ })(UpdateAction || (exports.UpdateAction = UpdateAction = {}));
1185
1207
  var WebSite;
1186
1208
  (function (WebSite) {
1187
1209
  let repo;
@@ -2,10 +2,10 @@ import type { AggregateActionRepo } from '../../repo/aggregateAction';
2
2
  import type { AggregateAssetTransactionRepo } from '../../repo/aggregateAssetTransaction';
3
3
  import type { AggregateScheduledTaskRepo } from '../../repo/aggregateScheduledTask';
4
4
  import type { AggregateTaskRepo } from '../../repo/aggregateTask';
5
+ import type { AggregateTransactionRepo } from '../../repo/aggregateTransaction';
5
6
  import type { AggregationRepo } from '../../repo/aggregation';
6
7
  import type { EventRepo } from '../../repo/event';
7
8
  import type { OrderRepo } from '../../repo/order';
8
- import type { TransactionRepo } from '../../repo/transaction';
9
9
  type AggregateDurationUnit = 'days' | 'hours';
10
10
  interface IAggregateParams {
11
11
  aggregateDate: Date;
@@ -37,7 +37,7 @@ declare function aggregatePlaceOrder(params: IAggregateParams & {
37
37
  clientIds?: string[];
38
38
  }): (repos: {
39
39
  agregation: AggregationRepo;
40
- transaction: TransactionRepo;
40
+ aggregateTransaction: AggregateTransactionRepo;
41
41
  }) => Promise<{
42
42
  aggregationCount: number;
43
43
  aggregateDuration: string;
@@ -134,7 +134,7 @@ function aggregatePlaceOrder(params) {
134
134
  .add(-i, params.aggregateDurationUnit)
135
135
  .endOf(params.aggregateDurationUnit)
136
136
  .toDate();
137
- const aggregateResult = await repos.transaction.aggregatePlaceOrder({
137
+ const aggregateResult = await repos.aggregateTransaction.aggregatePlaceOrder({
138
138
  project: { id: { $ne: params.excludedProjectId } },
139
139
  startFrom,
140
140
  startThrough,
@@ -144,7 +144,7 @@ function aggregatePlaceOrder(params) {
144
144
  const aggregateResultsByClientId = [];
145
145
  if (Array.isArray(params.clientIds)) {
146
146
  for (const clientId of params.clientIds) {
147
- const aggregateResultByClientId = await repos.transaction.aggregatePlaceOrder({
147
+ const aggregateResultByClientId = await repos.aggregateTransaction.aggregatePlaceOrder({
148
148
  project: { id: { $ne: params.excludedProjectId } },
149
149
  startFrom,
150
150
  startThrough,
@@ -1,5 +1,5 @@
1
1
  import type { COA } from '@motionpicture/coa-service';
2
- import type { ActionRepo } from '../../repo/action';
2
+ import type { UpdateActionRepo } from '../../repo/updateAction';
3
3
  import type { CategoryCodeRepo } from '../../repo/categoryCode';
4
4
  import type { MovieTheaterRepo } from '../../repo/place/movieTheater';
5
5
  import type { ScreeningRoomRepo } from '../../repo/place/screeningRoom';
@@ -9,7 +9,7 @@ import { IImportFromCOAParams } from './factory';
9
9
  type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
10
10
  declare function processUpdateMovieTheater(params: IImportFromCOAParams): (repos: {
11
11
  masterService: COA.service.Master;
12
- action: ActionRepo;
12
+ updateAction: UpdateActionRepo;
13
13
  categoryCode: CategoryCodeRepo;
14
14
  movieTheater: MovieTheaterRepo;
15
15
  screeningRoom: ScreeningRoomRepo;
@@ -20,7 +20,7 @@ function processUpdateMovieTheater(params) {
20
20
  },
21
21
  targetCollection: { typeOf: factory_1.factory.placeType.MovieTheater }
22
22
  };
23
- const action = await repos.action.start(actionAttributes);
23
+ const action = await repos.updateAction.startUpdateAction(actionAttributes);
24
24
  let seller;
25
25
  let movieTheater;
26
26
  let screeningRooms;
@@ -66,7 +66,7 @@ function processUpdateMovieTheater(params) {
66
66
  }
67
67
  catch (error) {
68
68
  try {
69
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
69
+ await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
70
70
  }
71
71
  catch (__) {
72
72
  // 失敗したら仕方ない
@@ -77,7 +77,7 @@ function processUpdateMovieTheater(params) {
77
77
  screeningRoomsCount: screeningRooms.length,
78
78
  ...(processTime !== undefined) ? { processTime } : undefined
79
79
  };
80
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
80
+ await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
81
81
  return { seller, movieTheater, screeningRooms };
82
82
  };
83
83
  }