@chevre/domain 20.14.0 → 21.0.0-alpha.1
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/ownershipInfosCsv2peopleJson.ts +1 -2
- package/example/src/chevre/saveTasks.ts +38 -0
- package/lib/chevre/repo/account.d.ts +1 -1
- package/lib/chevre/repo/account.js +5 -6
- package/lib/chevre/repo/accountTitle.d.ts +25 -1
- package/lib/chevre/repo/accountTransaction.js +3 -2
- package/lib/chevre/repo/action.js +9 -6
- package/lib/chevre/repo/assetTransaction.d.ts +25 -1
- package/lib/chevre/repo/assetTransaction.js +3 -2
- package/lib/chevre/repo/categoryCode.d.ts +25 -1
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.d.ts +25 -1
- package/lib/chevre/repo/comment.js +3 -2
- package/lib/chevre/repo/creativeWork.d.ts +29 -3
- package/lib/chevre/repo/creativeWork.js +3 -2
- package/lib/chevre/repo/customer.d.ts +25 -1
- package/lib/chevre/repo/customer.js +3 -2
- package/lib/chevre/repo/emailMessage.d.ts +28 -2
- package/lib/chevre/repo/event.d.ts +27 -3
- package/lib/chevre/repo/event.js +3 -2
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +29 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +3 -2
- package/lib/chevre/repo/mongoose/model/account.d.ts +24 -1
- package/lib/chevre/repo/mongoose/model/accountTitle.d.ts +34 -1
- package/lib/chevre/repo/mongoose/model/accountTransaction.d.ts +37 -1
- package/lib/chevre/repo/mongoose/model/accountingReport.d.ts +28 -1
- package/lib/chevre/repo/mongoose/model/action.d.ts +43 -1
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +30 -1
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +24 -1
- package/lib/chevre/repo/mongoose/model/assetTransaction.d.ts +42 -1
- package/lib/chevre/repo/mongoose/model/authorization.d.ts +31 -1
- package/lib/chevre/repo/mongoose/model/categoryCode.d.ts +34 -1
- package/lib/chevre/repo/mongoose/model/comments.d.ts +35 -1
- package/lib/chevre/repo/mongoose/model/creativeWork.d.ts +43 -1
- package/lib/chevre/repo/mongoose/model/customer.d.ts +34 -1
- package/lib/chevre/repo/mongoose/model/emailMessages.d.ts +32 -1
- package/lib/chevre/repo/mongoose/model/event.d.ts +57 -1
- package/lib/chevre/repo/mongoose/model/member.d.ts +28 -1
- package/lib/chevre/repo/mongoose/model/merchantReturnPolicy.d.ts +32 -1
- package/lib/chevre/repo/mongoose/model/offer.d.ts +53 -1
- package/lib/chevre/repo/mongoose/model/offerCatalog.d.ts +34 -1
- package/lib/chevre/repo/mongoose/model/order.d.ts +47 -1
- package/lib/chevre/repo/mongoose/model/ownershipInfo.d.ts +34 -1
- package/lib/chevre/repo/mongoose/model/place.d.ts +46 -1
- package/lib/chevre/repo/mongoose/model/priceSpecification.d.ts +36 -1
- package/lib/chevre/repo/mongoose/model/product.d.ts +37 -1
- package/lib/chevre/repo/mongoose/model/project.d.ts +33 -1
- package/lib/chevre/repo/mongoose/model/reservation.d.ts +52 -1
- package/lib/chevre/repo/mongoose/model/role.d.ts +27 -1
- package/lib/chevre/repo/mongoose/model/seller.d.ts +37 -1
- package/lib/chevre/repo/mongoose/model/serviceOutput.d.ts +27 -1
- package/lib/chevre/repo/mongoose/model/task.d.ts +35 -1
- package/lib/chevre/repo/mongoose/model/telemetry.d.ts +32 -1
- package/lib/chevre/repo/mongoose/model/transaction.d.ts +40 -1
- package/lib/chevre/repo/mongoose/model/trip.d.ts +27 -1
- package/lib/chevre/repo/offer.d.ts +26 -2
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.d.ts +25 -1
- package/lib/chevre/repo/offerCatalog.js +2 -22
- package/lib/chevre/repo/order.js +4 -3
- package/lib/chevre/repo/ownershipInfo.d.ts +25 -5
- package/lib/chevre/repo/ownershipInfo.js +7 -10
- package/lib/chevre/repo/place.d.ts +25 -1
- package/lib/chevre/repo/place.js +8 -6
- package/lib/chevre/repo/priceSpecification.d.ts +27 -8
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +25 -1
- package/lib/chevre/repo/product.js +3 -2
- package/lib/chevre/repo/project.d.ts +25 -1
- package/lib/chevre/repo/project.js +4 -3
- package/lib/chevre/repo/reservation.d.ts +1 -1
- package/lib/chevre/repo/reservation.js +5 -4
- package/lib/chevre/repo/seller.d.ts +25 -1
- package/lib/chevre/repo/seller.js +3 -2
- package/lib/chevre/repo/serviceOutput.d.ts +1 -1
- package/lib/chevre/repo/serviceOutput.js +3 -3
- package/lib/chevre/repo/task.d.ts +4 -7
- package/lib/chevre/repo/task.js +10 -5
- package/lib/chevre/repo/transaction.js +3 -2
- package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/refund.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/registerService.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/reserve.d.ts +3 -1
- package/lib/chevre/service/assetTransaction.d.ts +3 -1
- package/lib/chevre/service/assetTransaction.js +8 -8
- package/lib/chevre/service/payment/any/onPaid.d.ts +3 -1
- package/lib/chevre/service/payment/any/onRefund.d.ts +3 -1
- package/lib/chevre/service/reserve/cancelReservation.js +10 -6
- package/package.json +4 -4
- package/example/src/chevre/retryTasks.ts +0 -69
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
1
25
|
import { Connection } from 'mongoose';
|
|
2
26
|
import * as factory from '../factory';
|
|
3
27
|
/**
|
|
@@ -37,5 +61,5 @@ export declare class MongoRepository {
|
|
|
37
61
|
deleteById(params: {
|
|
38
62
|
id: string;
|
|
39
63
|
}): Promise<void>;
|
|
40
|
-
getCursor(conditions: any, projection: any): import("mongoose").
|
|
64
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
41
65
|
}
|
|
@@ -17,7 +17,7 @@ const factory = require("../factory");
|
|
|
17
17
|
*/
|
|
18
18
|
class MongoRepository {
|
|
19
19
|
constructor(connection) {
|
|
20
|
-
this.projectModel = connection.model(project_1.modelName);
|
|
20
|
+
this.projectModel = connection.model(project_1.modelName, project_1.schema);
|
|
21
21
|
}
|
|
22
22
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
23
23
|
// MongoDB検索条件
|
|
@@ -75,6 +75,7 @@ class MongoRepository {
|
|
|
75
75
|
* プロジェクト検索
|
|
76
76
|
*/
|
|
77
77
|
search(conditions, projection) {
|
|
78
|
+
var _a;
|
|
78
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
80
|
const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
|
|
80
81
|
const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
|
|
@@ -85,8 +86,8 @@ class MongoRepository {
|
|
|
85
86
|
}
|
|
86
87
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
87
88
|
/* istanbul ignore else */
|
|
88
|
-
if (conditions.sort !== undefined) {
|
|
89
|
-
query.sort(conditions.sort);
|
|
89
|
+
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a._id) !== undefined) {
|
|
90
|
+
query.sort({ _id: conditions.sort._id });
|
|
90
91
|
}
|
|
91
92
|
return query.setOptions({ maxTimeMS: 10000 })
|
|
92
93
|
.exec()
|
|
@@ -857,6 +857,7 @@ class MongoRepository {
|
|
|
857
857
|
* 予約検索
|
|
858
858
|
*/
|
|
859
859
|
search(params, projection) {
|
|
860
|
+
var _a;
|
|
860
861
|
return __awaiter(this, void 0, void 0, function* () {
|
|
861
862
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
862
863
|
const query = this.reservationModel.find((conditions.length > 0) ? { $and: conditions } : {}, (projection !== undefined && projection !== null)
|
|
@@ -873,8 +874,8 @@ class MongoRepository {
|
|
|
873
874
|
}
|
|
874
875
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
875
876
|
/* istanbul ignore else */
|
|
876
|
-
if (params.sort !== undefined) {
|
|
877
|
-
query.sort(params.sort);
|
|
877
|
+
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.modifiedTime) !== undefined) {
|
|
878
|
+
query.sort({ modifiedTime: params.sort.modifiedTime });
|
|
878
879
|
}
|
|
879
880
|
return query.setOptions({ maxTimeMS: 10000 })
|
|
880
881
|
.exec()
|
|
@@ -1165,9 +1166,9 @@ class MongoRepository {
|
|
|
1165
1166
|
.exec()
|
|
1166
1167
|
.then((result) => {
|
|
1167
1168
|
return {
|
|
1168
|
-
n: result
|
|
1169
|
+
// n: result?.n,
|
|
1169
1170
|
// opTime: result.opTime,
|
|
1170
|
-
ok: result
|
|
1171
|
+
// ok: result?.ok,
|
|
1171
1172
|
// operationTime,
|
|
1172
1173
|
deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
|
|
1173
1174
|
};
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
1
25
|
import { Connection } from 'mongoose';
|
|
2
26
|
import * as factory from '../factory';
|
|
3
27
|
export declare type ISeller = factory.seller.ISeller;
|
|
@@ -40,5 +64,5 @@ export declare class MongoRepository {
|
|
|
40
64
|
id: string;
|
|
41
65
|
};
|
|
42
66
|
}): Promise<void>;
|
|
43
|
-
getCursor(conditions: any, projection: any): import("mongoose").
|
|
67
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
44
68
|
}
|
|
@@ -168,6 +168,7 @@ class MongoRepository {
|
|
|
168
168
|
* 販売者検索
|
|
169
169
|
*/
|
|
170
170
|
search(conditions, projection) {
|
|
171
|
+
var _a;
|
|
171
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
173
|
const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
|
|
173
174
|
const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
|
|
@@ -178,8 +179,8 @@ class MongoRepository {
|
|
|
178
179
|
}
|
|
179
180
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
180
181
|
/* istanbul ignore else */
|
|
181
|
-
if (conditions.sort !== undefined) {
|
|
182
|
-
query.sort(conditions.sort);
|
|
182
|
+
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
183
|
+
query.sort({ branchCode: conditions.sort.branchCode });
|
|
183
184
|
}
|
|
184
185
|
return query.setOptions({ maxTimeMS: 10000 })
|
|
185
186
|
.exec()
|
|
@@ -125,9 +125,9 @@ class MongoRepository {
|
|
|
125
125
|
}
|
|
126
126
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
127
127
|
/* istanbul ignore else */
|
|
128
|
-
if (params.sort !== undefined) {
|
|
129
|
-
|
|
130
|
-
}
|
|
128
|
+
// if (params.sort !== undefined) {
|
|
129
|
+
// query.sort(params.sort);
|
|
130
|
+
// }
|
|
131
131
|
return query.setOptions({ maxTimeMS: 10000 })
|
|
132
132
|
.exec()
|
|
133
133
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
@@ -24,7 +24,9 @@ export declare class MongoRepository {
|
|
|
24
24
|
readonly taskModel: typeof Model;
|
|
25
25
|
constructor(connection: Connection);
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): any[];
|
|
27
|
-
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[]): Promise<
|
|
27
|
+
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[]): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
}[]>;
|
|
28
30
|
createInformTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.TriggerWebhook>): Promise<void>;
|
|
29
31
|
executeOneByName<T extends factory.taskName>(params: {
|
|
30
32
|
name: T;
|
|
@@ -58,12 +60,7 @@ export declare class MongoRepository {
|
|
|
58
60
|
}): Promise<void>;
|
|
59
61
|
deleteByName(params: {
|
|
60
62
|
name: factory.taskName;
|
|
61
|
-
}): Promise<
|
|
62
|
-
ok?: number | undefined;
|
|
63
|
-
n?: number | undefined;
|
|
64
|
-
} & {
|
|
65
|
-
deletedCount?: number | undefined;
|
|
66
|
-
}>;
|
|
63
|
+
}): Promise<import("mongodb").DeleteResult>;
|
|
67
64
|
aggregateTask(params: {
|
|
68
65
|
project?: {
|
|
69
66
|
id?: {
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -17,8 +17,8 @@ const task_1 = require("./mongoose/model/task");
|
|
|
17
17
|
* タスク実行時のソート条件
|
|
18
18
|
*/
|
|
19
19
|
const sortOrder4executionOfTasks = {
|
|
20
|
-
numberOfTried:
|
|
21
|
-
runsAt:
|
|
20
|
+
numberOfTried: factory.sortType.Ascending,
|
|
21
|
+
runsAt: factory.sortType.Ascending // 実行予定日時の早さ優先
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* タスクリポジトリ
|
|
@@ -156,7 +156,11 @@ class MongoRepository {
|
|
|
156
156
|
if (result.insertedCount !== taskAttributes.length) {
|
|
157
157
|
throw new factory.errors.ServiceUnavailable('all tasks not saved');
|
|
158
158
|
}
|
|
159
|
-
return result.ops;
|
|
159
|
+
// return result.ops;
|
|
160
|
+
return Object.values(result.insertedIds)
|
|
161
|
+
.map((objectId) => {
|
|
162
|
+
return { id: objectId.toHexString() };
|
|
163
|
+
});
|
|
160
164
|
}
|
|
161
165
|
else {
|
|
162
166
|
return [];
|
|
@@ -301,6 +305,7 @@ class MongoRepository {
|
|
|
301
305
|
* 検索する
|
|
302
306
|
*/
|
|
303
307
|
search(params, projection) {
|
|
308
|
+
var _a;
|
|
304
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
310
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
306
311
|
const query = this.taskModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
|
|
@@ -311,8 +316,8 @@ class MongoRepository {
|
|
|
311
316
|
}
|
|
312
317
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
313
318
|
/* istanbul ignore else */
|
|
314
|
-
if (params.sort !== undefined) {
|
|
315
|
-
query.sort(params.sort);
|
|
319
|
+
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.runsAt) !== undefined) {
|
|
320
|
+
query.sort({ runsAt: params.sort.runsAt });
|
|
316
321
|
}
|
|
317
322
|
return query.setOptions({ maxTimeMS: 10000 })
|
|
318
323
|
.exec()
|
|
@@ -569,6 +569,7 @@ class MongoRepository {
|
|
|
569
569
|
* 取引を検索する
|
|
570
570
|
*/
|
|
571
571
|
search(params) {
|
|
572
|
+
var _a;
|
|
572
573
|
return __awaiter(this, void 0, void 0, function* () {
|
|
573
574
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
574
575
|
let projection = {};
|
|
@@ -598,8 +599,8 @@ class MongoRepository {
|
|
|
598
599
|
}
|
|
599
600
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
600
601
|
/* istanbul ignore else */
|
|
601
|
-
if (params.sort !== undefined) {
|
|
602
|
-
query.sort(params.sort);
|
|
602
|
+
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
|
|
603
|
+
query.sort({ startDate: params.sort.startDate });
|
|
603
604
|
}
|
|
604
605
|
// const explainResult = await (<any>query).explain();
|
|
605
606
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
@@ -32,4 +32,6 @@ export declare function startAndConfirm(params: factory.assetTransaction.cancelR
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function exportTasksById(params: {
|
|
34
34
|
id: string;
|
|
35
|
-
}): ITaskAndTransactionOperation<
|
|
35
|
+
}): ITaskAndTransactionOperation<{
|
|
36
|
+
id: string;
|
|
37
|
+
}[]>;
|
|
@@ -117,7 +117,9 @@ export declare function exportTasksById(params: {
|
|
|
117
117
|
* タスク実行日時バッファ
|
|
118
118
|
*/
|
|
119
119
|
runsTasksAfterInSeconds?: number;
|
|
120
|
-
}): IExportTasksOperation<
|
|
120
|
+
}): IExportTasksOperation<{
|
|
121
|
+
id: string;
|
|
122
|
+
}[]>;
|
|
121
123
|
/**
|
|
122
124
|
* 決済代行取引参照
|
|
123
125
|
*/
|
|
@@ -111,5 +111,7 @@ export declare function cancel(params: {
|
|
|
111
111
|
*/
|
|
112
112
|
export declare function exportTasksById(params: {
|
|
113
113
|
id: string;
|
|
114
|
-
}): ITaskAndTransactionOperation<
|
|
114
|
+
}): ITaskAndTransactionOperation<{
|
|
115
|
+
id: string;
|
|
116
|
+
}[]>;
|
|
115
117
|
export {};
|
|
@@ -33,4 +33,6 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
|
|
|
33
33
|
project: ProjectRepo;
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
assetTransaction: AssetTransactionRepo;
|
|
36
|
-
}) => Promise<
|
|
36
|
+
}) => Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
}[] | undefined>;
|
|
@@ -39,41 +39,41 @@ function exportTasks(params) {
|
|
|
39
39
|
if (transaction === null) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
let
|
|
42
|
+
let createdTasks = [];
|
|
43
43
|
// 失敗してもここでは戻さない(RUNNINGのまま待機)
|
|
44
44
|
switch (transaction.typeOf) {
|
|
45
45
|
case factory.assetTransactionType.CancelReservation:
|
|
46
|
-
|
|
46
|
+
createdTasks = yield CancelReservationTransactionService.exportTasksById({
|
|
47
47
|
id: transaction.id
|
|
48
48
|
// runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
49
49
|
})(repos);
|
|
50
50
|
break;
|
|
51
51
|
case factory.assetTransactionType.MoneyTransfer:
|
|
52
|
-
|
|
52
|
+
createdTasks = yield MoneyTransferTransactionService.exportTasksById({
|
|
53
53
|
id: transaction.id,
|
|
54
54
|
runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
55
55
|
})(repos);
|
|
56
56
|
break;
|
|
57
57
|
case factory.assetTransactionType.Pay:
|
|
58
|
-
|
|
58
|
+
createdTasks = yield PayTransactionService.exportTasksById({
|
|
59
59
|
id: transaction.id,
|
|
60
60
|
runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
61
61
|
})(repos);
|
|
62
62
|
break;
|
|
63
63
|
case factory.assetTransactionType.Refund:
|
|
64
|
-
|
|
64
|
+
createdTasks = yield RefundTransactionService.exportTasksById({
|
|
65
65
|
id: transaction.id,
|
|
66
66
|
runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
67
67
|
})(repos);
|
|
68
68
|
break;
|
|
69
69
|
case factory.assetTransactionType.RegisterService:
|
|
70
|
-
|
|
70
|
+
createdTasks = yield RegisterServiceTransactionService.exportTasksById({
|
|
71
71
|
id: transaction.id
|
|
72
72
|
// runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
73
73
|
})(repos);
|
|
74
74
|
break;
|
|
75
75
|
case factory.assetTransactionType.Reserve:
|
|
76
|
-
|
|
76
|
+
createdTasks = yield ReserveTransactionService.exportTasksById({
|
|
77
77
|
id: transaction.id
|
|
78
78
|
// runsTasksAfterInSeconds: params.runsTasksAfterInSeconds
|
|
79
79
|
})(repos);
|
|
@@ -81,7 +81,7 @@ function exportTasks(params) {
|
|
|
81
81
|
default:
|
|
82
82
|
}
|
|
83
83
|
yield repos.assetTransaction.setTasksExportedById({ id: transaction.id });
|
|
84
|
-
return
|
|
84
|
+
return createdTasks;
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
exports.exportTasks = exportTasks;
|
|
@@ -129,9 +129,11 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
129
129
|
// アクション完了
|
|
130
130
|
const actionResult = Object.assign({}, (cancelResult !== undefined) ? {
|
|
131
131
|
cancelResult: {
|
|
132
|
-
n: cancelResult.n,
|
|
133
|
-
nModified: cancelResult.nModified,
|
|
134
|
-
ok: cancelResult.ok
|
|
132
|
+
// n: cancelResult.n,
|
|
133
|
+
// nModified: cancelResult.nModified,
|
|
134
|
+
// ok: cancelResult.ok,
|
|
135
|
+
matchedCount: cancelResult.matchedCount,
|
|
136
|
+
modifiedCount: cancelResult.modifiedCount
|
|
135
137
|
}
|
|
136
138
|
} : undefined
|
|
137
139
|
// canceledReservationId: canceledReservation?.id
|
|
@@ -272,9 +274,11 @@ function cancelReservation(actionAttributesList) {
|
|
|
272
274
|
}
|
|
273
275
|
const actionResult = Object.assign({}, (cancelResult !== undefined) ? {
|
|
274
276
|
cancelResult: {
|
|
275
|
-
n: cancelResult.n,
|
|
276
|
-
nModified: cancelResult.nModified,
|
|
277
|
-
ok: cancelResult.ok
|
|
277
|
+
// n: cancelResult.n,
|
|
278
|
+
// nModified: cancelResult.nModified,
|
|
279
|
+
// ok: cancelResult.ok
|
|
280
|
+
matchedCount: cancelResult.matchedCount,
|
|
281
|
+
modifiedCount: cancelResult.modifiedCount
|
|
278
282
|
}
|
|
279
283
|
} : undefined
|
|
280
284
|
// canceledReservationId: canceledReservation?.id
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.309.
|
|
12
|
+
"@chevre/factory": "4.309.1",
|
|
13
13
|
"@cinerino/sdk": "3.153.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"csvtojson": "^2.0.10",
|
|
62
62
|
"googleapis": "^85.0.0",
|
|
63
63
|
"mocha": "^5.2.0",
|
|
64
|
-
"mongoose": "
|
|
64
|
+
"mongoose": "6.10.4",
|
|
65
65
|
"nock": "^9.6.1",
|
|
66
66
|
"nyc": "^15.1.0",
|
|
67
67
|
"power-assert": "^1.6.1",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"typescript": "^4.8.4"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"mongoose": "^
|
|
80
|
+
"mongoose": "^6.0.0",
|
|
81
81
|
"redis": "^3.1.2"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "
|
|
123
|
+
"version": "21.0.0-alpha.1"
|
|
124
124
|
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = taskRepo.taskModel.find(
|
|
15
|
-
{
|
|
16
|
-
// _id: { $eq: 'xxxx' },
|
|
17
|
-
'project.id': { $eq: project.id },
|
|
18
|
-
status: { $in: [chevre.factory.taskStatus.Aborted] },
|
|
19
|
-
name: { $eq: chevre.factory.taskName.VoidRegisterServiceTransaction },
|
|
20
|
-
runsAt: {
|
|
21
|
-
$gt: moment()
|
|
22
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
-
.add(-2, 'days')
|
|
24
|
-
.toDate()
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
// _id: 1,
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
// .limit(10)
|
|
32
|
-
.sort({ runsAt: chevre.factory.sortType.Ascending })
|
|
33
|
-
.cursor();
|
|
34
|
-
console.log('tasks found');
|
|
35
|
-
|
|
36
|
-
let i = 0;
|
|
37
|
-
let updateCount = 0;
|
|
38
|
-
await cursor.eachAsync(async (doc) => {
|
|
39
|
-
i += 1;
|
|
40
|
-
const task = <chevre.factory.task.ITask<any>>doc.toObject();
|
|
41
|
-
|
|
42
|
-
console.log('retrying...', task.id, task.name, task.runsAt, task.project.id);
|
|
43
|
-
await taskRepo.taskModel.findByIdAndUpdate(
|
|
44
|
-
task.id,
|
|
45
|
-
{
|
|
46
|
-
status: chevre.factory.taskStatus.Ready,
|
|
47
|
-
remainingNumberOfTries: task.remainingNumberOfTries + 1
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
.exec();
|
|
51
|
-
updateCount += 1;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
console.log(i, 'tasks checked');
|
|
55
|
-
console.log(updateCount, 'tasks updated');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
main()
|
|
59
|
-
.then()
|
|
60
|
-
.catch(console.error);
|
|
61
|
-
// setInterval(
|
|
62
|
-
// () => {
|
|
63
|
-
// main()
|
|
64
|
-
// .then()
|
|
65
|
-
// .catch(console.error);
|
|
66
|
-
// },
|
|
67
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
68
|
-
// 60000
|
|
69
|
-
// );
|