@chevre/domain 21.30.0-alpha.5 → 21.30.0-alpha.7
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/optimizeActions.ts +21 -8
- package/example/src/chevre/searchActions.ts +2 -1
- package/lib/chevre/repo/action.js +6 -35
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.js +68 -57
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/task.js +4 -2
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task.js +9 -0
- package/package.json +2 -2
|
@@ -16,11 +16,9 @@ async function main() {
|
|
|
16
16
|
for (let index = 0; index < 24 * 548; index++) {
|
|
17
17
|
const updateResult = await actionRepo.unsetUnnecessaryFields({
|
|
18
18
|
filter: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// typeOf: { $eq: chevre.factory.
|
|
22
|
-
typeOf: { $eq: chevre.factory.actionType.PayAction },
|
|
23
|
-
'purpose.typeOf': { $exists: true, $eq: chevre.factory.order.OrderType.Order },
|
|
19
|
+
typeOf: { $eq: chevre.factory.actionType.OrderAction },
|
|
20
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.order.OrderType.Order },
|
|
21
|
+
// 'purpose.typeOf': { $exists: true, $eq: chevre.factory.order.OrderType.Order },
|
|
24
22
|
startDate: {
|
|
25
23
|
$gte: moment()
|
|
26
24
|
.add(-(index + 1), 'hours')
|
|
@@ -32,9 +30,24 @@ async function main() {
|
|
|
32
30
|
// _id: { $eq: '61da235d94a80f000af85f6b' }
|
|
33
31
|
},
|
|
34
32
|
$unset: {
|
|
35
|
-
'purpose.project': 1,
|
|
36
|
-
'purpose.seller': 1,
|
|
37
|
-
'purpose.customer': 1
|
|
33
|
+
// 'purpose.project': 1,
|
|
34
|
+
// 'purpose.seller': 1,
|
|
35
|
+
// 'purpose.customer': 1
|
|
36
|
+
'object.project': 1,
|
|
37
|
+
'object.seller': 1,
|
|
38
|
+
'object.customer': 1,
|
|
39
|
+
'object.paymentMethods': 1,
|
|
40
|
+
'object.discounts': 1,
|
|
41
|
+
'object.acceptedOffers': 1,
|
|
42
|
+
'object.url': 1,
|
|
43
|
+
'object.orderStatus': 1,
|
|
44
|
+
'object.identifier': 1,
|
|
45
|
+
'object.isGift': 1,
|
|
46
|
+
'object.broker': 1,
|
|
47
|
+
'object.dateReturned': 1,
|
|
48
|
+
'object.name': 1,
|
|
49
|
+
'object.orderedItem': 1,
|
|
50
|
+
'object.returner': 1
|
|
38
51
|
}
|
|
39
52
|
});
|
|
40
53
|
console.log(
|
|
@@ -24,7 +24,8 @@ async function main() {
|
|
|
24
24
|
// serviceOutput: { reservationFor: { id: { $eq: 'clhvvbpyn' } } }
|
|
25
25
|
// }
|
|
26
26
|
// }
|
|
27
|
-
instrument: { transactionNumber: { $eq: 'x' } }
|
|
27
|
+
// instrument: { transactionNumber: { $eq: 'x' } },
|
|
28
|
+
sameAs: { id: { $eq: '66275034ae5d4c3e8997808c' } }
|
|
28
29
|
},
|
|
29
30
|
['_id'],
|
|
30
31
|
[]
|
|
@@ -22,7 +22,7 @@ class MongoRepository {
|
|
|
22
22
|
}
|
|
23
23
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
24
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _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, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _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, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75;
|
|
26
26
|
const andConditions = [];
|
|
27
27
|
const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
|
|
28
28
|
if (Array.isArray(idIn)) {
|
|
@@ -33,8 +33,6 @@ class MongoRepository {
|
|
|
33
33
|
andConditions.push({ _id: { $nin: idNin } });
|
|
34
34
|
}
|
|
35
35
|
const projectIdEq = (_d = (_c = params.project) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
36
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
37
|
-
/* istanbul ignore else */
|
|
38
36
|
if (typeof projectIdEq === 'string') {
|
|
39
37
|
andConditions.push({
|
|
40
38
|
'project.id': {
|
|
@@ -42,8 +40,6 @@ class MongoRepository {
|
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
}
|
|
45
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
46
|
-
/* istanbul ignore else */
|
|
47
43
|
const agentTypeOfIn = (_f = (_e = params.agent) === null || _e === void 0 ? void 0 : _e.typeOf) === null || _f === void 0 ? void 0 : _f.$in;
|
|
48
44
|
if (Array.isArray(agentTypeOfIn)) {
|
|
49
45
|
andConditions.push({
|
|
@@ -71,8 +67,6 @@ class MongoRepository {
|
|
|
71
67
|
andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
|
|
72
68
|
}
|
|
73
69
|
const locationIdEq = (_p = (_o = params.location) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
74
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
75
|
-
/* istanbul ignore else */
|
|
76
70
|
if (typeof locationIdEq === 'string') {
|
|
77
71
|
andConditions.push({
|
|
78
72
|
'location.id': {
|
|
@@ -82,8 +76,6 @@ class MongoRepository {
|
|
|
82
76
|
});
|
|
83
77
|
}
|
|
84
78
|
const locationIdentifierEq = (_r = (_q = params.location) === null || _q === void 0 ? void 0 : _q.identifier) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
85
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
86
|
-
/* istanbul ignore else */
|
|
87
79
|
if (typeof locationIdentifierEq === 'string') {
|
|
88
80
|
andConditions.push({
|
|
89
81
|
'location.identifier': {
|
|
@@ -110,8 +102,6 @@ class MongoRepository {
|
|
|
110
102
|
}
|
|
111
103
|
});
|
|
112
104
|
}
|
|
113
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
114
|
-
/* istanbul ignore else */
|
|
115
105
|
const objectPaymentMethodIdEq = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethodId) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
116
106
|
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
117
107
|
andConditions.push({
|
|
@@ -131,8 +121,6 @@ class MongoRepository {
|
|
|
131
121
|
});
|
|
132
122
|
}
|
|
133
123
|
const objectReservationForIdEq = (_7 = (_6 = (_5 = params.object) === null || _5 === void 0 ? void 0 : _5.reservationFor) === null || _6 === void 0 ? void 0 : _6.id) === null || _7 === void 0 ? void 0 : _7.$eq;
|
|
134
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
135
|
-
/* istanbul ignore else */
|
|
136
124
|
if (typeof objectReservationForIdEq === 'string') {
|
|
137
125
|
andConditions.push({
|
|
138
126
|
'object.reservationFor.id': {
|
|
@@ -160,8 +148,6 @@ class MongoRepository {
|
|
|
160
148
|
});
|
|
161
149
|
}
|
|
162
150
|
const objectPaymentMethodAccountIdEq = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.paymentMethod) === null || _13 === void 0 ? void 0 : _13.accountId) === null || _14 === void 0 ? void 0 : _14.$eq;
|
|
163
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
164
|
-
/* istanbul ignore else */
|
|
165
151
|
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
166
152
|
andConditions.push({
|
|
167
153
|
'object.paymentMethod.accountId': {
|
|
@@ -171,8 +157,6 @@ class MongoRepository {
|
|
|
171
157
|
});
|
|
172
158
|
}
|
|
173
159
|
const objectPaymentMethodPaymentMethodIdEq = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.paymentMethodId) === null || _17 === void 0 ? void 0 : _17.$eq;
|
|
174
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
175
|
-
/* istanbul ignore else */
|
|
176
160
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
177
161
|
andConditions.push({
|
|
178
162
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -191,8 +175,6 @@ class MongoRepository {
|
|
|
191
175
|
});
|
|
192
176
|
}
|
|
193
177
|
const objectPaymentMethodTypeOfEq = (_23 = (_22 = (_21 = params.object) === null || _21 === void 0 ? void 0 : _21.paymentMethod) === null || _22 === void 0 ? void 0 : _22.typeOf) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
194
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
195
|
-
/* istanbul ignore else */
|
|
196
178
|
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
197
179
|
andConditions.push({
|
|
198
180
|
'object.paymentMethod.typeOf': {
|
|
@@ -202,8 +184,6 @@ class MongoRepository {
|
|
|
202
184
|
});
|
|
203
185
|
}
|
|
204
186
|
const objectTypeOfEq = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.typeOf) === null || _25 === void 0 ? void 0 : _25.$eq;
|
|
205
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
206
|
-
/* istanbul ignore else */
|
|
207
187
|
if (typeof objectTypeOfEq === 'string') {
|
|
208
188
|
andConditions.push({
|
|
209
189
|
'object.typeOf': {
|
|
@@ -222,8 +202,6 @@ class MongoRepository {
|
|
|
222
202
|
});
|
|
223
203
|
}
|
|
224
204
|
const objectIdEq = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.id) === null || _29 === void 0 ? void 0 : _29.$eq;
|
|
225
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
226
|
-
/* istanbul ignore else */
|
|
227
205
|
if (typeof objectIdEq === 'string') {
|
|
228
206
|
andConditions.push({
|
|
229
207
|
'object.id': {
|
|
@@ -272,8 +250,6 @@ class MongoRepository {
|
|
|
272
250
|
if (typeof objectTransactionNumberEq === 'string') {
|
|
273
251
|
andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
|
|
274
252
|
}
|
|
275
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
276
|
-
/* istanbul ignore else */
|
|
277
253
|
if (typeof params.typeOf === 'string') {
|
|
278
254
|
andConditions.push({
|
|
279
255
|
typeOf: params.typeOf
|
|
@@ -281,8 +257,6 @@ class MongoRepository {
|
|
|
281
257
|
}
|
|
282
258
|
else {
|
|
283
259
|
const typeOfEq = (_46 = params.typeOf) === null || _46 === void 0 ? void 0 : _46.$eq;
|
|
284
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
285
|
-
/* istanbul ignore else */
|
|
286
260
|
if (typeof typeOfEq === 'string') {
|
|
287
261
|
andConditions.push({
|
|
288
262
|
typeOf: { $eq: typeOfEq }
|
|
@@ -290,30 +264,22 @@ class MongoRepository {
|
|
|
290
264
|
}
|
|
291
265
|
}
|
|
292
266
|
const actionStatusIn = (_47 = params.actionStatus) === null || _47 === void 0 ? void 0 : _47.$in;
|
|
293
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
294
|
-
/* istanbul ignore else */
|
|
295
267
|
if (Array.isArray(actionStatusIn)) {
|
|
296
268
|
andConditions.push({
|
|
297
269
|
actionStatus: { $in: actionStatusIn }
|
|
298
270
|
});
|
|
299
271
|
}
|
|
300
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
301
|
-
/* istanbul ignore else */
|
|
302
272
|
if (Array.isArray(params.actionStatusTypes)) {
|
|
303
273
|
andConditions.push({
|
|
304
274
|
actionStatus: { $in: params.actionStatusTypes }
|
|
305
275
|
});
|
|
306
276
|
}
|
|
307
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
308
|
-
/* istanbul ignore else */
|
|
309
277
|
const startDateGte = params.startFrom;
|
|
310
278
|
if (startDateGte instanceof Date) {
|
|
311
279
|
andConditions.push({
|
|
312
280
|
startDate: { $gte: startDateGte }
|
|
313
281
|
});
|
|
314
282
|
}
|
|
315
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
316
|
-
/* istanbul ignore else */
|
|
317
283
|
const startDateLte = params.startThrough;
|
|
318
284
|
if (startDateLte instanceof Date) {
|
|
319
285
|
andConditions.push({
|
|
@@ -437,6 +403,11 @@ class MongoRepository {
|
|
|
437
403
|
}
|
|
438
404
|
});
|
|
439
405
|
}
|
|
406
|
+
// sameAs(2024-04-23~)
|
|
407
|
+
const sameAsIdEq = (_75 = (_74 = params.sameAs) === null || _74 === void 0 ? void 0 : _74.id) === null || _75 === void 0 ? void 0 : _75.$eq;
|
|
408
|
+
if (typeof sameAsIdEq === 'string') {
|
|
409
|
+
andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
|
|
410
|
+
}
|
|
440
411
|
return andConditions;
|
|
441
412
|
}
|
|
442
413
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
|
|
2
2
|
declare const modelName = "Task";
|
|
3
|
-
declare function createSchema(): Schema;
|
|
4
3
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
4
|
+
declare function createSchema(): Schema;
|
|
5
5
|
export { modelName, indexes, createSchema };
|
|
@@ -18,7 +18,8 @@ const schemaDefinition = {
|
|
|
18
18
|
executionResults: [mongoose_1.SchemaTypes.Mixed],
|
|
19
19
|
executor: mongoose_1.SchemaTypes.Mixed,
|
|
20
20
|
data: mongoose_1.SchemaTypes.Mixed,
|
|
21
|
-
dateAborted: Date
|
|
21
|
+
dateAborted: Date,
|
|
22
|
+
expires: Date // add(2024-04-23~)
|
|
22
23
|
};
|
|
23
24
|
const schemaOptions = {
|
|
24
25
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -46,17 +47,6 @@ const schemaOptions = {
|
|
|
46
47
|
versionKey: false
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
|
-
/**
|
|
50
|
-
* タスクスキーマ
|
|
51
|
-
*/
|
|
52
|
-
let schema;
|
|
53
|
-
function createSchema() {
|
|
54
|
-
if (schema === undefined) {
|
|
55
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
56
|
-
}
|
|
57
|
-
return schema;
|
|
58
|
-
}
|
|
59
|
-
exports.createSchema = createSchema;
|
|
60
50
|
const indexes = [
|
|
61
51
|
[
|
|
62
52
|
{ createdAt: 1 },
|
|
@@ -123,24 +113,26 @@ const indexes = [
|
|
|
123
113
|
}
|
|
124
114
|
}
|
|
125
115
|
],
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
116
|
+
// 廃止(2024-04-23~)
|
|
117
|
+
// [
|
|
118
|
+
// { 'data.object.itemOffered.id': 1, runsAt: -1 },
|
|
119
|
+
// {
|
|
120
|
+
// name: 'searchByDataObjectItemOfferedId',
|
|
121
|
+
// partialFilterExpression: {
|
|
122
|
+
// 'data.object.itemOffered.id': { $exists: true }
|
|
123
|
+
// }
|
|
124
|
+
// }
|
|
125
|
+
// ],
|
|
126
|
+
// 廃止(2024-04-23~)
|
|
127
|
+
// [
|
|
128
|
+
// { 'data.object.itemOffered.membershipFor.id': 1, runsAt: -1 },
|
|
129
|
+
// {
|
|
130
|
+
// name: 'searchByDataObjectItemOfferedMembershipForId',
|
|
131
|
+
// partialFilterExpression: {
|
|
132
|
+
// 'data.object.itemOffered.membershipFor.id': { $exists: true }
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
// ],
|
|
144
136
|
[
|
|
145
137
|
{ 'data.object.orderNumber': 1, runsAt: -1 },
|
|
146
138
|
{
|
|
@@ -222,33 +214,52 @@ const indexes = [
|
|
|
222
214
|
lastTriedAt: { $type: 'date' }
|
|
223
215
|
}
|
|
224
216
|
}
|
|
225
|
-
],
|
|
226
|
-
[
|
|
227
|
-
{ 'data.transactionId': 1 },
|
|
228
|
-
{
|
|
229
|
-
partialFilterExpression: {
|
|
230
|
-
'data.transactionId': { $exists: true }
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
[
|
|
235
|
-
// メール送信タスク存在確認に使用
|
|
236
|
-
{ 'data.actionAttributes.object.identifier': 1, runsAt: -1 },
|
|
237
|
-
{
|
|
238
|
-
name: 'searchByDataActionAttributesObjectIdentifier',
|
|
239
|
-
partialFilterExpression: {
|
|
240
|
-
'data.actionAttributes.object.identifier': { $exists: true }
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
],
|
|
244
|
-
[
|
|
245
|
-
{ 'data.transactionId': 1, runsAt: -1 },
|
|
246
|
-
{
|
|
247
|
-
name: 'searchByDataTransactionId',
|
|
248
|
-
partialFilterExpression: {
|
|
249
|
-
'data.transactionId': { $exists: true }
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
217
|
]
|
|
218
|
+
// 廃止(2024-04-23~)
|
|
219
|
+
// [
|
|
220
|
+
// { 'data.transactionId': 1 },
|
|
221
|
+
// {
|
|
222
|
+
// partialFilterExpression: {
|
|
223
|
+
// 'data.transactionId': { $exists: true }
|
|
224
|
+
// }
|
|
225
|
+
// }
|
|
226
|
+
// ],
|
|
227
|
+
// 廃止(2024-04-23~)
|
|
228
|
+
// [
|
|
229
|
+
// // メール送信タスク存在確認に使用
|
|
230
|
+
// { 'data.actionAttributes.object.identifier': 1, runsAt: -1 },
|
|
231
|
+
// {
|
|
232
|
+
// name: 'searchByDataActionAttributesObjectIdentifier',
|
|
233
|
+
// partialFilterExpression: {
|
|
234
|
+
// 'data.actionAttributes.object.identifier': { $exists: true }
|
|
235
|
+
// }
|
|
236
|
+
// }
|
|
237
|
+
// ]
|
|
238
|
+
// 廃止(2024-04-23~)
|
|
239
|
+
// [
|
|
240
|
+
// { 'data.transactionId': 1, runsAt: -1 },
|
|
241
|
+
// {
|
|
242
|
+
// name: 'searchByDataTransactionId',
|
|
243
|
+
// partialFilterExpression: {
|
|
244
|
+
// 'data.transactionId': { $exists: true }
|
|
245
|
+
// }
|
|
246
|
+
// }
|
|
247
|
+
// ]
|
|
253
248
|
];
|
|
254
249
|
exports.indexes = indexes;
|
|
250
|
+
/**
|
|
251
|
+
* タスクスキーマ
|
|
252
|
+
*/
|
|
253
|
+
let schema;
|
|
254
|
+
function createSchema() {
|
|
255
|
+
if (schema === undefined) {
|
|
256
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
257
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
258
|
+
indexes.forEach((indexParams) => {
|
|
259
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return schema;
|
|
264
|
+
}
|
|
265
|
+
exports.createSchema = createSchema;
|
|
@@ -44,7 +44,7 @@ export interface IAggregateTask {
|
|
|
44
44
|
interface IOptionOnCreate {
|
|
45
45
|
emitImmediately: boolean;
|
|
46
46
|
}
|
|
47
|
-
export type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt';
|
|
47
|
+
export type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'expires';
|
|
48
48
|
export type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys>;
|
|
49
49
|
/**
|
|
50
50
|
* タスクリポジトリ
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -376,7 +376,8 @@ class MongoRepository {
|
|
|
376
376
|
numberOfTried: 1,
|
|
377
377
|
project: 1,
|
|
378
378
|
remainingNumberOfTries: 1,
|
|
379
|
-
runsAt: 1
|
|
379
|
+
runsAt: 1,
|
|
380
|
+
expire: 1
|
|
380
381
|
}
|
|
381
382
|
})
|
|
382
383
|
.exec();
|
|
@@ -413,7 +414,8 @@ class MongoRepository {
|
|
|
413
414
|
numberOfTried: 1,
|
|
414
415
|
project: 1,
|
|
415
416
|
remainingNumberOfTries: 1,
|
|
416
|
-
runsAt: 1
|
|
417
|
+
runsAt: 1,
|
|
418
|
+
expire: 1
|
|
417
419
|
}
|
|
418
420
|
})
|
|
419
421
|
.sort(sortOrder4executionOfTasks)
|
|
@@ -32,7 +32,7 @@ function call(params) {
|
|
|
32
32
|
}
|
|
33
33
|
let data;
|
|
34
34
|
if (params.name === factory.taskName.Refund) {
|
|
35
|
-
data = Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
35
|
+
data = Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
@@ -14,6 +14,7 @@ exports.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = e
|
|
|
14
14
|
* タスクサービス
|
|
15
15
|
*/
|
|
16
16
|
const createDebug = require("debug");
|
|
17
|
+
const moment = require("moment");
|
|
17
18
|
const factory = require("../factory");
|
|
18
19
|
const factory_1 = require("./notification/factory");
|
|
19
20
|
const credentials_1 = require("../credentials");
|
|
@@ -92,6 +93,14 @@ function execute(task) {
|
|
|
92
93
|
return (settings, options) => __awaiter(this, void 0, void 0, function* () {
|
|
93
94
|
const taskRepo = new (yield Promise.resolve().then(() => require('../repo/task'))).MongoRepository(settings.connection);
|
|
94
95
|
try {
|
|
96
|
+
// 期限検証(2024-04-23~)
|
|
97
|
+
if (task.expires instanceof Date) {
|
|
98
|
+
const taskExpired = moment(now)
|
|
99
|
+
.isAfter(task.expires);
|
|
100
|
+
if (taskExpired) {
|
|
101
|
+
throw new Error(`task expired [expires:${task.expires}]`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
95
104
|
// タスク名の関数が定義されていなければ、TypeErrorとなる
|
|
96
105
|
const { call } = yield Promise.resolve(`${`./task/${task.name}`}`).then(s => require(s));
|
|
97
106
|
switch (task.name) {
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.368.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.368.0-alpha.3",
|
|
14
14
|
"@cinerino/sdk": "5.17.1",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.30.0-alpha.
|
|
113
|
+
"version": "21.30.0-alpha.7"
|
|
114
114
|
}
|