@chevre/domain 26.1.0-alpha.3 → 26.1.0-alpha.5

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 (27) hide show
  1. package/lib/chevre/repo/action/acceptCOAOffer.d.ts +12 -3
  2. package/lib/chevre/repo/action/acceptCOAOffer.js +64 -11
  3. package/lib/chevre/repo/concurrentLock.js +18 -8
  4. package/lib/chevre/repo/concurrentLockAbstract.d.ts +0 -12
  5. package/lib/chevre/repo/factory/action/createMongoConditions.js +20 -18
  6. package/lib/chevre/repo/mongoose/schemas/action/acceptCOAOffer.d.ts +3 -0
  7. package/lib/chevre/repo/mongoose/schemas/action/acceptCOAOffer.js +3 -0
  8. package/lib/chevre/repo/mongoose/schemas/action.d.ts +3 -1
  9. package/lib/chevre/repo/mongoose/schemas/action.js +60 -112
  10. package/lib/chevre/repo/passport.js +0 -14
  11. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +1 -1
  12. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +1 -1
  13. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
  14. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +7 -3
  15. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +7 -7
  16. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +4 -2
  17. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +5 -5
  18. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  19. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +6 -6
  20. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +3 -1
  21. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +1 -2
  22. package/lib/chevre/service/task/acceptCOAOffer.js +9 -6
  23. package/lib/chevre/service/task/authorizePayment.js +0 -1
  24. package/lib/chevre/service/task/checkMovieTicket.js +0 -1
  25. package/lib/chevre/service/task/publishPaymentUrl.js +0 -2
  26. package/lib/chevre/service/task/voidReserveTransaction.js +0 -1
  27. package/package.json +2 -2
@@ -2,12 +2,16 @@ import type { Connection } from 'mongoose';
2
2
  import { factory } from '../../factory';
3
3
  import { IActionRecipe, IKeyOfProjection, ActionProcessRepo } from './anyAction/actionProcess';
4
4
  export type IAcceptCOAOfferAction = factory.action.accept.coaOffer.IAction;
5
+ type IAcceptCOAOfferActionAsFindResult = Pick<IAcceptCOAOfferAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'id' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'> & {
6
+ expires?: never;
7
+ cancelAction?: never;
8
+ };
5
9
  /**
6
10
  * COAオファー採用リポジトリ
7
11
  */
8
12
  export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptCOAOfferAction, IActionRecipe<factory.recipe.RecipeCategory.acceptCOAOffer>> {
9
13
  constructor(connection: Connection);
10
- findActionBySameAs(params: {
14
+ findAcceptCOAOfferActionBySameAs(params: {
11
15
  sameAs: {
12
16
  id: string;
13
17
  };
@@ -18,7 +22,7 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
18
22
  /**
19
23
  * 完了済の採用アクションを参照する
20
24
  */
21
- findCompletedById(params: {
25
+ findCompletedAcceptCOAOfferActionById(params: {
22
26
  project: {
23
27
  id: string;
24
28
  };
@@ -38,5 +42,10 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
38
42
  typeOf: factory.transactionType;
39
43
  id: string;
40
44
  };
41
- }): Promise<IAcceptCOAOfferAction[]>;
45
+ }): Promise<IAcceptCOAOfferActionAsFindResult[]>;
46
+ findAcceptCOAOfferActionById(params: {
47
+ typeOf: IAcceptCOAOfferAction['typeOf'];
48
+ id: string;
49
+ }): Promise<IAcceptCOAOfferActionAsFindResult>;
42
50
  }
51
+ export {};
@@ -2,7 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AcceptCOAOfferActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
+ const settings_1 = require("../../settings");
5
6
  const actionProcess_1 = require("./anyAction/actionProcess");
7
+ const defaultFindProjection = {
8
+ _id: 0,
9
+ id: { $toString: '$_id' },
10
+ project: 1,
11
+ actionStatus: 1,
12
+ typeOf: 1,
13
+ agent: 1,
14
+ result: 1,
15
+ error: 1,
16
+ object: 1,
17
+ startDate: 1,
18
+ endDate: 1,
19
+ purpose: 1,
20
+ potentialActions: 1,
21
+ instrument: 1,
22
+ sameAs: 1,
23
+ // 'cancelAction', // projectしなくてよいはず
24
+ };
6
25
  const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
7
26
  /**
8
27
  * COAオファー採用リポジトリ
@@ -14,7 +33,7 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
14
33
  recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
15
34
  });
16
35
  }
17
- async findActionBySameAs(params) {
36
+ async findAcceptCOAOfferActionBySameAs(params) {
18
37
  return this.actionModel.findOne({
19
38
  typeOf: { $eq: factory_1.factory.actionType.AcceptAction }, // 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
20
39
  'sameAs.id': { $exists: true, $eq: params.sameAs.id },
@@ -34,7 +53,7 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
34
53
  /**
35
54
  * 完了済の採用アクションを参照する
36
55
  */
37
- async findCompletedById(params, inclusion) {
56
+ async findCompletedAcceptCOAOfferActionById(params, inclusion) {
38
57
  let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
39
58
  if (Array.isArray(inclusion) && inclusion.length > 0) {
40
59
  positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
@@ -58,16 +77,50 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
58
77
  }
59
78
  return doc;
60
79
  }
80
+ // 基底クラスに非依存で再実装(2026-08-22~)
81
+ // public async findAcceptCOAOfferActionsByPurpose_(params: {
82
+ // /**
83
+ // * 注文取引でフィルター
84
+ // */
85
+ // purpose: {
86
+ // typeOf: factory.transactionType;
87
+ // id: string;
88
+ // };
89
+ // }): Promise<IAcceptCOAOfferAction[]> {
90
+ // return this.findAnyActionsByPurpose({
91
+ // ...params,
92
+ // typeOf: factory.actionType.AcceptAction,
93
+ // purpose: {
94
+ // typeOf: params.purpose.typeOf,
95
+ // id: params.purpose.id
96
+ // },
97
+ // object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
98
+ // });
99
+ // }
61
100
  async findAcceptCOAOfferActionsByPurpose(params) {
62
- return this.findAnyActionsByPurpose({
63
- ...params,
64
- typeOf: factory_1.factory.actionType.AcceptAction,
65
- purpose: {
66
- typeOf: params.purpose.typeOf,
67
- id: params.purpose.id
68
- },
69
- object: { typeOf: { $eq: factory_1.factory.offerType.AggregateOffer } }
70
- });
101
+ const filter = {
102
+ typeOf: { $eq: factory_1.factory.actionType.AcceptAction },
103
+ 'object.typeOf': { $exists: true, $eq: factory_1.factory.offerType.AggregateOffer },
104
+ 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf },
105
+ 'purpose.id': { $exists: true, $eq: params.purpose.id },
106
+ };
107
+ return this.actionModel.find(filter, defaultFindProjection)
108
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
109
+ .lean()
110
+ .exec();
111
+ }
112
+ // 基底クラスに非依存で再実装(2026-08-22~)
113
+ async findAcceptCOAOfferActionById(params) {
114
+ const doc = await this.actionModel.findOne({
115
+ typeOf: { $eq: params.typeOf },
116
+ _id: { $eq: params.id }
117
+ }, defaultFindProjection)
118
+ .lean() // 2024-08-26~
119
+ .exec();
120
+ if (doc === null) {
121
+ throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
122
+ }
123
+ return doc;
71
124
  }
72
125
  }
73
126
  exports.AcceptCOAOfferActionRepo = AcceptCOAOfferActionRepo;
@@ -17,16 +17,26 @@ class ConcurrentLockRepo {
17
17
  async lock(params) {
18
18
  const key = ConcurrentLockRepo.CREATE_REDIS_KEY(params);
19
19
  const value = params.audience.identifier;
20
- const results = await this.redisClient.multi()
21
- .setNX(key, value)
22
- .expireAt(key, params.expires)
23
- .exec();
24
- if (Array.isArray(results) && (results[0] === 1 || results[0] === true)) { // eslint-disable-line @typescript-eslint/no-explicit-any
20
+ // setNXは非推奨のため、setで再実装(2026-08-23~)
21
+ // const results = await this.redisClient.multi()
22
+ // .setNX(key, value)
23
+ // .expireAt(key, params.expires)
24
+ // .exec();
25
+ // if (Array.isArray(results) && (results[0] === 1 || (results as any)[0] === true)) { // eslint-disable-line @typescript-eslint/no-explicit-any
26
+ // return;
27
+ // } else {
28
+ // throw new factory.errors.AlreadyInUse(params.about.identifier, []);
29
+ // }
30
+ const expiresAtMs = params.expires.getTime();
31
+ const result = await this.redisClient.set(key, value, {
32
+ NX: true,
33
+ PXAT: expiresAtMs // Set the specified Unix time at which the key will expire, in milliseconds (a positive integer).
34
+ });
35
+ // 成功時は 'OK' が返り、既に存在してロック失敗した場合は null が返る
36
+ if (result === 'OK') {
25
37
  return;
26
38
  }
27
- else {
28
- throw new factory_1.factory.errors.AlreadyInUse(params.about.identifier, []);
29
- }
39
+ throw new factory_1.factory.errors.AlreadyInUse(params.about.identifier, []);
30
40
  }
31
41
  async unlock(params) {
32
42
  const key = ConcurrentLockRepo.CREATE_REDIS_KEY(params);
@@ -1,16 +1,4 @@
1
1
  import { factory } from '../factory';
2
- export interface IOffer {
3
- itemOffered?: {
4
- serviceOutput?: {
5
- /**
6
- * 予約ID
7
- */
8
- id?: string;
9
- };
10
- };
11
- seatSection: string;
12
- seatNumber: string;
13
- }
14
2
  export interface IAbout {
15
3
  identifier: string;
16
4
  typeOf: 'Thing';
@@ -57,24 +57,26 @@ function createMongoConditions(params) {
57
57
  if (typeof instrumentOrderNumberEq === 'string') {
58
58
  andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
59
59
  }
60
- const locationIdEq = params.location?.id?.$eq;
61
- if (typeof locationIdEq === 'string') {
62
- andConditions.push({
63
- 'location.id': {
64
- $exists: true,
65
- $eq: locationIdEq
66
- }
67
- });
68
- }
69
- const locationIdentifierEq = params.location?.identifier?.$eq;
70
- if (typeof locationIdentifierEq === 'string') {
71
- andConditions.push({
72
- 'location.identifier': {
73
- $exists: true,
74
- $eq: locationIdentifierEq
75
- }
76
- });
77
- }
60
+ // 使用アクションのコレクション分離につき廃止(2026-08-22~)
61
+ // const locationIdEq = params.location?.id?.$eq;
62
+ // if (typeof locationIdEq === 'string') {
63
+ // andConditions.push({
64
+ // 'location.id': {
65
+ // $exists: true,
66
+ // $eq: locationIdEq
67
+ // }
68
+ // });
69
+ // }
70
+ // 使用アクションのコレクション分離につき廃止(2026-08-22~)
71
+ // const locationIdentifierEq = params.location?.identifier?.$eq;
72
+ // if (typeof locationIdentifierEq === 'string') {
73
+ // andConditions.push({
74
+ // 'location.identifier': {
75
+ // $exists: true,
76
+ // $eq: locationIdentifierEq
77
+ // }
78
+ // });
79
+ // }
78
80
  // 認証アクションのコレクション分離につき廃止(2026-08-21~)
79
81
  // const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
80
82
  // if (typeof objectMovieTicketsIdentifierEq === 'string') {
@@ -0,0 +1,3 @@
1
+ import type { factory } from '../../../../factory';
2
+ type IAcceptCOAOfferActionDocType = Pick<factory.action.accept.coaOffer.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'expires' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'>;
3
+ export { IAcceptCOAOfferActionDocType };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // import type { Model } from 'mongoose';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,9 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
- type IDocType = Omit<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, 'id' | 'replacer'>;
4
+ type IDocType = Pick<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, // eslint-disable-line @typescript-eslint/no-explicit-any
5
+ // eslint-disable-line @typescript-eslint/no-explicit-any
6
+ 'about' | 'actionStatus' | 'agent' | 'cancelAction' | 'description' | 'endDate' | 'error' | 'expires' | 'identifier' | 'instrument' | 'location' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'recipient' | 'result' | 'sameAs' | 'startDate' | 'typeOf'>;
5
7
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
6
8
  type ISchemaDefinition = SchemaDefinition<IDocType>;
7
9
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
@@ -101,24 +101,6 @@ const indexes = [
101
101
  }
102
102
  }
103
103
  ],
104
- [
105
- { 'location.id': 1, startDate: -1 },
106
- {
107
- name: 'searchByLocationId',
108
- partialFilterExpression: {
109
- 'location.id': { $exists: true }
110
- }
111
- }
112
- ],
113
- [
114
- { 'location.identifier': 1, startDate: -1 },
115
- {
116
- name: 'searchByLocationIdentifier',
117
- partialFilterExpression: {
118
- 'location.identifier': { $exists: true }
119
- }
120
- }
121
- ],
122
104
  [
123
105
  { 'agent.typeOf': 1, startDate: -1 },
124
106
  {
@@ -173,26 +155,6 @@ const indexes = [
173
155
  }
174
156
  }
175
157
  ],
176
- // 認証アクションのコレクション分離につき廃止(2026-08-21~)
177
- // [
178
- // { 'object.movieTickets.identifier': 1, startDate: -1 },
179
- // {
180
- // name: 'searchByObjectMovieTicketsIdentifier',
181
- // partialFilterExpression: {
182
- // 'object.movieTickets.identifier': { $exists: true }
183
- // }
184
- // }
185
- // ],
186
- // 認証アクションのコレクション分離につき廃止(2026-08-21~)
187
- // [
188
- // { 'object.movieTickets.serviceOutput.reservationFor.id': 1, startDate: -1 },
189
- // {
190
- // name: 'searchByObjectMovieTicketsServiceOutputReservationForId',
191
- // partialFilterExpression: {
192
- // 'object.movieTickets.serviceOutput.reservationFor.id': { $exists: true }
193
- // }
194
- // }
195
- // ],
196
158
  [
197
159
  { 'object.paymentMethod.accountId': 1, startDate: -1 },
198
160
  {
@@ -211,16 +173,6 @@ const indexes = [
211
173
  }
212
174
  }
213
175
  ],
214
- // 認証アクションのコレクション分離につき廃止(2026-08-21~)
215
- // [
216
- // { 'object.paymentMethod.typeOf': 1, startDate: -1 },
217
- // {
218
- // name: 'searchByObjectPaymentMethodTypeOf',
219
- // partialFilterExpression: {
220
- // 'object.paymentMethod.typeOf': { $exists: true }
221
- // }
222
- // }
223
- // ],
224
176
  [
225
177
  { 'object.paymentMethodId': 1, startDate: -1 },
226
178
  {
@@ -239,16 +191,6 @@ const indexes = [
239
191
  }
240
192
  }
241
193
  ],
242
- // 承認アクションのobject.event廃止につき検索条件も廃止(2026-07-07~)
243
- // [
244
- // { 'object.event.id': 1, startDate: -1 },
245
- // {
246
- // name: 'searchByObjectEventId',
247
- // partialFilterExpression: {
248
- // 'object.event.id': { $exists: true }
249
- // }
250
- // }
251
- // ],
252
194
  [
253
195
  { 'about.id': 1, startDate: -1 },
254
196
  {
@@ -348,60 +290,6 @@ const indexes = [
348
290
  }
349
291
  }
350
292
  ],
351
- // [
352
- // { 'fromLocation.typeOf': 1, startDate: -1 },
353
- // {
354
- // name: 'searchByFromLocationTypeOf',
355
- // partialFilterExpression: {
356
- // 'fromLocation.typeOf': { $exists: true }
357
- // }
358
- // }
359
- // ],
360
- // [
361
- // { 'fromLocation.accountNumber': 1, startDate: -1 },
362
- // {
363
- // name: 'searchByFromLocationAccountNumber',
364
- // partialFilterExpression: {
365
- // 'fromLocation.accountNumber': { $exists: true }
366
- // }
367
- // }
368
- // ],
369
- // [
370
- // { 'fromLocation.accountType': 1, startDate: -1 },
371
- // {
372
- // name: 'searchByFromLocationAccountType',
373
- // partialFilterExpression: {
374
- // 'fromLocation.accountType': { $exists: true }
375
- // }
376
- // }
377
- // ],
378
- // [
379
- // { 'toLocation.typeOf': 1, startDate: -1 },
380
- // {
381
- // name: 'searchByToLocationTypeOf',
382
- // partialFilterExpression: {
383
- // 'toLocation.typeOf': { $exists: true }
384
- // }
385
- // }
386
- // ],
387
- // [
388
- // { 'toLocation.accountNumber': 1, startDate: -1 },
389
- // {
390
- // name: 'searchByToLocationAccountNumber',
391
- // partialFilterExpression: {
392
- // 'toLocation.accountNumber': { $exists: true }
393
- // }
394
- // }
395
- // ],
396
- // [
397
- // { 'toLocation.accountType': 1, startDate: -1 },
398
- // {
399
- // name: 'searchByToLocationAccountType',
400
- // partialFilterExpression: {
401
- // 'toLocation.accountType': { $exists: true }
402
- // }
403
- // }
404
- // ],
405
293
  [
406
294
  { 'instrument.transactionNumber': 1, startDate: -1 },
407
295
  {
@@ -476,6 +364,66 @@ const indexes = [
476
364
  }
477
365
  }
478
366
  ]
367
+ // 使用アクションのコレクション分離につき廃止(2026-08-22~)
368
+ // [
369
+ // { 'location.id': 1, startDate: -1 },
370
+ // {
371
+ // name: 'searchByLocationId',
372
+ // partialFilterExpression: {
373
+ // 'location.id': { $exists: true }
374
+ // }
375
+ // }
376
+ // ],
377
+ // 使用アクションのコレクション分離につき廃止(2026-08-22~)
378
+ // [
379
+ // { 'location.identifier': 1, startDate: -1 },
380
+ // {
381
+ // name: 'searchByLocationIdentifier',
382
+ // partialFilterExpression: {
383
+ // 'location.identifier': { $exists: true }
384
+ // }
385
+ // }
386
+ // ],
387
+ // 認証アクションのコレクション分離につき廃止(2026-08-21~)
388
+ // [
389
+ // { 'object.movieTickets.identifier': 1, startDate: -1 },
390
+ // {
391
+ // name: 'searchByObjectMovieTicketsIdentifier',
392
+ // partialFilterExpression: {
393
+ // 'object.movieTickets.identifier': { $exists: true }
394
+ // }
395
+ // }
396
+ // ],
397
+ // 認証アクションのコレクション分離につき廃止(2026-08-21~)
398
+ // [
399
+ // { 'object.movieTickets.serviceOutput.reservationFor.id': 1, startDate: -1 },
400
+ // {
401
+ // name: 'searchByObjectMovieTicketsServiceOutputReservationForId',
402
+ // partialFilterExpression: {
403
+ // 'object.movieTickets.serviceOutput.reservationFor.id': { $exists: true }
404
+ // }
405
+ // }
406
+ // ],
407
+ // 認証アクションのコレクション分離につき廃止(2026-08-21~)
408
+ // [
409
+ // { 'object.paymentMethod.typeOf': 1, startDate: -1 },
410
+ // {
411
+ // name: 'searchByObjectPaymentMethodTypeOf',
412
+ // partialFilterExpression: {
413
+ // 'object.paymentMethod.typeOf': { $exists: true }
414
+ // }
415
+ // }
416
+ // ],
417
+ // 承認アクションのobject.event廃止につき検索条件も廃止(2026-07-07~)
418
+ // [
419
+ // { 'object.event.id': 1, startDate: -1 },
420
+ // {
421
+ // name: 'searchByObjectEventId',
422
+ // partialFilterExpression: {
423
+ // 'object.event.id': { $exists: true }
424
+ // }
425
+ // }
426
+ // ],
479
427
  ];
480
428
  exports.indexes = indexes;
481
429
  /**
@@ -80,20 +80,6 @@ class PassportRepo {
80
80
  catch (_error) {
81
81
  throw new factory_1.factory.errors.AlreadyInUse('passport', [], 'passport already in use');
82
82
  }
83
- // const ttl = (passportExpires.isAfter(now))
84
- // ? moment.unix(params.exp)
85
- // .diff(moment(), 'seconds')
86
- // : 1;
87
- // const results = await this.redisClient.multi()
88
- // .setNX(key, '1')
89
- // .expire(key, ttl)
90
- // .exec();
91
- // debug('locked,', params.issueUnit.identifier, now, passportExpires, ttl, results);
92
- // if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
93
- // return;
94
- // } else {
95
- // throw new factory.errors.AlreadyInUse('passport', [], 'passport already in use');
96
- // }
97
83
  }
98
84
  /**
99
85
  * 許可証トークンがあれば検証する
@@ -23,7 +23,7 @@ type ICancelByAcceptActionOperation<T> = (repos: ICancelByAcceptActionRepos) =>
23
23
  * 興行オファー採用アクションからCOA予約を取り消す
24
24
  */
25
25
  declare function cancelByAcceptAction(params: {
26
- action: factory.action.accept.coaOffer.IAction;
26
+ action: Pick<factory.action.accept.coaOffer.IAction, 'project' | 'id' | 'purpose'>;
27
27
  }, options: {
28
28
  /**
29
29
  * cancelPendingReservation async?(2025-03-03~)
@@ -19,7 +19,7 @@ declare function processVoidTransaction4coa(params: {
19
19
  task: TaskRepo;
20
20
  }) => Promise<void>;
21
21
  declare function processVoidTransactionByAcceptAction4coa(params: {
22
- action: factory.action.accept.coaOffer.IAction;
22
+ action: Pick<factory.action.accept.coaOffer.IAction, 'project' | 'id' | 'purpose'>;
23
23
  }, options: {
24
24
  /**
25
25
  * cancelPendingReservation async?(2025-03-03~)
@@ -13,7 +13,7 @@ function processVoidTransaction4coa(params, options) {
13
13
  if (typeof acceptActionId !== 'string') {
14
14
  throw new factory_1.factory.errors.NotFound('action.object.id');
15
15
  }
16
- const acceptAction = await repos.actions.acceptCOAOffer.findAnyActionById({ id: acceptActionId, typeOf: factory_1.factory.actionType.AcceptAction });
16
+ const acceptAction = await repos.actions.acceptCOAOffer.findAcceptCOAOfferActionById({ id: acceptActionId, typeOf: factory_1.factory.actionType.AcceptAction });
17
17
  // console.log('processVoidTransaction4coa processing...', params.action.id, params.action.purpose.id, acceptAction);
18
18
  await (0, cancel_1.cancelByAcceptAction)({ action: acceptAction }, options)(repos);
19
19
  };
@@ -5,15 +5,19 @@ import type { EventRepo } from '../../../repo/event';
5
5
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
6
6
  import { factory } from '../../../factory';
7
7
  interface IAcceptRepos {
8
- action: AcceptCOAOfferActionRepo;
8
+ actions: {
9
+ acceptCOAOffer: AcceptCOAOfferActionRepo;
10
+ };
9
11
  event: EventRepo;
10
12
  placeOrder: PlaceOrderRepo;
11
13
  reserveService: COA.service.Reserve;
12
14
  masterService: COA.service.Master;
13
15
  }
14
16
  interface IReAcceptRepos {
15
- action: AcceptCOAOfferActionRepo;
16
- authorizeOfferAction: AuthorizeOfferActionRepo;
17
+ actions: {
18
+ acceptCOAOffer: AcceptCOAOfferActionRepo;
19
+ authorizeOffer: AuthorizeOfferActionRepo;
20
+ };
17
21
  event: EventRepo;
18
22
  placeOrder: PlaceOrderRepo;
19
23
  reserveService: COA.service.Reserve;
@@ -65,7 +65,7 @@ function acceptOffer(params) {
65
65
  // requestBody: updTmpReserveSeatArgs // discontinue(2024-06-11~)
66
66
  }
67
67
  };
68
- const action = await repos.action.start(actionAttributes, { recipe }); // add recipe(2024-06-11~)
68
+ const action = await repos.actions.acceptCOAOffer.start(actionAttributes, { recipe }); // add recipe(2024-06-11~)
69
69
  try {
70
70
  const acceptedOffersWithoutDetails = await (0, authorize_1.createAcceptedOffersWithoutDetails)({
71
71
  object: params.object,
@@ -93,7 +93,7 @@ function acceptOffer(params) {
93
93
  }
94
94
  catch (error) {
95
95
  try {
96
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
96
+ await repos.actions.acceptCOAOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
97
97
  }
98
98
  catch (__) {
99
99
  // no op
@@ -105,7 +105,7 @@ function acceptOffer(params) {
105
105
  result: { responseBody: { tmpReserveNum: updTmpReserveSeatResult.tmpReserveNum } },
106
106
  typeOf: factory_1.factory.actionType.AuthorizeAction
107
107
  };
108
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe }); // add recipe(2024-06-11~)
108
+ await repos.actions.acceptCOAOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe }); // add recipe(2024-06-11~)
109
109
  };
110
110
  }
111
111
  /**
@@ -130,7 +130,7 @@ function reAcceptOffer(params) {
130
130
  // }
131
131
  const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
132
132
  // 承認アクション存在検証
133
- await repos.authorizeOfferAction.findAnyActionById({ id: params.potentialActions.id, typeOf: factory_1.factory.actionType.AuthorizeAction }, ['id'], []);
133
+ await repos.actions.authorizeOffer.findAnyActionById({ id: params.potentialActions.id, typeOf: factory_1.factory.actionType.AuthorizeAction }, ['id'], []);
134
134
  const actionAttributes = {
135
135
  project: transaction.project,
136
136
  typeOf: factory_1.factory.actionType.AcceptAction,
@@ -143,7 +143,7 @@ function reAcceptOffer(params) {
143
143
  instrument: { typeOf: factory_1.factory.assetTransactionType.COAReserveTransaction }
144
144
  };
145
145
  let acceptedOffer;
146
- const action = await repos.action.start(actionAttributes);
146
+ const action = await repos.actions.acceptCOAOffer.start(actionAttributes);
147
147
  try {
148
148
  const acceptedOffersWithoutDetails = params.object.acceptedOffer.map((offer) => {
149
149
  return {
@@ -168,7 +168,7 @@ function reAcceptOffer(params) {
168
168
  }
169
169
  catch (error) {
170
170
  try {
171
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
171
+ await repos.actions.acceptCOAOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
172
172
  }
173
173
  catch (__) {
174
174
  // no op
@@ -183,6 +183,6 @@ function reAcceptOffer(params) {
183
183
  },
184
184
  typeOf: factory_1.factory.actionType.AuthorizeAction
185
185
  };
186
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
186
+ await repos.actions.acceptCOAOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
187
187
  };
188
188
  }
@@ -11,8 +11,10 @@ import { factory } from '../../../factory';
11
11
  export { IRequestBody, IResponseBody };
12
12
  export type IAuthorizeActionResult = factory.action.authorize.offer.eventService.IResult;
13
13
  export interface IAuthorizeRepos {
14
- action: AuthorizeOfferActionRepo;
15
- accpetCOAOfferAction: AcceptCOAOfferActionRepo;
14
+ actions: {
15
+ authorizeOffer: AuthorizeOfferActionRepo;
16
+ acceptCOAOffer: AcceptCOAOfferActionRepo;
17
+ };
16
18
  categoryCode: CategoryCodeRepo;
17
19
  event: EventRepo;
18
20
  offer: OfferRepo;
@@ -78,8 +78,8 @@ function authorize(params) {
78
78
  transaction,
79
79
  pendingTransaction
80
80
  });
81
- const failedAction = await repos.action.start(failedActionAttributes);
82
- await repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
81
+ const failedAction = await repos.actions.authorizeOffer.start(failedActionAttributes);
82
+ await repos.actions.authorizeOffer.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
83
83
  throw error;
84
84
  }
85
85
  // const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
@@ -95,7 +95,7 @@ function authorize(params) {
95
95
  transaction,
96
96
  pendingTransaction
97
97
  });
98
- const action = await repos.action.start(actionAttributes);
98
+ const action = await repos.actions.authorizeOffer.start(actionAttributes);
99
99
  try {
100
100
  // 座席仮予約からオファー情報を生成する
101
101
  const { price } = (0, factory_1.offers2resultPrice)(acceptedOffers);
@@ -123,14 +123,14 @@ function authorize(params) {
123
123
  }
124
124
  catch (error) {
125
125
  try {
126
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
126
+ await repos.actions.authorizeOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
127
127
  }
128
128
  catch (__) {
129
129
  // no op
130
130
  }
131
131
  throw error;
132
132
  }
133
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
133
+ await repos.actions.authorizeOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
134
134
  return {
135
135
  id: action.id,
136
136
  instrument: actionAttributes.instrument,
@@ -9,7 +9,7 @@ const factory_1 = require("../../../factory");
9
9
  */
10
10
  function authorizeByAcceptAction(params) {
11
11
  return async (repos) => {
12
- const acceptAction = await repos.accpetCOAOfferAction.findCompletedById({
12
+ const acceptAction = await repos.actions.acceptCOAOffer.findCompletedAcceptCOAOfferActionById({
13
13
  project: { id: params.project.id },
14
14
  id: params.object.id,
15
15
  purpose: { id: params.purpose.id },
@@ -34,7 +34,7 @@ function authorizeByAcceptAction(params) {
34
34
  }
35
35
  else {
36
36
  // recipe依存へ変更(2024-06-11~)
37
- const recipe = await repos.accpetCOAOfferAction.findRecipeByAction({
37
+ const recipe = await repos.actions.acceptCOAOffer.findRecipeByAction({
38
38
  project: { id: params.project.id },
39
39
  recipeFor: { id: params.object.id }
40
40
  });
@@ -27,7 +27,7 @@ function changeOffers(params) {
27
27
  // throw new factory.errors.NotFound('transaction.object.orderNumber');
28
28
  // }
29
29
  // 取引内のアクションかどうか確認
30
- const authorizeAction = await repos.action.findAnyActionById({ typeOf: factory_2.factory.actionType.AuthorizeAction, id: params.id });
30
+ const authorizeAction = await repos.actions.authorizeOffer.findAnyActionById({ typeOf: factory_2.factory.actionType.AuthorizeAction, id: params.id });
31
31
  if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
32
32
  throw new factory_2.factory.errors.Argument('Transaction', 'Action not found in the transaction');
33
33
  }
@@ -48,7 +48,7 @@ function changeOffers(params) {
48
48
  // },
49
49
  // ['result']
50
50
  // )).shift()?.result;
51
- const originalAcceptResult = (await repos.accpetCOAOfferAction.findCompletedById({
51
+ const originalAcceptResult = (await repos.actions.acceptCOAOffer.findCompletedAcceptCOAOfferActionById({
52
52
  project: { id: authorizeAction.project.id },
53
53
  id: originalAcceptActionId,
54
54
  purpose: { id: authorizeAction.purpose.id },
@@ -111,7 +111,7 @@ function changeOffers(params) {
111
111
  // authorizeAction.object.acceptedOffer = acceptedOffers; // discontinue acceptedOffers(2024-06-21~)
112
112
  // recipe依存へ変更(2024-06-11~)
113
113
  // const updTmpReserveSeatResult = authorizeAction.result?.responseBody;
114
- const recipe = await repos.accpetCOAOfferAction.findRecipeByAction({
114
+ const recipe = await repos.actions.acceptCOAOffer.findRecipeByAction({
115
115
  project: { id: transaction.project.id },
116
116
  recipeFor: { id: originalAcceptActionId }
117
117
  });
@@ -136,7 +136,7 @@ function changeOffers(params) {
136
136
  // amount: [] // discontinue(2026-07-06~)
137
137
  };
138
138
  // ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
139
- await repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
139
+ await repos.actions.authorizeOffer.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
140
140
  try {
141
141
  // // まずvoidAcceptedOffer
142
142
  // // const orderNumberByTransaction = transaction.object.orderNumber;
@@ -163,7 +163,7 @@ function changeOffers(params) {
163
163
  }
164
164
  catch (error) {
165
165
  try {
166
- await repos.action.giveUp({ typeOf: authorizeAction.typeOf, id: authorizeAction.id, error });
166
+ await repos.actions.authorizeOffer.giveUp({ typeOf: authorizeAction.typeOf, id: authorizeAction.id, error });
167
167
  }
168
168
  catch (__) {
169
169
  // no op
@@ -171,7 +171,7 @@ function changeOffers(params) {
171
171
  throw error;
172
172
  }
173
173
  // 承認アクションを再完了
174
- await repos.action.reCompleteAuthorizeEventOfferAction({
174
+ await repos.actions.authorizeOffer.reCompleteAuthorizeEventOfferAction({
175
175
  id: params.id,
176
176
  object: authorizeAction.object,
177
177
  result: actionResult
@@ -35,7 +35,9 @@ declare function findAcceptAction(params: {
35
35
  id: string;
36
36
  };
37
37
  }): (repos: {
38
- action: AcceptCOAOfferActionRepo;
38
+ actions: {
39
+ acceptCOAOffer: AcceptCOAOfferActionRepo;
40
+ };
39
41
  asyncAction: AsyncActionRepo;
40
42
  }) => Promise<IFindAcceptActionResult>;
41
43
  export { findAcceptAction };
@@ -43,9 +43,8 @@ function findAcceptAction(params) {
43
43
  break;
44
44
  default: {
45
45
  // タスクがReadyでなければアクション検索
46
- const acceptAction = (await repos.action.findActionBySameAs({
46
+ const acceptAction = (await repos.actions.acceptCOAOffer.findAcceptCOAOfferActionBySameAs({
47
47
  sameAs: { id: task.id }
48
- // purpose: { id: { $eq: String(params.purpose.id) } }
49
48
  }));
50
49
  if (typeof acceptAction?.id === 'string') {
51
50
  // purpose検証
@@ -49,7 +49,7 @@ function call(params) {
49
49
  ...(credentialsRepo !== undefined) ? { credentialsRepo } : undefined
50
50
  });
51
51
  }
52
- const actionRepo = new acceptCOAOffer_1.AcceptCOAOfferActionRepo(connection);
52
+ const acceptCOAOfferActionRepo = new acceptCOAOffer_1.AcceptCOAOfferActionRepo(connection);
53
53
  try {
54
54
  const coaIntegrationSettings = await settings.getByKey('coa');
55
55
  const reserveService = new coa_service_1.COA.service.Reserve({
@@ -75,8 +75,10 @@ function call(params) {
75
75
  sameAs: { id: params.id },
76
76
  isMember
77
77
  })({
78
- action: actionRepo,
79
- authorizeOfferAction: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
78
+ actions: {
79
+ acceptCOAOffer: acceptCOAOfferActionRepo,
80
+ authorizeOffer: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
81
+ },
80
82
  event: new event_1.EventRepo(connection),
81
83
  placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
82
84
  reserveService,
@@ -92,7 +94,9 @@ function call(params) {
92
94
  sameAs: { id: params.id },
93
95
  isMember
94
96
  })({
95
- action: actionRepo,
97
+ actions: {
98
+ acceptCOAOffer: acceptCOAOfferActionRepo,
99
+ },
96
100
  event: new event_1.EventRepo(connection),
97
101
  placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
98
102
  reserveService,
@@ -103,7 +107,7 @@ function call(params) {
103
107
  catch (error) {
104
108
  let throwsError = true;
105
109
  // アクションが存在すればタスクを実行済扱いにする
106
- const action = (await actionRepo.findActionBySameAs({
110
+ const action = (await acceptCOAOfferActionRepo.findAcceptCOAOfferActionBySameAs({
107
111
  sameAs: { id: params.id },
108
112
  purpose: { id: params.data.purpose.id }
109
113
  }));
@@ -117,7 +121,6 @@ function call(params) {
117
121
  finally {
118
122
  // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
119
123
  // 取引プロセスロック解除
120
- // await transactionProcessRepo.unlock({ typeOf: factory.transactionType.PlaceOrder, id: params.data.purpose.id });
121
124
  }
122
125
  };
123
126
  }
@@ -110,7 +110,6 @@ function call(params) {
110
110
  // 取引プロセスロック解除(2024-04-20~)
111
111
  if (params.data.options.useUnlockTransactionProcess) {
112
112
  // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
113
- // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
114
113
  }
115
114
  }
116
115
  if (callResult !== undefined) {
@@ -62,7 +62,6 @@ function call(params) {
62
62
  // 取引プロセスロック解除
63
63
  if (typeof params.data.purpose?.id === 'string') {
64
64
  // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
65
- // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
66
65
  }
67
66
  }
68
67
  };
@@ -68,8 +68,6 @@ function call(params) {
68
68
  }
69
69
  finally {
70
70
  // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
71
- // 取引プロセスロック解除
72
- // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
73
71
  }
74
72
  };
75
73
  }
@@ -80,7 +80,6 @@ function call(params) {
80
80
  // アクションID指定であれば取引プロセスロック解除(2024-05-26~)
81
81
  if (voidByActionId) {
82
82
  // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
83
- // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
84
83
  }
85
84
  }
86
85
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.1090.0",
13
13
  "@aws-sdk/credential-providers": "3.1090.0",
14
- "@chevre/factory": "10.4.0-alpha.1",
14
+ "@chevre/factory": "10.4.0-alpha.2",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "26.1.0-alpha.3"
91
+ "version": "26.1.0-alpha.5"
92
92
  }