@chevre/domain 26.0.0-alpha.0 → 26.0.0-alpha.2

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.
@@ -0,0 +1,19 @@
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ import { IModel, IDocType } from './mongoose/schemas/asyncAction';
4
+ import type { IExecutableTask } from '../taskSettings';
5
+ export type IExecutableAsyncAction = Pick<IExecutableTask<factory.taskName>, 'data' | 'expires' | 'id' | 'name' | 'project' | 'runsAt' | 'status'>;
6
+ type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
7
+ type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
8
+ /**
9
+ * 非同期アクション管理リポジトリ
10
+ */
11
+ export declare class AdminAsyncActionRepo {
12
+ readonly asyncActionModel: IModel;
13
+ constructor(connection: Connection);
14
+ static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status'>): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
15
+ findAsyncActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
16
+ id: string;
17
+ })[]>;
18
+ }
19
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminAsyncActionRepo = void 0;
4
+ const settings_1 = require("../settings");
5
+ const asyncAction_1 = require("./mongoose/schemas/asyncAction");
6
+ const AVAILABLE_PROJECT_FIELDS = [
7
+ 'project',
8
+ 'name',
9
+ 'status',
10
+ 'runsAt',
11
+ 'lastTriedAt',
12
+ 'executionResults',
13
+ 'executor',
14
+ 'data',
15
+ 'dateAborted',
16
+ 'expires'
17
+ ];
18
+ /**
19
+ * 非同期アクション管理リポジトリ
20
+ */
21
+ class AdminAsyncActionRepo {
22
+ asyncActionModel;
23
+ constructor(connection) {
24
+ this.asyncActionModel = connection.model(asyncAction_1.modelName, (0, asyncAction_1.createSchema)());
25
+ }
26
+ static CREATE_MONGO_CONDITIONS(params) {
27
+ const andConditions = [];
28
+ const idEq = params.id?.$eq;
29
+ if (typeof idEq === 'string') {
30
+ andConditions.push({ _id: { $eq: idEq } });
31
+ }
32
+ const projectIdEq = params.project?.id?.$eq;
33
+ if (typeof projectIdEq === 'string') {
34
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
35
+ }
36
+ if (typeof params.name === 'string') {
37
+ andConditions.push({ name: { $eq: params.name } });
38
+ }
39
+ else {
40
+ const nameIn = params.name?.$in;
41
+ if (Array.isArray(nameIn)) {
42
+ andConditions.push({ name: { $in: nameIn } });
43
+ }
44
+ const nameNin = params.name?.$nin;
45
+ if (Array.isArray(nameNin)) {
46
+ andConditions.push({ name: { $nin: nameNin } });
47
+ }
48
+ }
49
+ const statusEq = params.status?.$eq;
50
+ if (typeof statusEq === 'string') {
51
+ andConditions.push({ status: { $eq: statusEq } });
52
+ }
53
+ if (params.runsFrom instanceof Date) {
54
+ andConditions.push({ runsAt: { $gte: params.runsFrom } });
55
+ }
56
+ if (params.runsThrough instanceof Date) {
57
+ andConditions.push({ runsAt: { $lte: params.runsThrough } });
58
+ }
59
+ return andConditions;
60
+ }
61
+ async findAsyncActions(params, inclusion) {
62
+ const conditions = AdminAsyncActionRepo.CREATE_MONGO_CONDITIONS(params);
63
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
64
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
65
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
66
+ }
67
+ const projection = {
68
+ _id: 0,
69
+ id: { $toString: '$_id' },
70
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
71
+ };
72
+ const query = this.asyncActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
73
+ if (typeof params.limit === 'number' && params.limit > 0) {
74
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
75
+ query.limit(params.limit)
76
+ .skip(params.limit * (page - 1));
77
+ }
78
+ if (params.sort?.runsAt !== undefined) {
79
+ query.sort({ runsAt: params.sort.runsAt });
80
+ }
81
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
82
+ .lean()
83
+ .exec();
84
+ }
85
+ }
86
+ exports.AdminAsyncActionRepo = AdminAsyncActionRepo;
@@ -0,0 +1,20 @@
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ import { IDocType } from './mongoose/schemas/scheduledTasks';
4
+ type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
5
+ type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
6
+ /**
7
+ * 予定タスク管理リポジトリ
8
+ */
9
+ export declare class AdminScheduledTaskRepo {
10
+ private readonly scheduledTaskModel;
11
+ constructor(connection: Connection);
12
+ static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status'>): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
13
+ /**
14
+ * 検索する
15
+ */
16
+ findScheduledTasks(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
17
+ id: string;
18
+ })[]>;
19
+ }
20
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminScheduledTaskRepo = void 0;
4
+ const settings_1 = require("../settings");
5
+ const scheduledTasks_1 = require("./mongoose/schemas/scheduledTasks");
6
+ const AVAILABLE_PROJECT_FIELDS = [
7
+ 'description',
8
+ 'project',
9
+ 'name',
10
+ 'status',
11
+ 'runsAt',
12
+ 'remainingNumberOfTries',
13
+ 'lastTriedAt',
14
+ 'numberOfTried',
15
+ 'executionResults',
16
+ 'executor',
17
+ 'data',
18
+ 'dateAborted',
19
+ 'expires'
20
+ ];
21
+ /**
22
+ * 予定タスク管理リポジトリ
23
+ */
24
+ class AdminScheduledTaskRepo {
25
+ scheduledTaskModel;
26
+ constructor(connection) {
27
+ this.scheduledTaskModel = connection.model(scheduledTasks_1.modelName, (0, scheduledTasks_1.createSchema)());
28
+ }
29
+ static CREATE_MONGO_CONDITIONS(params) {
30
+ const andConditions = [];
31
+ const idEq = params.id?.$eq;
32
+ if (typeof idEq === 'string') {
33
+ andConditions.push({ _id: { $eq: idEq } });
34
+ }
35
+ const projectIdEq = params.project?.id?.$eq;
36
+ if (typeof projectIdEq === 'string') {
37
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
38
+ }
39
+ if (typeof params.name === 'string') {
40
+ andConditions.push({ name: { $eq: params.name } });
41
+ }
42
+ else {
43
+ const nameIn = params.name?.$in;
44
+ if (Array.isArray(nameIn)) {
45
+ andConditions.push({ name: { $in: nameIn } });
46
+ }
47
+ const nameNin = params.name?.$nin;
48
+ if (Array.isArray(nameNin)) {
49
+ andConditions.push({ name: { $nin: nameNin } });
50
+ }
51
+ }
52
+ const statusEq = params.status?.$eq;
53
+ if (typeof statusEq === 'string') {
54
+ andConditions.push({ status: { $eq: statusEq } });
55
+ }
56
+ if (params.runsFrom instanceof Date) {
57
+ andConditions.push({ runsAt: { $gte: params.runsFrom } });
58
+ }
59
+ if (params.runsThrough instanceof Date) {
60
+ andConditions.push({ runsAt: { $lte: params.runsThrough } });
61
+ }
62
+ return andConditions;
63
+ }
64
+ /**
65
+ * 検索する
66
+ */
67
+ async findScheduledTasks(params, inclusion) {
68
+ const conditions = AdminScheduledTaskRepo.CREATE_MONGO_CONDITIONS(params);
69
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
70
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
71
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
72
+ }
73
+ else {
74
+ // no op
75
+ }
76
+ const projection = {
77
+ _id: 0,
78
+ id: { $toString: '$_id' },
79
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
80
+ };
81
+ const query = this.scheduledTaskModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
82
+ if (typeof params.limit === 'number' && params.limit > 0) {
83
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
84
+ query.limit(params.limit)
85
+ .skip(params.limit * (page - 1));
86
+ }
87
+ if (params.sort?.runsAt !== undefined) {
88
+ query.sort({ runsAt: params.sort.runsAt });
89
+ }
90
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
91
+ .lean()
92
+ .exec();
93
+ }
94
+ }
95
+ exports.AdminScheduledTaskRepo = AdminScheduledTaskRepo;
@@ -1,4 +1,4 @@
1
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
3
  import { IModel, IDocType } from './mongoose/schemas/asyncAction';
4
4
  import type { IExecutableTask } from '../taskSettings';
@@ -7,17 +7,12 @@ type ISavingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'ex
7
7
  };
8
8
  export type IExecutableAsyncAction = Pick<IExecutableTask<factory.taskName>, 'data' | 'expires' | 'id' | 'name' | 'project' | 'runsAt' | 'status'>;
9
9
  type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
10
- type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
11
10
  /**
12
11
  * 非同期アクションリポジトリ
13
12
  */
14
13
  export declare class AsyncActionRepo {
15
14
  readonly asyncActionModel: IModel;
16
15
  constructor(connection: Connection);
17
- static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status'>): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
18
- findAsyncActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
19
- id: string;
20
- })[]>;
21
16
  /**
22
17
  * Readyタスクをひとつ追加する
23
18
  */
@@ -35,65 +35,6 @@ class AsyncActionRepo {
35
35
  constructor(connection) {
36
36
  this.asyncActionModel = connection.model(asyncAction_1.modelName, (0, asyncAction_1.createSchema)());
37
37
  }
38
- static CREATE_MONGO_CONDITIONS(params) {
39
- const andConditions = [];
40
- const idEq = params.id?.$eq;
41
- if (typeof idEq === 'string') {
42
- andConditions.push({ _id: { $eq: idEq } });
43
- }
44
- const projectIdEq = params.project?.id?.$eq;
45
- if (typeof projectIdEq === 'string') {
46
- andConditions.push({ 'project.id': { $eq: projectIdEq } });
47
- }
48
- if (typeof params.name === 'string') {
49
- andConditions.push({ name: { $eq: params.name } });
50
- }
51
- else {
52
- const nameIn = params.name?.$in;
53
- if (Array.isArray(nameIn)) {
54
- andConditions.push({ name: { $in: nameIn } });
55
- }
56
- const nameNin = params.name?.$nin;
57
- if (Array.isArray(nameNin)) {
58
- andConditions.push({ name: { $nin: nameNin } });
59
- }
60
- }
61
- const statusEq = params.status?.$eq;
62
- if (typeof statusEq === 'string') {
63
- andConditions.push({ status: { $eq: statusEq } });
64
- }
65
- if (params.runsFrom instanceof Date) {
66
- andConditions.push({ runsAt: { $gte: params.runsFrom } });
67
- }
68
- if (params.runsThrough instanceof Date) {
69
- andConditions.push({ runsAt: { $lte: params.runsThrough } });
70
- }
71
- return andConditions;
72
- }
73
- async findAsyncActions(params, inclusion) {
74
- const conditions = AsyncActionRepo.CREATE_MONGO_CONDITIONS(params);
75
- let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
76
- if (Array.isArray(inclusion) && inclusion.length > 0) {
77
- positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
78
- }
79
- const projection = {
80
- _id: 0,
81
- id: { $toString: '$_id' },
82
- ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
83
- };
84
- const query = this.asyncActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
85
- if (typeof params.limit === 'number' && params.limit > 0) {
86
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
87
- query.limit(params.limit)
88
- .skip(params.limit * (page - 1));
89
- }
90
- if (params.sort?.runsAt !== undefined) {
91
- query.sort({ runsAt: params.sort.runsAt });
92
- }
93
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
94
- .lean()
95
- .exec();
96
- }
97
38
  /**
98
39
  * Readyタスクをひとつ追加する
99
40
  */
@@ -168,55 +109,6 @@ class AsyncActionRepo {
168
109
  }
169
110
  return doc;
170
111
  }
171
- // /**
172
- // * Readyのままで期限切れのタスクをExpiredに変更する
173
- // */
174
- // public async makeExpiredMany(params: {
175
- // expiresLt: Date;
176
- // }): Promise<UpdateWriteOpResult> {
177
- // const { expiresLt } = params;
178
- // if (!(expiresLt instanceof Date)) {
179
- // throw new factory.errors.Argument('expiresLt', 'must be Date');
180
- // }
181
- // return this.asyncActionModel.updateMany(
182
- // {
183
- // status: { $eq: factory.taskStatus.Ready },
184
- // expires: { $lt: expiresLt }
185
- // },
186
- // {
187
- // $set: {
188
- // status: factory.taskStatus.Expired
189
- // }
190
- // }
191
- // )
192
- // .exec();
193
- // }
194
- // /**
195
- // * taskNameに関わらず、Runningのまま放置された非同期アクションをAbortedに変更する
196
- // */
197
- // public async abortMany(params: {
198
- // intervalInMinutes: number;
199
- // }): Promise<UpdateWriteOpResult> {
200
- // const lastTriedAtShoudBeLessThan = moment()
201
- // .add(-params.intervalInMinutes, 'minutes')
202
- // .toDate();
203
- // return this.asyncActionModel.updateMany(
204
- // {
205
- // status: { $eq: factory.taskStatus.Running },
206
- // lastTriedAt: {
207
- // $exists: true,
208
- // $lt: lastTriedAtShoudBeLessThan
209
- // }
210
- // },
211
- // {
212
- // $set: {
213
- // status: factory.taskStatus.Aborted,
214
- // dateAborted: new Date()
215
- // }
216
- // }
217
- // )
218
- // .exec();
219
- // }
220
112
  /**
221
113
  * タスクIDから実行結果とステータスを保管する
222
114
  * Abortedの場合、dateAbortedもセットする
@@ -13,10 +13,6 @@ interface IOnReservationStatusChanged {
13
13
  * AggService通知先
14
14
  */
15
15
  informReservation?: factory.project.IInformParams[];
16
- /**
17
- * 確定予約最小化をサポート(2026-07-14~)
18
- */
19
- minimizeReservation?: boolean;
20
16
  }
21
17
  interface IOnTaskStatusChanged {
22
18
  /**
@@ -17,6 +17,8 @@ import type { PayActionRepo } from './repo/action/pay';
17
17
  import type { RefundActionRepo } from './repo/action/refund';
18
18
  import type { AsyncActionRepo } from './repo/asyncAction';
19
19
  import type { AdditionalPropertyRepo } from './repo/additionalProperty';
20
+ import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
21
+ import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
20
22
  import type { AdminTaskRepo } from './repo/adminTask';
21
23
  import type { AggregateActionRepo } from './repo/aggregateAction';
22
24
  import type { AggregateOfferRepo } from './repo/aggregateOffer';
@@ -162,6 +164,14 @@ export type AdditionalProperty = AdditionalPropertyRepo;
162
164
  export declare namespace AdditionalProperty {
163
165
  function createInstance(...params: ConstructorParameters<typeof AdditionalPropertyRepo>): Promise<AdditionalPropertyRepo>;
164
166
  }
167
+ export type AdminAsyncAction = AdminAsyncActionRepo;
168
+ export declare namespace AdminAsyncAction {
169
+ function createInstance(...params: ConstructorParameters<typeof AdminAsyncActionRepo>): Promise<AdminAsyncActionRepo>;
170
+ }
171
+ export type AdminScheduledTask = AdminScheduledTaskRepo;
172
+ export declare namespace AdminScheduledTask {
173
+ function createInstance(...params: ConstructorParameters<typeof AdminScheduledTaskRepo>): Promise<AdminScheduledTaskRepo>;
174
+ }
165
175
  export type AdminTask = AdminTaskRepo;
166
176
  export declare namespace AdminTask {
167
177
  function createInstance(...params: ConstructorParameters<typeof AdminTaskRepo>): Promise<AdminTaskRepo>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = 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.AggregateTask = exports.AggregateAction = exports.AdminTask = 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.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 = void 0;
3
+ exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = 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.AggregateTask = exports.AggregateAction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = 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.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 = void 0;
5
5
  var AcceptedOffer;
6
6
  (function (AcceptedOffer) {
7
7
  let repo;
@@ -170,6 +170,28 @@ var AdditionalProperty;
170
170
  }
171
171
  AdditionalProperty.createInstance = createInstance;
172
172
  })(AdditionalProperty || (exports.AdditionalProperty = AdditionalProperty = {}));
173
+ var AdminAsyncAction;
174
+ (function (AdminAsyncAction) {
175
+ let repo;
176
+ async function createInstance(...params) {
177
+ if (repo === undefined) {
178
+ repo = (await import('./repo/adminAsyncAction.js')).AdminAsyncActionRepo;
179
+ }
180
+ return new repo(...params);
181
+ }
182
+ AdminAsyncAction.createInstance = createInstance;
183
+ })(AdminAsyncAction || (exports.AdminAsyncAction = AdminAsyncAction = {}));
184
+ var AdminScheduledTask;
185
+ (function (AdminScheduledTask) {
186
+ let repo;
187
+ async function createInstance(...params) {
188
+ if (repo === undefined) {
189
+ repo = (await import('./repo/adminScheduledTask.js')).AdminScheduledTaskRepo;
190
+ }
191
+ return new repo(...params);
192
+ }
193
+ AdminScheduledTask.createInstance = createInstance;
194
+ })(AdminScheduledTask || (exports.AdminScheduledTask = AdminScheduledTask = {}));
173
195
  var AdminTask;
174
196
  (function (AdminTask) {
175
197
  let repo;
@@ -12,9 +12,7 @@ const debug = (0, debug_1.default)('chevre-domain:service:reserve:confirmReserva
12
12
  * 予約を確定する
13
13
  */
14
14
  function confirmReservation(params) {
15
- return async (repos
16
- // settings: Settings
17
- ) => {
15
+ return async (repos) => {
18
16
  // await Promise.all(params.actionAttributesList.map(async (potentialReserveAction) => {
19
17
  // const actionAttributes = await reserveIfNotYet(potentialReserveAction, { byTask: params.byTask })(repos);
20
18
  // if (params.useOnReservationConfirmed) {
@@ -23,7 +21,8 @@ function confirmReservation(params) {
23
21
  // }));
24
22
  const { actionAttributes, reserveTransaction } = await reserveIfNotYet(params.potentialReserveAction, { byTask: params.byTask })(repos);
25
23
  if (params.useOnReservationConfirmed) {
26
- await (0, onReservationConfirmed_1.onReservationConfirmedByAction)(actionAttributes)({ task: repos.task });
24
+ // onReservationConfirmedByActionは廃止(2026-08-01~)
25
+ // await onReservationConfirmedByAction(actionAttributes)({ task: repos.task });
27
26
  }
28
27
  if (params.useOnReservationConfirmed) {
29
28
  let confirmedReservations = [];
@@ -38,38 +37,32 @@ function confirmReservation(params) {
38
37
  // project all fields
39
38
  // {}
40
39
  );
41
- // price,underName,ticketTypeは予約取引から補完する(2026-03-25~)
42
40
  confirmedReservations = rawReservations.map((rawReservation) => {
43
- const subReservationByTransaction = reserveTransaction.object.subReservation?.find((s) => s.id === rawReservation.id);
44
- // 予約取引内にsubReservationは必ず存在するはず
45
- if (subReservationByTransaction === undefined) {
46
- throw new factory_1.factory.errors.NotFound('reserveTransaction.object.subReservation');
47
- }
41
+ // const subReservationByTransaction = reserveTransaction.object.subReservation?.find((s) => s.id === rawReservation.id);
42
+ // // 予約取引内にsubReservationは必ず存在するはず
43
+ // if (subReservationByTransaction === undefined) {
44
+ // throw new factory.errors.NotFound('reserveTransaction.object.subReservation');
45
+ // }
48
46
  // 予約取引内にreservationForは必ず存在するはず
49
47
  if (reserveTransaction.object.reservationFor === undefined) {
50
48
  throw new factory_1.factory.errors.NotFound('reserveTransaction.object.reservationFor');
51
49
  }
52
- const priceByTransaction = subReservationByTransaction.price;
53
- const underNameByTransaction = reserveTransaction.object.underName;
54
- const ticketTypeByTransaction = subReservationByTransaction.reservedTicket.ticketType;
55
- // console.log('creating confirmedReservation...', rawReservation, priceByTransaction, underNameByTransaction, ticketTypeByTransaction);
50
+ // const priceByTransaction = subReservationByTransaction.price;
51
+ // const underNameByTransaction = reserveTransaction.object.underName;
52
+ // const ticketTypeByTransaction = subReservationByTransaction.reservedTicket.ticketType;
56
53
  return {
57
54
  ...rawReservation,
58
- price: priceByTransaction,
59
- underName: underNameByTransaction,
60
- reservedTicket: {
61
- ...rawReservation.reservedTicket,
62
- ticketType: ticketTypeByTransaction
63
- },
64
55
  reservationFor: reserveTransaction.object.reservationFor, // reservationForは予約取引から参照する(2026-04-05~)
65
- issuedThrough: reserveTransaction.object.issuedThrough // issuedThroughは予約取引から補完する(2026-05-08~)
56
+ // price,underName,ticketTypeは予約取引から補完していたが(2026-03-25~)、もう廃止(2026-08-01~)
57
+ // reservedTicket: {
58
+ // ...rawReservation.reservedTicket,
59
+ // ticketType: ticketTypeByTransaction
60
+ // },
61
+ // price: priceByTransaction,
62
+ // underName: underNameByTransaction,
63
+ // issuedThrough: reserveTransaction.object.issuedThrough // issuedThroughは予約取引から補完する(2026-05-08~)
66
64
  };
67
65
  });
68
- confirmedReservations = confirmedReservations.map((r) => {
69
- // // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
70
- // delete (r as any)._id;
71
- return r;
72
- });
73
66
  }
74
67
  await (0, onReservationConfirmed_1.onReservationConfirmed)(confirmedReservations, actionAttributes)(repos);
75
68
  }
@@ -1,7 +1,4 @@
1
1
  import { factory } from '../../factory';
2
- export declare function optimizeUnderName4inform(params: {
3
- underName: Pick<factory.reservation.IUnderName, 'id' | 'typeOf'>;
4
- }): factory.notification.reservation.IMaskedUnderName;
5
2
  export type IPotentialInformReservationAction = factory.task.triggerWebhook.IPotentialInformReservationAction;
6
3
  export declare const NUM_TRY_INFORM_RESERVATION = 10;
7
4
  export interface IPotentialCancelAction extends factory.action.cancel.reservation.IAttributes {
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NUM_TRY_INFORM_RESERVATION = void 0;
4
- exports.optimizeUnderName4inform = optimizeUnderName4inform;
5
4
  exports.createCancelPendingReservationAction = createCancelPendingReservationAction;
6
5
  const factory_1 = require("../../factory");
7
- function optimizeUnderName4inform(params) {
8
- return { id: params.underName.id, typeOf: params.underName.typeOf };
9
- }
10
6
  exports.NUM_TRY_INFORM_RESERVATION = 10;
11
7
  function createCancelPendingReservationAction(params) {
12
8
  const transaction = params.transaction;
@@ -5,21 +5,12 @@ import { factory } from '../../../factory';
5
5
  import { AuthorizationRepo } from '../../../repo/authorization';
6
6
  import type { SettingRepo } from '../../../repo/setting';
7
7
  import type { TaskRepo } from '../../../repo/task';
8
- export type IConfirmedReservation = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough'> & {
9
- price?: factory.assetTransaction.reserve.IPrice;
10
- underName?: Pick<factory.reservation.IUnderName, 'id' | 'typeOf'>;
11
- reservedTicket: Omit<factory.assetTransaction.reserve.ISubReservationReservedTicket, 'ticketType'> & {
12
- ticketType: factory.assetTransaction.reserve.ITicketType;
13
- };
8
+ export type IConfirmedReservation = Pick<factory.reservation.eventReservation.IReservation, 'additionalProperty' | 'additionalTicketText' | 'bookingTime' | 'id' | 'modifiedTime' | 'project' | 'provider' | 'reservationNumber' | 'subReservation' | 'typeOf' | 'reservedTicket'> & {
14
9
  reservationFor: factory.assetTransaction.reserve.IReservationFor;
15
- issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
10
+ price?: never;
11
+ underName?: never;
12
+ issuedThrough?: never;
16
13
  };
17
- /**
18
- * 予約確定後のアクション
19
- */
20
- export declare function onReservationConfirmedByAction(actionAttributes: Pick<factory.action.reserve.IAttributes, 'potentialActions'>): (repos: {
21
- task: TaskRepo;
22
- }) => Promise<void>;
23
14
  export declare function onReservationConfirmed(confirmedReservations: IConfirmedReservation[], reserveAction: Pick<factory.action.reserve.IAttributes, 'instrument'>): (repos: {
24
15
  code: AuthorizationRepo;
25
16
  setting: SettingRepo;
@@ -1,52 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onReservationConfirmedByAction = onReservationConfirmedByAction;
4
3
  exports.onReservationConfirmed = onReservationConfirmed;
5
4
  /**
6
5
  * 予約確定時アクション
7
6
  */
8
7
  const factory_1 = require("../../../factory");
9
8
  const factory_2 = require("../factory");
10
- /**
11
- * 予約確定後のアクション
12
- */
13
- function onReservationConfirmedByAction(actionAttributes) {
14
- return async (repos) => {
15
- const potentialActions = actionAttributes.potentialActions;
16
- // const now = new Date();
17
- const taskAttributes = [];
18
- /* istanbul ignore else */
19
- if (potentialActions !== undefined) {
20
- // discontinue(2026-04-18~)
21
- // if (Array.isArray(potentialActions.moneyTransfer)) {
22
- // taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
23
- // return {
24
- // project: a.project,
25
- // name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
26
- // status: factory.taskStatus.Ready,
27
- // runsAt: now,
28
- // remainingNumberOfTries: 10,
29
- // numberOfTried: 0,
30
- // executionResults: [],
31
- // data: a
32
- // };
33
- // }));
34
- // }
35
- }
36
- // タスク保管
37
- if (taskAttributes.length > 0) {
38
- await repos.task.saveMany(taskAttributes);
39
- }
40
- };
41
- }
42
9
  function onReservationConfirmed(confirmedReservations, reserveAction) {
43
- return async (repos
44
- // settings: Settings
45
- ) => {
10
+ return async (repos) => {
46
11
  const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onReservationStatusChanged']);
47
- // const informReservations = settings.onReservationStatusChanged.informReservation;
48
12
  const informReservations = setting?.onReservationStatusChanged?.informReservation;
49
- const minimizeReservation = setting?.onReservationStatusChanged?.minimizeReservation === true;
50
13
  let orderAsAbout;
51
14
  if (Array.isArray(reserveAction.instrument)) {
52
15
  for (const eachInstrument of reserveAction.instrument) {
@@ -58,8 +21,7 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
58
21
  }
59
22
  if (Array.isArray(confirmedReservations) && confirmedReservations.length > 0) {
60
23
  // ひとつめの予約からReservationPackageの共有属性を取り出す
61
- const { bookingTime, issuedThrough, project, provider, reservationFor, reservationNumber, underName } = confirmedReservations[0];
62
- // create AggregateScreeningEvent task -> migrate to agg(2024-10-29~)
24
+ const { bookingTime, project, provider, reservationFor, reservationNumber } = confirmedReservations[0];
63
25
  const now = new Date();
64
26
  const taskAttributes = [];
65
27
  let onAuthorizationCreatedTask;
@@ -98,15 +60,13 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
98
60
  }
99
61
  }
100
62
  const subReservations4inform = confirmedReservations.map((r) => {
101
- const { additionalProperty, additionalTicketText, id, modifiedTime, price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
102
- let reservedTicket4inform;
103
- if (minimizeReservation) {
104
- const { ticketType: _ticketType, ...reservedTicketWithNoTicketType } = reservedTicket;
105
- reservedTicket4inform = reservedTicketWithNoTicketType;
106
- }
107
- else {
108
- reservedTicket4inform = reservedTicket; // eslint-disable-line @typescript-eslint/no-explicit-any
109
- }
63
+ const {
64
+ // additionalProperty: _additionalProperty,
65
+ // price: _price,
66
+ // programMembershipUsed: _programMembershipUsed,
67
+ additionalTicketText, id, modifiedTime, reservedTicket, subReservation, typeOf } = r;
68
+ const { ticketType: _ticketType, ...reservedTicketWithNoTicketType } = reservedTicket;
69
+ const reservedTicket4inform = reservedTicketWithNoTicketType;
110
70
  return {
111
71
  id,
112
72
  typeOf,
@@ -114,15 +74,15 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
114
74
  ...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
115
75
  ...(modifiedTime instanceof Date) ? { modifiedTime } : undefined,
116
76
  ...(Array.isArray(subReservation)) ? { subReservation } : undefined,
117
- ...(!minimizeReservation && Array.isArray(additionalProperty)) ? { additionalProperty } : undefined, // eslint-disable-line @typescript-eslint/no-explicit-any
118
- ...(!minimizeReservation && price !== undefined) ? { price } : undefined, // eslint-disable-line @typescript-eslint/no-explicit-any
119
- ...(!minimizeReservation && programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined, // eslint-disable-line @typescript-eslint/no-explicit-any
77
+ // ...(!minimizeReservation && Array.isArray(additionalProperty)) ? { additionalProperty } : undefined, // discontinue(2026-08-01~)
78
+ // ...(!minimizeReservation && price !== undefined) ? { price } : undefined, // discontinue(2026-08-01~)
79
+ // ...(!minimizeReservation && programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined, // discontinue(2026-08-01~)
120
80
  };
121
81
  });
122
- if (typeof issuedThrough.id !== 'string') {
123
- // COA予約では予約アクションを想定していないので、興行idは必ず存在するはず
124
- throw new factory_1.factory.errors.Internal('reservation.issuedThrough.id must be string');
125
- }
82
+ // if (typeof issuedThrough.id !== 'string') {
83
+ // // COA予約では予約アクションを想定していないので、興行idは必ず存在するはず
84
+ // throw new factory.errors.Internal('reservation.issuedThrough.id must be string');
85
+ // }
126
86
  const informObject = {
127
87
  bookingTime,
128
88
  project,
@@ -132,10 +92,10 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
132
92
  reservationStatus: factory_1.factory.reservationStatusType.ReservationConfirmed,
133
93
  subReservation: subReservations4inform,
134
94
  typeOf: factory_1.factory.reservationType.ReservationPackage,
135
- ...(!minimizeReservation) ? { issuedThrough } : undefined, // eslint-disable-line @typescript-eslint/no-explicit-any
136
- ...(!minimizeReservation && typeof underName?.typeOf === 'string')
137
- ? { underName: (0, factory_2.optimizeUnderName4inform)({ underName }) } // eslint-disable-line @typescript-eslint/no-explicit-any
138
- : undefined
95
+ // ...(!minimizeReservation) ? { issuedThrough } : undefined, // discontinue(2026-08-01~)
96
+ // ...(!minimizeReservation && typeof underName?.typeOf === 'string')
97
+ // ? { underName: optimizeUnderName4inform({ underName }) }
98
+ // : undefined // discontinue(2026-08-01~)
139
99
  };
140
100
  const informIdentifier = `${factory_1.factory.reservationType.ReservationPackage}:${informObject.reservationNumber}:${informObject.reservationStatus}`;
141
101
  // inform galobally
package/package.json CHANGED
@@ -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.0.0-alpha.0"
91
+ "version": "26.0.0-alpha.2"
92
92
  }