@chevre/domain 21.2.0-alpha.2 → 21.2.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/lockStockHolder.ts +48 -0
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
- package/example/src/chevre/processReserve.ts +2 -2
- package/example/src/chevre/searchEventSeats.ts +42 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/makeExpired.ts +18 -0
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/startExportTasks.ts +19 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +28 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +28 -0
- package/lib/chevre/eventEmitter.d.ts +3 -0
- package/lib/chevre/eventEmitter.js +7 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/account.js +0 -4
- package/lib/chevre/repo/accountTitle.js +0 -4
- package/lib/chevre/repo/accountTransaction.d.ts +0 -10
- package/lib/chevre/repo/accountTransaction.js +0 -57
- package/lib/chevre/repo/accountingReport.js +0 -4
- package/lib/chevre/repo/action.js +0 -4
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +4 -6
- package/lib/chevre/repo/assetTransaction.js +69 -45
- package/lib/chevre/repo/categoryCode.js +0 -4
- package/lib/chevre/repo/code.js +0 -4
- package/lib/chevre/repo/comment.js +0 -4
- package/lib/chevre/repo/confirmationNumber.js +1 -1
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +0 -4
- package/lib/chevre/repo/customer.js +0 -4
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +0 -4
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/event.js +0 -4
- package/lib/chevre/repo/member.js +0 -4
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +42 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +62 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +38 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offer.js +0 -5
- package/lib/chevre/repo/offerCatalog.js +0 -4
- package/lib/chevre/repo/order.d.ts +25 -0
- package/lib/chevre/repo/order.js +5 -4
- package/lib/chevre/repo/orderNumber.d.ts +0 -1
- package/lib/chevre/repo/orderNumber.js +2 -12
- package/lib/chevre/repo/ownershipInfo.js +0 -4
- package/lib/chevre/repo/permit.js +0 -4
- package/lib/chevre/repo/place.d.ts +5 -1
- package/lib/chevre/repo/place.js +1 -10
- package/lib/chevre/repo/priceSpecification.js +0 -4
- package/lib/chevre/repo/product.js +0 -4
- package/lib/chevre/repo/project.js +0 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -2
- package/lib/chevre/repo/rateLimit/offer.js +14 -14
- package/lib/chevre/repo/reservation.js +0 -4
- package/lib/chevre/repo/role.js +0 -4
- package/lib/chevre/repo/seller.js +0 -4
- package/lib/chevre/repo/serviceOutput.js +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +2 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +14 -15
- package/lib/chevre/repo/{itemAvailability/screeningEvent.d.ts → stockHolder.d.ts} +5 -6
- package/lib/chevre/repo/stockHolder.js +273 -0
- package/lib/chevre/repo/task.d.ts +17 -2
- package/lib/chevre/repo/task.js +61 -10
- package/lib/chevre/repo/telemetry.js +0 -4
- package/lib/chevre/repo/transaction.d.ts +3 -2
- package/lib/chevre/repo/transaction.js +116 -54
- package/lib/chevre/repo/transactionNumber.d.ts +2 -1
- package/lib/chevre/repo/transactionNumber.js +14 -15
- package/lib/chevre/repo/trip.js +0 -4
- package/lib/chevre/repository.d.ts +3 -5
- package/lib/chevre/repository.js +5 -8
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +4 -3
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -5
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/registerService.js +1 -2
- package/lib/chevre/service/assetTransaction/reserve.d.ts +4 -4
- package/lib/chevre/service/assetTransaction/reserve.js +8 -5
- package/lib/chevre/service/assetTransaction.d.ts +0 -2
- package/lib/chevre/service/assetTransaction.js +0 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer.d.ts +2 -2
- package/lib/chevre/service/offer.js +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -1
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -5
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
- package/lib/chevre/service/reserve/cancelReservation.js +6 -6
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +3 -3
- package/lib/chevre/service/task/cancelReservation.js +3 -3
- package/lib/chevre/service/task/voidReserveTransaction.js +3 -3
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +22 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -3
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
- package/lib/chevre/service/transaction/returnOrder.js +1 -5
- package/lib/chevre/service/transaction.d.ts +1 -0
- package/lib/chevre/service/transaction.js +1 -7
- package/lib/chevre/settings.d.ts +2 -1
- package/lib/chevre/settings.js +5 -4
- package/package.json +4 -4
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/lib/chevre/repo/itemAvailability/screeningEvent.js +0 -193
package/lib/chevre/repo/task.js
CHANGED
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
16
15
|
const task_1 = require("./mongoose/schemas/task");
|
|
16
|
+
const task_2 = require("../eventEmitter/task");
|
|
17
17
|
/**
|
|
18
18
|
* タスク実行時のソート条件
|
|
19
19
|
*/
|
|
@@ -27,9 +27,6 @@ const sortOrder4executionOfTasks = {
|
|
|
27
27
|
class MongoRepository {
|
|
28
28
|
constructor(connection) {
|
|
29
29
|
this.taskModel = connection.model(task_1.modelName, task_1.schema);
|
|
30
|
-
if (connection.get('autoIndex') === true) {
|
|
31
|
-
this.taskModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
32
|
-
}
|
|
33
30
|
}
|
|
34
31
|
// tslint:disable-next-line:max-func-body-length
|
|
35
32
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -153,27 +150,37 @@ class MongoRepository {
|
|
|
153
150
|
}
|
|
154
151
|
return andConditions;
|
|
155
152
|
}
|
|
156
|
-
saveMany(taskAttributes) {
|
|
153
|
+
saveMany(taskAttributes, options) {
|
|
157
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const emitImmediately = (options === null || options === void 0 ? void 0 : options.emitImmediately) === true;
|
|
158
156
|
if (taskAttributes.length > 0) {
|
|
159
157
|
const result = yield this.taskModel.insertMany(taskAttributes, { ordered: false, rawResult: true });
|
|
160
158
|
if (result.insertedCount !== taskAttributes.length) {
|
|
161
159
|
throw new factory.errors.ServiceUnavailable('all tasks not saved');
|
|
162
160
|
}
|
|
163
|
-
|
|
164
|
-
return Object.values(result.insertedIds)
|
|
161
|
+
const savedTasks = Object.values(result.insertedIds)
|
|
165
162
|
.map((objectId) => {
|
|
166
163
|
return { id: objectId.toHexString() };
|
|
167
164
|
});
|
|
165
|
+
if (emitImmediately) {
|
|
166
|
+
taskAttributes.forEach((savedTask) => {
|
|
167
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
168
|
+
name: savedTask.name,
|
|
169
|
+
status: factory.taskStatus.Ready
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// return result.ops;
|
|
174
|
+
return savedTasks;
|
|
168
175
|
}
|
|
169
176
|
else {
|
|
170
177
|
return [];
|
|
171
178
|
}
|
|
172
179
|
});
|
|
173
180
|
}
|
|
174
|
-
createInformTaskIfNotExist(params) {
|
|
181
|
+
createInformTaskIfNotExist(params, options) {
|
|
175
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
yield this.taskModel.findOneAndUpdate({
|
|
183
|
+
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
177
184
|
'project.id': { $eq: params.project.id },
|
|
178
185
|
name: params.name,
|
|
179
186
|
'data.object.id': {
|
|
@@ -181,7 +188,38 @@ class MongoRepository {
|
|
|
181
188
|
$eq: String(params.data.object.id)
|
|
182
189
|
}
|
|
183
190
|
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
191
|
+
.select({ _id: 1 })
|
|
184
192
|
.exec();
|
|
193
|
+
if (options.emitImmediately) {
|
|
194
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
195
|
+
id: createdTask.id,
|
|
196
|
+
name: params.name,
|
|
197
|
+
status: factory.taskStatus.Ready
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
executeById(params) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
const doc = yield this.taskModel.findOneAndUpdate({
|
|
205
|
+
status: factory.taskStatus.Ready,
|
|
206
|
+
runsAt: { $lt: new Date() },
|
|
207
|
+
_id: { $eq: params.id }
|
|
208
|
+
}, {
|
|
209
|
+
status: factory.taskStatus.Running,
|
|
210
|
+
lastTriedAt: new Date(),
|
|
211
|
+
$inc: {
|
|
212
|
+
remainingNumberOfTries: -1,
|
|
213
|
+
numberOfTried: 1 // トライ回数増やす
|
|
214
|
+
},
|
|
215
|
+
executor: params.executor
|
|
216
|
+
}, { new: true })
|
|
217
|
+
.exec();
|
|
218
|
+
if (doc === null) {
|
|
219
|
+
// tslint:disable-next-line:no-null-keyword
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
return doc.toObject();
|
|
185
223
|
});
|
|
186
224
|
}
|
|
187
225
|
executeOneByName(params) {
|
|
@@ -196,7 +234,8 @@ class MongoRepository {
|
|
|
196
234
|
$inc: {
|
|
197
235
|
remainingNumberOfTries: -1,
|
|
198
236
|
numberOfTried: 1 // トライ回数増やす
|
|
199
|
-
}
|
|
237
|
+
},
|
|
238
|
+
executor: params.executor
|
|
200
239
|
}, { new: true })
|
|
201
240
|
.sort(sortOrder4executionOfTasks)
|
|
202
241
|
.exec();
|
|
@@ -344,6 +383,18 @@ class MongoRepository {
|
|
|
344
383
|
.exec();
|
|
345
384
|
});
|
|
346
385
|
}
|
|
386
|
+
countDelayedTasks(params) {
|
|
387
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
388
|
+
const runsAtLt = moment()
|
|
389
|
+
.add(-params.delayInSeconds, 'seconds')
|
|
390
|
+
.toDate();
|
|
391
|
+
return this.taskModel.count({
|
|
392
|
+
status: factory.taskStatus.Ready,
|
|
393
|
+
runsAt: { $lt: runsAtLt }
|
|
394
|
+
})
|
|
395
|
+
.exec();
|
|
396
|
+
});
|
|
397
|
+
}
|
|
347
398
|
aggregateTask(params) {
|
|
348
399
|
return __awaiter(this, void 0, void 0, function* () {
|
|
349
400
|
const statuses = yield Promise.all([
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongoRepository = void 0;
|
|
4
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
5
4
|
const telemetry_1 = require("./mongoose/schemas/telemetry");
|
|
6
5
|
/**
|
|
7
6
|
* 測定リポジトリ
|
|
@@ -9,9 +8,6 @@ const telemetry_1 = require("./mongoose/schemas/telemetry");
|
|
|
9
8
|
class MongoRepository {
|
|
10
9
|
constructor(connection) {
|
|
11
10
|
this.telemetryModel = connection.model(telemetry_1.modelName, telemetry_1.schema);
|
|
12
|
-
if (connection.get('autoIndex') === true) {
|
|
13
|
-
this.telemetryModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
14
|
-
}
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
13
|
exports.MongoRepository = MongoRepository;
|
|
@@ -111,7 +111,8 @@ export declare class MongoRepository {
|
|
|
111
111
|
$in: T[];
|
|
112
112
|
};
|
|
113
113
|
status: factory.transactionStatusType;
|
|
114
|
-
|
|
114
|
+
id?: string;
|
|
115
|
+
}): Promise<Pick<factory.transaction.ITransaction<T>, 'id' | 'typeOf'> | null>;
|
|
115
116
|
/**
|
|
116
117
|
* タスクエクスポートリトライ
|
|
117
118
|
* TODO updatedAtを基準にしているが、タスクエクスポートトライ日時を持たせた方が安全か?
|
|
@@ -150,7 +151,7 @@ export declare class MongoRepository {
|
|
|
150
151
|
/**
|
|
151
152
|
* 特定の取引を更新する(汎用)
|
|
152
153
|
*/
|
|
153
|
-
|
|
154
|
+
findByIdAndUpdateInProgress(params: {
|
|
154
155
|
id: string;
|
|
155
156
|
update: {
|
|
156
157
|
$set?: any;
|
|
@@ -12,17 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
16
15
|
const transaction_1 = require("./mongoose/schemas/transaction");
|
|
16
|
+
const transaction_2 = require("../eventEmitter/transaction");
|
|
17
17
|
/**
|
|
18
18
|
* 取引リポジトリ
|
|
19
19
|
*/
|
|
20
20
|
class MongoRepository {
|
|
21
21
|
constructor(connection) {
|
|
22
22
|
this.transactionModel = connection.model(transaction_1.modelName, transaction_1.schema);
|
|
23
|
-
if (connection.get('autoIndex') === true) {
|
|
24
|
-
this.transactionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
25
|
-
}
|
|
26
23
|
}
|
|
27
24
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
28
25
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -347,9 +344,9 @@ class MongoRepository {
|
|
|
347
344
|
var _a, _b;
|
|
348
345
|
return __awaiter(this, void 0, void 0, function* () {
|
|
349
346
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
350
|
-
_id: params.id,
|
|
351
|
-
typeOf: params.typeOf,
|
|
352
|
-
status: factory.transactionStatusType.InProgress
|
|
347
|
+
_id: { $eq: params.id },
|
|
348
|
+
typeOf: { $eq: params.typeOf },
|
|
349
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
353
350
|
}, {
|
|
354
351
|
$set: Object.assign(Object.assign({ 'agent.id': params.agent.id }, (typeof params.agent.name === 'string') ? { 'agent.name': params.agent.name } : undefined), (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.customer) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { 'object.customer': params.object.customer } : undefined)
|
|
355
352
|
}, {
|
|
@@ -367,9 +364,9 @@ class MongoRepository {
|
|
|
367
364
|
updateExpires(params) {
|
|
368
365
|
return __awaiter(this, void 0, void 0, function* () {
|
|
369
366
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
370
|
-
_id: params.id,
|
|
371
|
-
typeOf: params.typeOf,
|
|
372
|
-
status: factory.transactionStatusType.InProgress
|
|
367
|
+
_id: { $eq: params.id },
|
|
368
|
+
typeOf: { $eq: params.typeOf },
|
|
369
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
373
370
|
}, {
|
|
374
371
|
$set: {
|
|
375
372
|
expires: params.expires
|
|
@@ -391,9 +388,9 @@ class MongoRepository {
|
|
|
391
388
|
var _a;
|
|
392
389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
393
390
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
394
|
-
_id: params.id,
|
|
395
|
-
typeOf: params.typeOf,
|
|
396
|
-
status: factory.transactionStatusType.InProgress
|
|
391
|
+
_id: { $eq: params.id },
|
|
392
|
+
typeOf: { $eq: params.typeOf },
|
|
393
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
397
394
|
}, {
|
|
398
395
|
$set: Object.assign({}, (typeof ((_a = params.object) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? { 'object.name': params.object.name } : undefined)
|
|
399
396
|
}, {
|
|
@@ -411,9 +408,9 @@ class MongoRepository {
|
|
|
411
408
|
confirm(params) {
|
|
412
409
|
return __awaiter(this, void 0, void 0, function* () {
|
|
413
410
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
414
|
-
_id: params.id,
|
|
415
|
-
typeOf: params.typeOf,
|
|
416
|
-
status: factory.transactionStatusType.InProgress
|
|
411
|
+
_id: { $eq: params.id },
|
|
412
|
+
typeOf: { $eq: params.typeOf },
|
|
413
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
417
414
|
}, {
|
|
418
415
|
status: factory.transactionStatusType.Confirmed,
|
|
419
416
|
endDate: new Date(),
|
|
@@ -428,43 +425,44 @@ class MongoRepository {
|
|
|
428
425
|
// NotFoundであれば取引状態確認
|
|
429
426
|
if (doc === null) {
|
|
430
427
|
const transaction = yield this.findById({ typeOf: params.typeOf, id: params.id });
|
|
431
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
432
|
-
/* istanbul ignore next */
|
|
433
428
|
if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
434
|
-
//
|
|
435
|
-
return;
|
|
436
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
437
|
-
/* istanbul ignore next */
|
|
429
|
+
// すでに確定済の場合スルー
|
|
438
430
|
}
|
|
439
431
|
else if (transaction.status === factory.transactionStatusType.Expired) {
|
|
440
432
|
throw new factory.errors.Argument('Transaction id', 'Already expired');
|
|
441
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
442
|
-
/* istanbul ignore next */
|
|
443
433
|
}
|
|
444
434
|
else if (transaction.status === factory.transactionStatusType.Canceled) {
|
|
445
435
|
throw new factory.errors.Argument('Transaction id', 'Already canceled');
|
|
446
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
447
|
-
/* istanbul ignore next */
|
|
448
436
|
}
|
|
449
437
|
else {
|
|
450
438
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
451
439
|
}
|
|
452
440
|
}
|
|
453
|
-
|
|
441
|
+
transaction_2.transactionEventEmitter.emitTransactionStatusChanged({
|
|
442
|
+
id: params.id,
|
|
443
|
+
typeOf: params.typeOf,
|
|
444
|
+
status: factory.transactionStatusType.Confirmed
|
|
445
|
+
});
|
|
454
446
|
});
|
|
455
447
|
}
|
|
456
448
|
/**
|
|
457
449
|
* タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
|
|
458
450
|
*/
|
|
459
451
|
startExportTasks(params) {
|
|
452
|
+
var _a;
|
|
460
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
454
|
+
switch (params.status) {
|
|
455
|
+
case factory.transactionStatusType.InProgress:
|
|
456
|
+
throw new factory.errors.NotImplemented(`status "${params.status}" not implemented on startExportTasks`);
|
|
457
|
+
default:
|
|
458
|
+
// no op
|
|
459
|
+
}
|
|
460
|
+
const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
|
|
461
|
+
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.project !== undefined) ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), { tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting }, { new: true })
|
|
462
|
+
.select({
|
|
463
|
+
_id: 1,
|
|
464
|
+
typeOf: 1
|
|
465
|
+
})
|
|
468
466
|
.exec()
|
|
469
467
|
// tslint:disable-next-line:no-null-keyword
|
|
470
468
|
.then((doc) => (doc === null) ? null : doc.toObject());
|
|
@@ -477,17 +475,51 @@ class MongoRepository {
|
|
|
477
475
|
*/
|
|
478
476
|
reexportTasks(params) {
|
|
479
477
|
return __awaiter(this, void 0, void 0, function* () {
|
|
480
|
-
yield this.transactionModel.
|
|
481
|
-
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting,
|
|
478
|
+
const reexportingTransactions = yield this.transactionModel.find({
|
|
479
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
|
|
482
480
|
updatedAt: {
|
|
483
481
|
$lt: moment()
|
|
484
482
|
.add(-params.intervalInMinutes, 'minutes')
|
|
485
483
|
.toDate()
|
|
486
484
|
}
|
|
487
|
-
}, {
|
|
488
|
-
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
489
485
|
})
|
|
486
|
+
.select({
|
|
487
|
+
_id: 1,
|
|
488
|
+
typeOf: 1,
|
|
489
|
+
status: 1
|
|
490
|
+
})
|
|
491
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
490
492
|
.exec();
|
|
493
|
+
if (reexportingTransactions.length > 0) {
|
|
494
|
+
for (const reexportingTransaction of reexportingTransactions) {
|
|
495
|
+
yield this.transactionModel.updateOne({
|
|
496
|
+
_id: { $eq: reexportingTransaction.id },
|
|
497
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
498
|
+
}, {
|
|
499
|
+
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
500
|
+
})
|
|
501
|
+
.exec();
|
|
502
|
+
transaction_2.transactionEventEmitter.emitTransactionStatusChanged({
|
|
503
|
+
id: reexportingTransaction.id,
|
|
504
|
+
typeOf: reexportingTransaction.typeOf,
|
|
505
|
+
status: reexportingTransaction.status
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
// await this.transactionModel.updateMany(
|
|
510
|
+
// {
|
|
511
|
+
// tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
|
|
512
|
+
// updatedAt: {
|
|
513
|
+
// $lt: moment()
|
|
514
|
+
// .add(-params.intervalInMinutes, 'minutes')
|
|
515
|
+
// .toDate()
|
|
516
|
+
// }
|
|
517
|
+
// },
|
|
518
|
+
// {
|
|
519
|
+
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
520
|
+
// }
|
|
521
|
+
// )
|
|
522
|
+
// .exec();
|
|
491
523
|
});
|
|
492
524
|
}
|
|
493
525
|
/**
|
|
@@ -496,7 +528,10 @@ class MongoRepository {
|
|
|
496
528
|
*/
|
|
497
529
|
setTasksExportedById(params) {
|
|
498
530
|
return __awaiter(this, void 0, void 0, function* () {
|
|
499
|
-
yield this.transactionModel.
|
|
531
|
+
yield this.transactionModel.updateOne({
|
|
532
|
+
_id: { $eq: params.id },
|
|
533
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
534
|
+
}, {
|
|
500
535
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
501
536
|
tasksExportedAt: new Date()
|
|
502
537
|
})
|
|
@@ -508,15 +543,36 @@ class MongoRepository {
|
|
|
508
543
|
*/
|
|
509
544
|
makeExpired(params) {
|
|
510
545
|
return __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
//
|
|
512
|
-
yield this.transactionModel.
|
|
513
|
-
status: factory.transactionStatusType.InProgress,
|
|
546
|
+
// IDをemitしたいのでまずリスト検索(2023-04-27~)
|
|
547
|
+
const expiringTransactions = yield this.transactionModel.find({
|
|
548
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
514
549
|
expires: { $lt: params.expires }
|
|
515
|
-
}, {
|
|
516
|
-
status: factory.transactionStatusType.Expired,
|
|
517
|
-
endDate: new Date()
|
|
518
550
|
})
|
|
551
|
+
.select({
|
|
552
|
+
_id: 1,
|
|
553
|
+
typeOf: 1
|
|
554
|
+
})
|
|
555
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
519
556
|
.exec();
|
|
557
|
+
if (expiringTransactions.length > 0) {
|
|
558
|
+
// ステータスと期限を見て更新
|
|
559
|
+
yield this.transactionModel.updateMany({
|
|
560
|
+
_id: { $in: expiringTransactions.map((t) => t.id) },
|
|
561
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
562
|
+
expires: { $lt: params.expires }
|
|
563
|
+
}, {
|
|
564
|
+
status: factory.transactionStatusType.Expired,
|
|
565
|
+
endDate: new Date()
|
|
566
|
+
})
|
|
567
|
+
.exec();
|
|
568
|
+
expiringTransactions.forEach((expiringTransaction) => {
|
|
569
|
+
transaction_2.transactionEventEmitter.emitTransactionStatusChanged({
|
|
570
|
+
id: expiringTransaction.id,
|
|
571
|
+
typeOf: expiringTransaction.typeOf,
|
|
572
|
+
status: factory.transactionStatusType.Expired
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
}
|
|
520
576
|
});
|
|
521
577
|
}
|
|
522
578
|
/**
|
|
@@ -541,11 +597,8 @@ class MongoRepository {
|
|
|
541
597
|
// NotFoundであれば取引状態確認
|
|
542
598
|
if (doc === null) {
|
|
543
599
|
const transaction = yield this.findById(params);
|
|
544
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
545
|
-
/* istanbul ignore next */
|
|
546
600
|
if (transaction.status === factory.transactionStatusType.Canceled) {
|
|
547
|
-
//
|
|
548
|
-
return;
|
|
601
|
+
// すでに中止済の場合スルー
|
|
549
602
|
}
|
|
550
603
|
else if (transaction.status === factory.transactionStatusType.Expired) {
|
|
551
604
|
throw new factory.errors.Argument('Transaction id', 'Transaction already expired');
|
|
@@ -557,7 +610,11 @@ class MongoRepository {
|
|
|
557
610
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
558
611
|
}
|
|
559
612
|
}
|
|
560
|
-
|
|
613
|
+
transaction_2.transactionEventEmitter.emitTransactionStatusChanged({
|
|
614
|
+
id: params.id,
|
|
615
|
+
typeOf: params.typeOf,
|
|
616
|
+
status: factory.transactionStatusType.Canceled
|
|
617
|
+
});
|
|
561
618
|
});
|
|
562
619
|
}
|
|
563
620
|
count(params) {
|
|
@@ -615,9 +672,12 @@ class MongoRepository {
|
|
|
615
672
|
/**
|
|
616
673
|
* 特定の取引を更新する(汎用)
|
|
617
674
|
*/
|
|
618
|
-
|
|
675
|
+
findByIdAndUpdateInProgress(params) {
|
|
619
676
|
return __awaiter(this, void 0, void 0, function* () {
|
|
620
|
-
yield this.transactionModel.findOneAndUpdate({
|
|
677
|
+
yield this.transactionModel.findOneAndUpdate({
|
|
678
|
+
_id: { $eq: params.id },
|
|
679
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
680
|
+
}, params.update, {
|
|
621
681
|
// new: true,
|
|
622
682
|
projection: { _id: 1 }
|
|
623
683
|
})
|
|
@@ -632,7 +692,8 @@ class MongoRepository {
|
|
|
632
692
|
saveOrderNumberIfNotExist(params) {
|
|
633
693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
634
694
|
yield this.transactionModel.updateOne({
|
|
635
|
-
_id: params.id,
|
|
695
|
+
_id: { $eq: params.id },
|
|
696
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
636
697
|
'object.orderNumber': { $exists: false }
|
|
637
698
|
}, { 'object.orderNumber': params.orderNumber })
|
|
638
699
|
.exec();
|
|
@@ -641,7 +702,8 @@ class MongoRepository {
|
|
|
641
702
|
saveConfirmationNumberIfNotExist(params) {
|
|
642
703
|
return __awaiter(this, void 0, void 0, function* () {
|
|
643
704
|
yield this.transactionModel.updateOne({
|
|
644
|
-
_id: params.id,
|
|
705
|
+
_id: { $eq: params.id },
|
|
706
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
645
707
|
'object.confirmationNumber': { $exists: false }
|
|
646
708
|
}, { 'object.confirmationNumber': params.confirmationNumber })
|
|
647
709
|
.exec();
|
|
@@ -6,9 +6,10 @@ interface IPublishResult {
|
|
|
6
6
|
* 取引番号リポジトリ
|
|
7
7
|
*/
|
|
8
8
|
export declare class RedisRepository {
|
|
9
|
-
static REDIS_KEY_PREFIX
|
|
9
|
+
private static readonly REDIS_KEY_PREFIX;
|
|
10
10
|
private readonly redisClient;
|
|
11
11
|
constructor(redisClient: RedisClientType);
|
|
12
|
+
private static createKey;
|
|
12
13
|
/**
|
|
13
14
|
* タイムスタンプから発行する
|
|
14
15
|
*/
|
|
@@ -23,6 +23,9 @@ class RedisRepository {
|
|
|
23
23
|
constructor(redisClient) {
|
|
24
24
|
this.redisClient = redisClient;
|
|
25
25
|
}
|
|
26
|
+
static createKey(params) {
|
|
27
|
+
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, params.timestamp);
|
|
28
|
+
}
|
|
26
29
|
/**
|
|
27
30
|
* タイムスタンプから発行する
|
|
28
31
|
*/
|
|
@@ -35,30 +38,26 @@ class RedisRepository {
|
|
|
35
38
|
const TTL = moment(params.startDate)
|
|
36
39
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
37
40
|
.diff(now, 'seconds');
|
|
38
|
-
const key =
|
|
41
|
+
const key = RedisRepository.createKey({ startDate: params.startDate, timestamp });
|
|
39
42
|
const [incrReply] = yield this.redisClient.multi()
|
|
40
43
|
.incr(key)
|
|
41
44
|
.expire(key, TTL)
|
|
42
45
|
.exec();
|
|
43
46
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
44
47
|
/* istanbul ignore else: please write tests */
|
|
45
|
-
if (typeof incrReply
|
|
46
|
-
let transactionNumber = timestamp;
|
|
47
|
-
const no = incrReply;
|
|
48
|
-
transactionNumber = `${transactionNumber}${no}`;
|
|
49
|
-
// checkdigit
|
|
50
|
-
const cd = cdigit.luhn.compute(transactionNumber);
|
|
51
|
-
const cipher = fpe({ password: cd });
|
|
52
|
-
transactionNumber = cipher.encrypt(transactionNumber);
|
|
53
|
-
transactionNumber = `${cd}${transactionNumber}`;
|
|
54
|
-
return { transactionNumber };
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
48
|
+
if (typeof incrReply !== 'number') {
|
|
57
49
|
// 基本的にありえないフロー
|
|
58
|
-
throw new factory.errors.ServiceUnavailable('
|
|
50
|
+
throw new factory.errors.ServiceUnavailable('transaction number not incremented unexpectedly');
|
|
59
51
|
}
|
|
52
|
+
let transactionNumber = `${timestamp}${incrReply}`;
|
|
53
|
+
// checkdigit
|
|
54
|
+
const cd = cdigit.luhn.compute(transactionNumber);
|
|
55
|
+
transactionNumber = fpe({ password: cd })
|
|
56
|
+
.encrypt(transactionNumber);
|
|
57
|
+
transactionNumber = `${cd}${transactionNumber}`;
|
|
58
|
+
return { transactionNumber };
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
RedisRepository.REDIS_KEY_PREFIX = '
|
|
62
|
+
RedisRepository.REDIS_KEY_PREFIX = 'transactionNumber';
|
|
64
63
|
exports.RedisRepository = RedisRepository;
|
package/lib/chevre/repo/trip.js
CHANGED
|
@@ -22,7 +22,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
26
25
|
const trip_1 = require("./mongoose/schemas/trip");
|
|
27
26
|
/**
|
|
28
27
|
* トリップリポジトリ
|
|
@@ -30,9 +29,6 @@ const trip_1 = require("./mongoose/schemas/trip");
|
|
|
30
29
|
class MongoRepository {
|
|
31
30
|
constructor(connection) {
|
|
32
31
|
this.tripModel = connection.model(trip_1.modelName, trip_1.schema);
|
|
33
|
-
if (connection.get('autoIndex') === true) {
|
|
34
|
-
this.tripModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
35
|
-
}
|
|
36
32
|
}
|
|
37
33
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
38
34
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
@@ -16,7 +16,6 @@ import { MongoRepository as CreativeWorkRepo } from './repo/creativeWork';
|
|
|
16
16
|
import { MongoRepository as CustomerRepo } from './repo/customer';
|
|
17
17
|
import { MongoRepository as EmailMessageRepo } from './repo/emailMessage';
|
|
18
18
|
import { MongoRepository as EventRepo } from './repo/event';
|
|
19
|
-
import { RedisRepository as ScreeningEventItemAvailabilityRepo } from './repo/itemAvailability/screeningEvent';
|
|
20
19
|
import { MongoRepository as MemberRepo } from './repo/member';
|
|
21
20
|
import { MongoRepository as MerchantReturnPolicyRepo } from './repo/merchantReturnPolicy';
|
|
22
21
|
import { MongoRepository as OfferRepo } from './repo/offer';
|
|
@@ -34,6 +33,7 @@ import { MongoRepository as RoleRepo } from './repo/role';
|
|
|
34
33
|
import { MongoRepository as SellerRepo } from './repo/seller';
|
|
35
34
|
import { MongoRepository as ServiceOutputRepo } from './repo/serviceOutput';
|
|
36
35
|
import { RedisRepository as ServiceOutputIdentifierRepo } from './repo/serviceOutputIdentifier';
|
|
36
|
+
import { StockHolderRepository as StockHolderRepo } from './repo/stockHolder';
|
|
37
37
|
import { MongoRepository as TaskRepo } from './repo/task';
|
|
38
38
|
import { MongoRepository as TelemetryRepo } from './repo/telemetry';
|
|
39
39
|
import { MongoRepository as TransactionRepo } from './repo/transaction';
|
|
@@ -183,6 +183,8 @@ export declare class ServiceOutput extends ServiceOutputRepo {
|
|
|
183
183
|
}
|
|
184
184
|
export declare class ServiceOutputIdentifier extends ServiceOutputIdentifierRepo {
|
|
185
185
|
}
|
|
186
|
+
export declare class StockHolder extends StockHolderRepo {
|
|
187
|
+
}
|
|
186
188
|
export declare class Task extends TaskRepo {
|
|
187
189
|
}
|
|
188
190
|
export declare class Telemetry extends TelemetryRepo {
|
|
@@ -193,10 +195,6 @@ export declare class TransactionNumber extends TransactionNumberRepo {
|
|
|
193
195
|
}
|
|
194
196
|
export declare class Trip extends TripRepo {
|
|
195
197
|
}
|
|
196
|
-
export declare namespace itemAvailability {
|
|
197
|
-
class ScreeningEvent extends ScreeningEventItemAvailabilityRepo {
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
198
|
export declare namespace rateLimit {
|
|
201
199
|
class Offer extends OfferRateLimitRepo {
|
|
202
200
|
}
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = exports.
|
|
3
|
+
exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
4
4
|
// tslint:disable:max-classes-per-file completed-docs
|
|
5
5
|
/**
|
|
6
6
|
* リポジトリ
|
|
@@ -20,7 +20,6 @@ const creativeWork_1 = require("./repo/creativeWork");
|
|
|
20
20
|
const customer_1 = require("./repo/customer");
|
|
21
21
|
const emailMessage_1 = require("./repo/emailMessage");
|
|
22
22
|
const event_1 = require("./repo/event");
|
|
23
|
-
const screeningEvent_1 = require("./repo/itemAvailability/screeningEvent");
|
|
24
23
|
const member_1 = require("./repo/member");
|
|
25
24
|
const merchantReturnPolicy_1 = require("./repo/merchantReturnPolicy");
|
|
26
25
|
const offer_1 = require("./repo/offer");
|
|
@@ -38,6 +37,7 @@ const role_1 = require("./repo/role");
|
|
|
38
37
|
const seller_1 = require("./repo/seller");
|
|
39
38
|
const serviceOutput_1 = require("./repo/serviceOutput");
|
|
40
39
|
const serviceOutputIdentifier_1 = require("./repo/serviceOutputIdentifier");
|
|
40
|
+
const stockHolder_1 = require("./repo/stockHolder");
|
|
41
41
|
const task_1 = require("./repo/task");
|
|
42
42
|
const telemetry_1 = require("./repo/telemetry");
|
|
43
43
|
const transaction_1 = require("./repo/transaction");
|
|
@@ -225,6 +225,9 @@ exports.ServiceOutput = ServiceOutput;
|
|
|
225
225
|
class ServiceOutputIdentifier extends serviceOutputIdentifier_1.RedisRepository {
|
|
226
226
|
}
|
|
227
227
|
exports.ServiceOutputIdentifier = ServiceOutputIdentifier;
|
|
228
|
+
class StockHolder extends stockHolder_1.StockHolderRepository {
|
|
229
|
+
}
|
|
230
|
+
exports.StockHolder = StockHolder;
|
|
228
231
|
class Task extends task_1.MongoRepository {
|
|
229
232
|
}
|
|
230
233
|
exports.Task = Task;
|
|
@@ -240,12 +243,6 @@ exports.TransactionNumber = TransactionNumber;
|
|
|
240
243
|
class Trip extends trip_1.MongoRepository {
|
|
241
244
|
}
|
|
242
245
|
exports.Trip = Trip;
|
|
243
|
-
var itemAvailability;
|
|
244
|
-
(function (itemAvailability) {
|
|
245
|
-
class ScreeningEvent extends screeningEvent_1.RedisRepository {
|
|
246
|
-
}
|
|
247
|
-
itemAvailability.ScreeningEvent = ScreeningEvent;
|
|
248
|
-
})(itemAvailability = exports.itemAvailability || (exports.itemAvailability = {}));
|
|
249
246
|
var rateLimit;
|
|
250
247
|
(function (rateLimit) {
|
|
251
248
|
// tslint:disable-next-line:no-shadowed-variable
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
|
-
import { RedisRepository as EventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
|
|
3
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
4
3
|
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
5
4
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
@@ -7,11 +6,12 @@ import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
|
7
6
|
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
8
7
|
import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
9
8
|
import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
9
|
+
import { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
10
10
|
import { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
11
11
|
import * as factory from '../../../factory';
|
|
12
12
|
export type IAggregateScreeningEventOperation<T> = (repos: {
|
|
13
13
|
event: EventRepo;
|
|
14
|
-
|
|
14
|
+
stockHolder: StockHolderRepo;
|
|
15
15
|
offer: OfferRepo;
|
|
16
16
|
offerCatalog: OfferCatalogRepo;
|
|
17
17
|
offerRateLimit: OfferRateLimitRepo;
|