@chevre/domain 25.0.0-alpha.22 → 25.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/message.d.ts +0 -12
- package/lib/chevre/repo/message.js +25 -16
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +2 -9
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -1
- package/lib/chevre/repo/setting/waiter.d.ts +17 -0
- package/lib/chevre/repo/setting/waiter.js +39 -0
- package/lib/chevre/repo/setting.d.ts +12 -11
- package/lib/chevre/repo/setting.js +6 -18
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +11 -0
- package/lib/chevre/service/task/deleteTransaction.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +0 -2
- package/lib/chevre/service/transaction/deleteTransaction.js +35 -28
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +45 -54
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +2 -3
- package/lib/chevre/service/transaction.d.ts +0 -4
- package/lib/chevre/service/transaction.js +1 -1
- package/package.json +2 -2
|
@@ -66,18 +66,6 @@ export declare class MessageRepo {
|
|
|
66
66
|
deleteDatePublishedPassedCertainPeriod(params: {
|
|
67
67
|
$lt: Date;
|
|
68
68
|
}): Promise<void>;
|
|
69
|
-
deleteByMainEntityOrderNumber(params: {
|
|
70
|
-
project: {
|
|
71
|
-
id: string;
|
|
72
|
-
};
|
|
73
|
-
mainEntity: {
|
|
74
|
-
orderNumber: string;
|
|
75
|
-
};
|
|
76
|
-
}): Promise<{
|
|
77
|
-
n?: number;
|
|
78
|
-
ok?: number;
|
|
79
|
-
deletedCount?: number;
|
|
80
|
-
} | null>;
|
|
81
69
|
unsetUnnecessaryFields(params: {
|
|
82
70
|
filter: any;
|
|
83
71
|
$unset: any;
|
|
@@ -173,22 +173,31 @@ class MessageRepo {
|
|
|
173
173
|
.exec();
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
async deleteByMainEntityOrderNumber(params
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
176
|
+
// public async deleteByMainEntityOrderNumber(params: {
|
|
177
|
+
// project: { id: string };
|
|
178
|
+
// mainEntity: { orderNumber: string };
|
|
179
|
+
// }): Promise<{
|
|
180
|
+
// n?: number;
|
|
181
|
+
// // opTime: result.opTime,
|
|
182
|
+
// ok?: number;
|
|
183
|
+
// // operationTime,
|
|
184
|
+
// deletedCount?: number;
|
|
185
|
+
// } | null> {
|
|
186
|
+
// return this.messageModel.deleteMany({
|
|
187
|
+
// 'project.id': { $eq: params.project.id },
|
|
188
|
+
// 'mainEntity.orderNumber': { $exists: true, $eq: params.mainEntity.orderNumber }
|
|
189
|
+
// })
|
|
190
|
+
// .exec()
|
|
191
|
+
// .then((result) => {
|
|
192
|
+
// return {
|
|
193
|
+
// // n: result?.n,
|
|
194
|
+
// // opTime: result.opTime,
|
|
195
|
+
// // ok: result?.ok,
|
|
196
|
+
// // operationTime,
|
|
197
|
+
// deletedCount: result?.deletedCount
|
|
198
|
+
// };
|
|
199
|
+
// });
|
|
200
|
+
// }
|
|
192
201
|
async unsetUnnecessaryFields(params) {
|
|
193
202
|
return this.messageModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
194
203
|
.exec();
|
|
@@ -31,13 +31,7 @@ interface IOnTaskStatusChanged {
|
|
|
31
31
|
interface IOnEventChanged {
|
|
32
32
|
informEvent2agg?: factory.project.IInformParams[];
|
|
33
33
|
}
|
|
34
|
-
interface
|
|
35
|
-
/**
|
|
36
|
-
* AggService通知先
|
|
37
|
-
*/
|
|
38
|
-
informTransaction?: factory.project.IInformParams[];
|
|
39
|
-
}
|
|
40
|
-
interface IStorageSettings {
|
|
34
|
+
export interface IStorageSettings {
|
|
41
35
|
/**
|
|
42
36
|
* 取引保管期間(Confirmed)
|
|
43
37
|
* default:365
|
|
@@ -85,7 +79,7 @@ interface ITriggerWebhookSettings {
|
|
|
85
79
|
retryCountMax?: number;
|
|
86
80
|
retryIntervalInMS?: number;
|
|
87
81
|
}
|
|
88
|
-
interface IWaiterSettings {
|
|
82
|
+
export interface IWaiterSettings {
|
|
89
83
|
disabled?: boolean;
|
|
90
84
|
passportUnavailable?: boolean;
|
|
91
85
|
passportIssuers: string[];
|
|
@@ -235,7 +229,6 @@ export interface ISetting {
|
|
|
235
229
|
onResourceUpdated?: {
|
|
236
230
|
informResource?: factory.project.IInformParams[];
|
|
237
231
|
};
|
|
238
|
-
onTransactionStatusChanged?: IOnTransactionStatusChanged;
|
|
239
232
|
orderNumber?: IOrderNumberSetting;
|
|
240
233
|
project: {
|
|
241
234
|
id: string;
|
|
@@ -16,7 +16,7 @@ const schemaDefinition = {
|
|
|
16
16
|
onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
|
|
18
18
|
onResourceUpdated: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
onTransactionStatusChanged:
|
|
19
|
+
// onTransactionStatusChanged: SchemaTypes.Mixed, // discontinue(2026-06-29~)
|
|
20
20
|
orderNumber: mongoose_1.SchemaTypes.Mixed,
|
|
21
21
|
quota: mongoose_1.SchemaTypes.Mixed,
|
|
22
22
|
serviceOutputIdentifier: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { IWaiterSettings } from '../mongoose/schemas/setting';
|
|
3
|
+
interface IDBOptions {
|
|
4
|
+
connection: Connection;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 流入制限設定リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
export declare class WaiterSettingRepo {
|
|
10
|
+
private readonly settingModel;
|
|
11
|
+
private static cachedSettings;
|
|
12
|
+
private static cacheExpiry;
|
|
13
|
+
private static readonly CACHE_TTL_MS;
|
|
14
|
+
constructor(options: IDBOptions);
|
|
15
|
+
findWaiterSetting(): Promise<IWaiterSettings | undefined>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WaiterSettingRepo = void 0;
|
|
4
|
+
const setting_1 = require("../mongoose/schemas/setting");
|
|
5
|
+
/**
|
|
6
|
+
* 流入制限設定リポジトリ
|
|
7
|
+
*/
|
|
8
|
+
class WaiterSettingRepo {
|
|
9
|
+
settingModel;
|
|
10
|
+
// static にすることで、クラスが何回 new されてもメモリ上で1つだけ保持される
|
|
11
|
+
static cachedSettings;
|
|
12
|
+
static cacheExpiry = 0;
|
|
13
|
+
static CACHE_TTL_MS = 10 * 60 * 1000; // 10分
|
|
14
|
+
constructor(options) {
|
|
15
|
+
const { connection } = options;
|
|
16
|
+
this.settingModel = connection.model(setting_1.modelName, (0, setting_1.createSchema)());
|
|
17
|
+
}
|
|
18
|
+
async findWaiterSetting() {
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
// キャッシュ参照
|
|
21
|
+
if (WaiterSettingRepo.cachedSettings !== undefined && now < WaiterSettingRepo.cacheExpiry) {
|
|
22
|
+
return WaiterSettingRepo.cachedSettings;
|
|
23
|
+
}
|
|
24
|
+
const settingDoc = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, {
|
|
25
|
+
_id: 0,
|
|
26
|
+
waiter: 1
|
|
27
|
+
})
|
|
28
|
+
.lean()
|
|
29
|
+
.exec();
|
|
30
|
+
// キャッシュを更新
|
|
31
|
+
if (settingDoc?.waiter !== undefined) {
|
|
32
|
+
console.log('document exist!', settingDoc);
|
|
33
|
+
WaiterSettingRepo.cachedSettings = settingDoc.waiter;
|
|
34
|
+
WaiterSettingRepo.cacheExpiry = now + WaiterSettingRepo.CACHE_TTL_MS;
|
|
35
|
+
}
|
|
36
|
+
return WaiterSettingRepo.cachedSettings;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.WaiterSettingRepo = WaiterSettingRepo;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
|
-
import { ISetting } from './mongoose/schemas/setting';
|
|
3
|
-
type IKeyOfProjection = keyof ISetting
|
|
4
|
-
|
|
2
|
+
import { ISetting, IStorageSettings } from './mongoose/schemas/setting';
|
|
3
|
+
type IKeyOfProjection = Exclude<keyof ISetting, 'jwt' | 'project' | 'waiter' | 'integration'>;
|
|
4
|
+
type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'onEventChanged' | 'onOrderStatusChanged' | 'onReservationStatusChanged' | 'onResourceUpdated' | 'onTaskStatusChanged' | 'orderNumber' | 'quota' | 'serviceOutputIdentifier' | 'storage' | 'transactionNumber' | 'triggerWebhook' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
|
|
5
|
+
export { IGlobalSetting as ISetting };
|
|
5
6
|
/**
|
|
6
7
|
* 設定リポジトリ
|
|
7
8
|
*/
|
|
@@ -15,14 +16,14 @@ export declare class SettingRepo {
|
|
|
15
16
|
$eq?: string;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
|
-
}, inclusion: IKeyOfProjection[]): Promise<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
19
|
+
}, inclusion: IKeyOfProjection[]): Promise<IGlobalSetting | null>;
|
|
20
|
+
/**
|
|
21
|
+
* 初期設定追加専用
|
|
22
|
+
*/
|
|
23
|
+
addGlobalStorageSettings(params: {
|
|
24
|
+
key: keyof IStorageSettings;
|
|
25
|
+
value: number;
|
|
26
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
26
27
|
unsetUnnecessaryFields(params: {
|
|
27
28
|
filter: FilterQuery<ISetting>;
|
|
28
29
|
$unset: any;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SettingRepo = void 0;
|
|
4
|
-
// import { factory } from '../factory';
|
|
5
4
|
const setting_1 = require("./mongoose/schemas/setting");
|
|
6
5
|
/**
|
|
7
6
|
* 設定リポジトリ
|
|
@@ -36,24 +35,13 @@ class SettingRepo {
|
|
|
36
35
|
.lean()
|
|
37
36
|
.exec();
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
/**
|
|
39
|
+
* 初期設定追加専用
|
|
40
|
+
*/
|
|
41
|
+
async addGlobalStorageSettings(params) {
|
|
42
|
+
return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
|
|
42
43
|
$set: {
|
|
43
|
-
|
|
44
|
-
...(onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined,
|
|
45
|
-
...(onTaskStatusChanged !== undefined) ? { onTaskStatusChanged } : undefined,
|
|
46
|
-
...(onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined,
|
|
47
|
-
...(defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined,
|
|
48
|
-
...(useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined,
|
|
49
|
-
...(userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined,
|
|
50
|
-
...(userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined,
|
|
51
|
-
...(storage !== undefined) ? { storage } : undefined,
|
|
52
|
-
...(quota !== undefined) ? { quota } : undefined,
|
|
53
|
-
...(triggerWebhook !== undefined) ? { triggerWebhook } : undefined,
|
|
54
|
-
...(waiter !== undefined) ? { waiter } : undefined,
|
|
55
|
-
...(orderNumber !== undefined) ? { orderNumber } : undefined,
|
|
56
|
-
...(transactionNumber !== undefined) ? { transactionNumber } : undefined
|
|
44
|
+
[`storage.${params.key}`]: params.value
|
|
57
45
|
}
|
|
58
46
|
})
|
|
59
47
|
.exec();
|
|
@@ -81,6 +81,7 @@ import type { ServiceAvailableHourRepo } from './repo/service/availableHour';
|
|
|
81
81
|
import type { SettingRepo } from './repo/setting';
|
|
82
82
|
import type { IntegrationSettingRepo } from './repo/setting/integration';
|
|
83
83
|
import type { JWTSettingRepo } from './repo/setting/jwt';
|
|
84
|
+
import type { WaiterSettingRepo } from './repo/setting/waiter';
|
|
84
85
|
import type { StockHolderRepo } from './repo/stockHolder';
|
|
85
86
|
import type { TaskRepo } from './repo/task';
|
|
86
87
|
import type { TicketRepo } from './repo/ticket';
|
|
@@ -446,6 +447,10 @@ export declare namespace setting {
|
|
|
446
447
|
namespace JWT {
|
|
447
448
|
function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
|
|
448
449
|
}
|
|
450
|
+
type Waiter = WaiterSettingRepo;
|
|
451
|
+
namespace Waiter {
|
|
452
|
+
function createInstance(...params: ConstructorParameters<typeof WaiterSettingRepo>): Promise<WaiterSettingRepo>;
|
|
453
|
+
}
|
|
449
454
|
}
|
|
450
455
|
export type StockHolder = StockHolderRepo;
|
|
451
456
|
export declare namespace StockHolder {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -933,6 +933,17 @@ var setting;
|
|
|
933
933
|
}
|
|
934
934
|
JWT.createInstance = createInstance;
|
|
935
935
|
})(JWT = setting.JWT || (setting.JWT = {}));
|
|
936
|
+
let Waiter;
|
|
937
|
+
(function (Waiter) {
|
|
938
|
+
let repo;
|
|
939
|
+
async function createInstance(...params) {
|
|
940
|
+
if (repo === undefined) {
|
|
941
|
+
repo = (await import('./repo/setting/waiter.js')).WaiterSettingRepo;
|
|
942
|
+
}
|
|
943
|
+
return new repo(...params);
|
|
944
|
+
}
|
|
945
|
+
Waiter.createInstance = createInstance;
|
|
946
|
+
})(Waiter = setting.Waiter || (setting.Waiter = {}));
|
|
936
947
|
})(setting || (exports.setting = setting = {}));
|
|
937
948
|
var StockHolder;
|
|
938
949
|
(function (StockHolder) {
|
|
@@ -38,7 +38,7 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
|
38
38
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
39
39
|
const action_1 = require("../../repo/action");
|
|
40
40
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
41
|
-
|
|
41
|
+
// import { MessageRepo } from '../../repo/message';
|
|
42
42
|
const note_1 = require("../../repo/note");
|
|
43
43
|
const order_1 = require("../../repo/order");
|
|
44
44
|
const reservation_1 = require("../../repo/reservation");
|
|
@@ -56,7 +56,7 @@ function call(data) {
|
|
|
56
56
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
57
57
|
action: new action_1.ActionRepo(connection),
|
|
58
58
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
59
|
-
message: new
|
|
59
|
+
// message: new MessageRepo(connection),
|
|
60
60
|
note: new note_1.NoteRepo(connection),
|
|
61
61
|
order: new order_1.OrderRepo(connection),
|
|
62
62
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
@@ -3,7 +3,6 @@ import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
|
3
3
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
4
4
|
import type { ActionRepo } from '../../repo/action';
|
|
5
5
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
|
-
import type { MessageRepo } from '../../repo/message';
|
|
7
6
|
import type { NoteRepo } from '../../repo/note';
|
|
8
7
|
import type { OrderRepo } from '../../repo/order';
|
|
9
8
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
@@ -15,7 +14,6 @@ interface IDeleteTransactionRepos {
|
|
|
15
14
|
accountingReport: AccountingReportRepo;
|
|
16
15
|
action: ActionRepo;
|
|
17
16
|
assetTransaction: AssetTransactionRepo;
|
|
18
|
-
message: MessageRepo;
|
|
19
17
|
note: NoteRepo;
|
|
20
18
|
order: OrderRepo;
|
|
21
19
|
reservation: ReservationRepo;
|
|
@@ -69,7 +69,7 @@ function deleteTransactionById(params) {
|
|
|
69
69
|
let deleteCancelReservationTransactionResult;
|
|
70
70
|
let deletedReservationNumbers = [];
|
|
71
71
|
let deleteActionResult;
|
|
72
|
-
let deleteMessagessResult;
|
|
72
|
+
// let deleteMessagessResult: IDeleteResult | undefined;
|
|
73
73
|
const action = await repos.action.start(actionAttributes);
|
|
74
74
|
try {
|
|
75
75
|
const transactionTypeOf = transaction.typeOf;
|
|
@@ -127,11 +127,12 @@ function deleteTransactionById(params) {
|
|
|
127
127
|
]
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
// メッセージはcronで定期削除するため取引削除における連動は廃止(2026-06-29~)
|
|
131
|
+
// // messages削除(2024-05-01~)
|
|
132
|
+
// const deleteMessagesByPlaceOrderResult = await deleteMessagesByPlaceOrder({
|
|
133
|
+
// transaction: params.object
|
|
134
|
+
// })(repos);
|
|
135
|
+
// deleteMessagessResult = deleteMessagesByPlaceOrderResult.deleteResult;
|
|
135
136
|
// 取引削除
|
|
136
137
|
await repos.transaction.findByIdAndDelete({ id: transaction.id });
|
|
137
138
|
break;
|
|
@@ -164,7 +165,7 @@ function deleteTransactionById(params) {
|
|
|
164
165
|
deleteCancelReservationTransactionResult,
|
|
165
166
|
deletedReservationNumbers,
|
|
166
167
|
deleteActionResult,
|
|
167
|
-
...(deleteMessagessResult !== undefined) ? { deleteMessagessResult } : undefined
|
|
168
|
+
// ...(deleteMessagessResult !== undefined) ? { deleteMessagessResult } : undefined
|
|
168
169
|
};
|
|
169
170
|
await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
170
171
|
};
|
|
@@ -277,24 +278,30 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
277
278
|
return { deletePayTransactionResult, deleteRefundResult, payTransactionNumbers };
|
|
278
279
|
};
|
|
279
280
|
}
|
|
280
|
-
function deleteMessagesByPlaceOrder(params
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
281
|
+
// function deleteMessagesByPlaceOrder(params: {
|
|
282
|
+
// transaction: factory.task.deleteTransaction.IObject;
|
|
283
|
+
// }) {
|
|
284
|
+
// return async (repos: {
|
|
285
|
+
// message: MessageRepo;
|
|
286
|
+
// }): Promise<{
|
|
287
|
+
// deleteResult?: IDeleteResult;
|
|
288
|
+
// }> => {
|
|
289
|
+
// let deleteResult: IDeleteResult | undefined;
|
|
290
|
+
// if (params.transaction.typeOf === factory.transactionType.PlaceOrder
|
|
291
|
+
// && params.transaction.specifyingMethod === factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id) {
|
|
292
|
+
// const orderNumber = params.transaction.object.orderNumber;
|
|
293
|
+
// if (typeof orderNumber === 'string' && orderNumber.length > 0) {
|
|
294
|
+
// const deleteReservationsResult = await repos.message.deleteByMainEntityOrderNumber({
|
|
295
|
+
// project: { id: params.transaction.project.id },
|
|
296
|
+
// mainEntity: { orderNumber }
|
|
297
|
+
// });
|
|
298
|
+
// deleteResult = {
|
|
299
|
+
// n: deleteReservationsResult?.n,
|
|
300
|
+
// ok: deleteReservationsResult?.ok,
|
|
301
|
+
// deletedCount: deleteReservationsResult?.deletedCount
|
|
302
|
+
// };
|
|
303
|
+
// }
|
|
304
|
+
// }
|
|
305
|
+
// return { deleteResult };
|
|
306
|
+
// };
|
|
307
|
+
// }
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
-
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.IAttributes<factory.taskName.
|
|
3
|
+
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.IAttributes<factory.taskName.DeleteTransaction> | factory.task.IAttributes<factory.taskName.VoidPayTransaction> | factory.task.IAttributes<factory.taskName.VoidReserveTransaction>;
|
|
4
4
|
/**
|
|
5
5
|
* 取引のタスクを作成する
|
|
6
6
|
*/
|
|
7
7
|
export declare function createTasks(params: {
|
|
8
8
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'endDate' | 'id' | 'object' | 'project' | 'seller' | 'startDate' | 'status' | 'typeOf'>;
|
|
9
9
|
runsAt: Date;
|
|
10
|
-
|
|
11
|
-
}, setting: Pick<ISetting, 'onTransactionStatusChanged' | 'storage'> | null): IPlaceOrderPotentialTask[];
|
|
10
|
+
}, setting: Pick<ISetting, 'storage'> | null): IPlaceOrderPotentialTask[];
|
|
12
11
|
export {};
|
|
@@ -9,53 +9,52 @@ const factory_1 = require("../../../../factory");
|
|
|
9
9
|
/**
|
|
10
10
|
* 取引のタスクを作成する
|
|
11
11
|
*/
|
|
12
|
-
function createTasks(params, setting
|
|
13
|
-
// settings: Settings
|
|
14
|
-
) {
|
|
12
|
+
function createTasks(params, setting) {
|
|
15
13
|
const taskAttributes = [];
|
|
16
14
|
const transaction = params.transaction;
|
|
17
15
|
const taskRunsAt = params.runsAt;
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
16
|
+
// 取引通知は廃止(2026-06-29~)
|
|
17
|
+
// const informTransaction = setting?.onTransactionStatusChanged?.informTransaction;
|
|
18
|
+
// const transactionWebhookUrls = (Array.isArray(informTransaction)) ? informTransaction : [];
|
|
19
|
+
// const triggerWebhookTaskAttributes: factory.task.IAttributes<factory.taskName.TriggerWebhook>[] = [];
|
|
20
|
+
// transactionWebhookUrls.forEach(({ recipient }) => {
|
|
21
|
+
// if (typeof recipient?.url === 'string') {
|
|
22
|
+
// const informObject: factory.notification.transaction.IPlaceOrderAsNotification = {
|
|
23
|
+
// id: transaction.id,
|
|
24
|
+
// typeOf: transaction.typeOf,
|
|
25
|
+
// project: transaction.project,
|
|
26
|
+
// seller: transaction.seller,
|
|
27
|
+
// startDate: transaction.startDate,
|
|
28
|
+
// status: transaction.status,
|
|
29
|
+
// ...(transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined
|
|
30
|
+
// };
|
|
31
|
+
// const data: factory.task.triggerWebhook.IInformAnyResourceAction = {
|
|
32
|
+
// object: informObject,
|
|
33
|
+
// recipient: {
|
|
34
|
+
// id: (typeof recipient?.id === 'string') ? recipient.id : '',
|
|
35
|
+
// name: recipient?.name,
|
|
36
|
+
// typeOf: factory.creativeWorkType.WebApplication
|
|
37
|
+
// // url: recipient.url // discontinue(2025-02-13~)
|
|
38
|
+
// },
|
|
39
|
+
// target: {
|
|
40
|
+
// httpMethod: 'POST',
|
|
41
|
+
// encodingType: factory.encodingFormat.Application.json,
|
|
42
|
+
// typeOf: 'EntryPoint',
|
|
43
|
+
// urlTemplate: recipient.url
|
|
44
|
+
// }
|
|
45
|
+
// };
|
|
46
|
+
// triggerWebhookTaskAttributes.push({
|
|
47
|
+
// project: transaction.project,
|
|
48
|
+
// name: factory.taskName.TriggerWebhook,
|
|
49
|
+
// status: factory.taskStatus.Ready,
|
|
50
|
+
// runsAt: taskRunsAt,
|
|
51
|
+
// remainingNumberOfTries: 3,
|
|
52
|
+
// numberOfTried: 0,
|
|
53
|
+
// executionResults: [],
|
|
54
|
+
// data
|
|
55
|
+
// });
|
|
56
|
+
// }
|
|
57
|
+
// });
|
|
59
58
|
const confirmedStoragePeriodInDays = setting?.storage?.transactionConfirmedInDays;
|
|
60
59
|
const canceledStoragePeriodInDays = setting?.storage?.transactionCanceledInDays;
|
|
61
60
|
if (typeof confirmedStoragePeriodInDays !== 'number') {
|
|
@@ -140,7 +139,7 @@ function createTasks(params, setting
|
|
|
140
139
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
141
140
|
}
|
|
142
141
|
};
|
|
143
|
-
taskAttributes.push(
|
|
142
|
+
taskAttributes.push(deleteTransactionTask);
|
|
144
143
|
switch (transaction.status) {
|
|
145
144
|
case factory_1.factory.transactionStatusType.Confirmed: {
|
|
146
145
|
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
@@ -182,15 +181,7 @@ function createTasks(params, setting
|
|
|
182
181
|
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
183
182
|
break;
|
|
184
183
|
case factory_1.factory.transactionStatusType.Expired:
|
|
185
|
-
|
|
186
|
-
if (params.optimizeRedundantTasks === true) {
|
|
187
|
-
if (typeof params.transaction.object.orderNumber === 'string') {
|
|
188
|
-
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
193
|
-
}
|
|
184
|
+
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
194
185
|
break;
|
|
195
186
|
default:
|
|
196
187
|
throw new factory_1.factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -16,9 +16,5 @@ declare function exportTasksById(params: {
|
|
|
16
16
|
* タスク実行日時バッファ
|
|
17
17
|
*/
|
|
18
18
|
runsTasksAfterInSeconds?: number;
|
|
19
|
-
/**
|
|
20
|
-
* support optimizeRedundantTasks(2025-03-11~)
|
|
21
|
-
*/
|
|
22
|
-
optimizeRedundantTasks: boolean;
|
|
23
19
|
}): ITaskAndTransactionOperation<void>;
|
|
24
20
|
export { IExportTasksByIdRepos, exportTasksById };
|
|
@@ -26,11 +26,10 @@ function exportTasksById(params) {
|
|
|
26
26
|
.toDate();
|
|
27
27
|
}
|
|
28
28
|
// search settings
|
|
29
|
-
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['
|
|
29
|
+
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['storage']);
|
|
30
30
|
const taskAttributes = (0, factory_2.createTasks)({
|
|
31
31
|
transaction,
|
|
32
|
-
runsAt: taskRunsAt
|
|
33
|
-
optimizeRedundantTasks: params.optimizeRedundantTasks === true
|
|
32
|
+
runsAt: taskRunsAt
|
|
34
33
|
}, setting
|
|
35
34
|
// settings
|
|
36
35
|
);
|
|
@@ -28,10 +28,6 @@ export declare function exportOneTransactionTasksIfExists(params: {
|
|
|
28
28
|
* タスク実行日時バッファ
|
|
29
29
|
*/
|
|
30
30
|
runsTasksAfterInSeconds?: number;
|
|
31
|
-
/**
|
|
32
|
-
* support optimizeRedundantTasks(2025-03-11~)
|
|
33
|
-
*/
|
|
34
|
-
optimizeRedundantTasks: boolean;
|
|
35
31
|
status?: {
|
|
36
32
|
$eq?: factory.transactionStatusType;
|
|
37
33
|
};
|
|
@@ -65,7 +65,7 @@ function exportOneTransactionTasksIfExists(params) {
|
|
|
65
65
|
case factory_1.factory.transactionType.PlaceOrder:
|
|
66
66
|
await PlaceOrderTransactionService.exportTasksById({
|
|
67
67
|
id: transaction.id,
|
|
68
|
-
optimizeRedundantTasks: params.optimizeRedundantTasks === true,
|
|
68
|
+
// optimizeRedundantTasks: params.optimizeRedundantTasks === true,
|
|
69
69
|
...(typeof params.runsTasksAfterInSeconds === 'number')
|
|
70
70
|
? { runsTasksAfterInSeconds: params.runsTasksAfterInSeconds }
|
|
71
71
|
: undefined
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "9.
|
|
14
|
+
"@chevre/factory": "9.3.0",
|
|
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",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "25.0.0-alpha.
|
|
94
|
+
"version": "25.0.0-alpha.24"
|
|
95
95
|
}
|