@chevre/domain 27.0.0-alpha.0 → 27.0.0
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/action/anyAction/actionProcess.d.ts +1 -3
- package/lib/chevre/repo/action/anyAction/actionRecipe.js +1 -8
- package/lib/chevre/repo/concurrentLock.js +3 -3
- package/lib/chevre/repo/credentials.js +1 -1
- package/lib/chevre/repo/factory/action/createMongoConditions.js +35 -31
- package/lib/chevre/repo/mongoose/schemas/action.js +61 -55
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +21 -18
- package/lib/chevre/repo/rateLimit/offer.js +1 -4
- package/package.json +4 -4
|
@@ -16,15 +16,9 @@ class ActionRecipeRepo {
|
|
|
16
16
|
return this.actionRecipeModel.findOne({
|
|
17
17
|
'project.id': { $eq: params.project.id },
|
|
18
18
|
'recipeFor.id': { $eq: params.recipeFor.id }
|
|
19
|
-
}, { step: 1, recipeCategory: 1 }
|
|
20
|
-
// { lean: true }
|
|
21
|
-
)
|
|
19
|
+
}, { step: 1, recipeCategory: 1 })
|
|
22
20
|
.lean()
|
|
23
21
|
.exec();
|
|
24
|
-
// if (result === null) {
|
|
25
|
-
// throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
|
|
26
|
-
// }
|
|
27
|
-
// return result;
|
|
28
22
|
}
|
|
29
23
|
async upsertRecipe(savingRecipe) {
|
|
30
24
|
const dateModified = new Date();
|
|
@@ -45,7 +39,6 @@ class ActionRecipeRepo {
|
|
|
45
39
|
};
|
|
46
40
|
await this.actionRecipeModel.updateOne(filter, update, {
|
|
47
41
|
upsert: true
|
|
48
|
-
// includeResultMetadata: true
|
|
49
42
|
})
|
|
50
43
|
.exec();
|
|
51
44
|
}
|
|
@@ -20,8 +20,8 @@ class ConcurrentLockRepo {
|
|
|
20
20
|
// setNXは非推奨のため、setで再実装(2026-08-23~)
|
|
21
21
|
const expiresAtMs = params.expires.getTime();
|
|
22
22
|
const result = await this.redisClient.set(key, value, {
|
|
23
|
-
|
|
24
|
-
PXAT: expiresAtMs // Set the specified Unix time at which the key will expire, in milliseconds (a positive integer).
|
|
23
|
+
condition: 'NX',
|
|
24
|
+
expiration: { type: 'PXAT', value: expiresAtMs } // Set the specified Unix time at which the key will expire, in milliseconds (a positive integer).
|
|
25
25
|
});
|
|
26
26
|
// 成功時は 'OK' が返り、既に存在してロック失敗した場合は null が返る
|
|
27
27
|
if (result === 'OK') {
|
|
@@ -31,7 +31,7 @@ class ConcurrentLockRepo {
|
|
|
31
31
|
}
|
|
32
32
|
async unlock(params) {
|
|
33
33
|
const key = ConcurrentLockRepo.CREATE_REDIS_KEY(params);
|
|
34
|
-
await this.redisClient.del(
|
|
34
|
+
await this.redisClient.del(key);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
exports.ConcurrentLockRepo = ConcurrentLockRepo;
|
|
@@ -22,7 +22,7 @@ class CredentialsRepo {
|
|
|
22
22
|
}
|
|
23
23
|
const key = this.createKey();
|
|
24
24
|
const value = JSON.stringify(credentials);
|
|
25
|
-
await this.redisClient.set(key, value, { EX: this.options.expireInSeconds });
|
|
25
|
+
await this.redisClient.set(key, value, { expiration: { type: 'EX', value: this.options.expireInSeconds } });
|
|
26
26
|
}
|
|
27
27
|
async find() {
|
|
28
28
|
const key = this.createKey();
|
|
@@ -45,10 +45,11 @@ function createMongoConditions(params) {
|
|
|
45
45
|
if (typeof instrumentTypeOfEq === 'string') {
|
|
46
46
|
andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
48
|
+
// discontinue(2026-08-27~)
|
|
49
|
+
// const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
|
|
50
|
+
// if (typeof instrumentIdentifierEq === 'string') {
|
|
51
|
+
// andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
|
|
52
|
+
// }
|
|
52
53
|
const instrumentIdEq = params.instrument?.id?.$eq;
|
|
53
54
|
if (typeof instrumentIdEq === 'string') {
|
|
54
55
|
andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
|
|
@@ -142,15 +143,16 @@ function createMongoConditions(params) {
|
|
|
142
143
|
}
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
146
|
+
// discontinue(2026-08-27~)
|
|
147
|
+
// const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
|
|
148
|
+
// if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
149
|
+
// andConditions.push({
|
|
150
|
+
// 'object.paymentMethod.accountId': {
|
|
151
|
+
// $exists: true,
|
|
152
|
+
// $eq: objectPaymentMethodAccountIdEq
|
|
153
|
+
// }
|
|
154
|
+
// });
|
|
155
|
+
// }
|
|
154
156
|
const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
|
|
155
157
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
156
158
|
andConditions.push({
|
|
@@ -291,15 +293,16 @@ function createMongoConditions(params) {
|
|
|
291
293
|
}
|
|
292
294
|
});
|
|
293
295
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
296
|
+
// discontinue(2026-08-27~)
|
|
297
|
+
// const resultTypeOfIn = params.result?.typeOf?.$in;
|
|
298
|
+
// if (Array.isArray(resultTypeOfIn)) {
|
|
299
|
+
// andConditions.push({
|
|
300
|
+
// 'result.typeOf': {
|
|
301
|
+
// $exists: true,
|
|
302
|
+
// $in: resultTypeOfIn
|
|
303
|
+
// }
|
|
304
|
+
// });
|
|
305
|
+
// }
|
|
303
306
|
const resultIdIn = params.result?.id?.$in;
|
|
304
307
|
if (Array.isArray(resultIdIn)) {
|
|
305
308
|
andConditions.push({
|
|
@@ -309,15 +312,16 @@ function createMongoConditions(params) {
|
|
|
309
312
|
}
|
|
310
313
|
});
|
|
311
314
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
315
|
+
// discontinue(2026-08-27~)
|
|
316
|
+
// const resultOrderNumberIn = params.result?.orderNumber?.$in;
|
|
317
|
+
// if (Array.isArray(resultOrderNumberIn)) {
|
|
318
|
+
// andConditions.push({
|
|
319
|
+
// 'result.orderNumber': {
|
|
320
|
+
// $exists: true,
|
|
321
|
+
// $in: resultOrderNumberIn
|
|
322
|
+
// }
|
|
323
|
+
// });
|
|
324
|
+
// }
|
|
321
325
|
const resultCodeIn = params.result?.code?.$in;
|
|
322
326
|
if (Array.isArray(resultCodeIn)) {
|
|
323
327
|
andConditions.push({
|
|
@@ -155,15 +155,6 @@ const indexes = [
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
],
|
|
158
|
-
[
|
|
159
|
-
{ 'object.paymentMethod.accountId': 1, startDate: -1 },
|
|
160
|
-
{
|
|
161
|
-
name: 'searchByObjectPaymentMethodAccountId',
|
|
162
|
-
partialFilterExpression: {
|
|
163
|
-
'object.paymentMethod.accountId': { $exists: true }
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
],
|
|
167
158
|
[
|
|
168
159
|
{ 'object.paymentMethod.paymentMethodId': 1, startDate: -1 },
|
|
169
160
|
{
|
|
@@ -191,15 +182,6 @@ const indexes = [
|
|
|
191
182
|
}
|
|
192
183
|
}
|
|
193
184
|
],
|
|
194
|
-
[
|
|
195
|
-
{ 'about.id': 1, startDate: -1 },
|
|
196
|
-
{
|
|
197
|
-
name: 'aboutId',
|
|
198
|
-
partialFilterExpression: {
|
|
199
|
-
'about.id': { $exists: true }
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
],
|
|
203
185
|
[
|
|
204
186
|
{ 'about.orderNumber': 1, startDate: -1 },
|
|
205
187
|
{
|
|
@@ -245,24 +227,6 @@ const indexes = [
|
|
|
245
227
|
}
|
|
246
228
|
}
|
|
247
229
|
],
|
|
248
|
-
[
|
|
249
|
-
{ 'object.reservedTicket.ticketType.id': 1, startDate: -1 },
|
|
250
|
-
{
|
|
251
|
-
name: 'searchByObjectReservedTicketTicketTypeId',
|
|
252
|
-
partialFilterExpression: {
|
|
253
|
-
'object.reservedTicket.ticketType.id': { $exists: true }
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
],
|
|
257
|
-
[
|
|
258
|
-
{ 'result.typeOf': 1, startDate: -1 },
|
|
259
|
-
{
|
|
260
|
-
name: 'searchByResultTypeOf',
|
|
261
|
-
partialFilterExpression: {
|
|
262
|
-
'result.typeOf': { $exists: true }
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
],
|
|
266
230
|
[
|
|
267
231
|
{ 'result.id': 1, startDate: -1 },
|
|
268
232
|
{
|
|
@@ -281,15 +245,6 @@ const indexes = [
|
|
|
281
245
|
}
|
|
282
246
|
}
|
|
283
247
|
],
|
|
284
|
-
[
|
|
285
|
-
{ 'result.orderNumber': 1, startDate: -1 },
|
|
286
|
-
{
|
|
287
|
-
name: 'searchByResultOrderNumber',
|
|
288
|
-
partialFilterExpression: {
|
|
289
|
-
'result.orderNumber': { $exists: true }
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
],
|
|
293
248
|
[
|
|
294
249
|
{ 'instrument.transactionNumber': 1, startDate: -1 },
|
|
295
250
|
{
|
|
@@ -308,15 +263,6 @@ const indexes = [
|
|
|
308
263
|
}
|
|
309
264
|
}
|
|
310
265
|
],
|
|
311
|
-
[
|
|
312
|
-
{ 'instrument.identifier': 1, startDate: -1 },
|
|
313
|
-
{
|
|
314
|
-
name: 'instrumentIdentifier',
|
|
315
|
-
partialFilterExpression: {
|
|
316
|
-
'instrument.identifier': { $exists: true }
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
],
|
|
320
266
|
[
|
|
321
267
|
{ 'instrument.id': 1, startDate: -1 },
|
|
322
268
|
{
|
|
@@ -363,7 +309,7 @@ const indexes = [
|
|
|
363
309
|
identifier: { $exists: true }
|
|
364
310
|
}
|
|
365
311
|
}
|
|
366
|
-
]
|
|
312
|
+
],
|
|
367
313
|
// 使用アクションのコレクション分離につき廃止(2026-08-22~)
|
|
368
314
|
// [
|
|
369
315
|
// { 'location.id': 1, startDate: -1 },
|
|
@@ -424,6 +370,66 @@ const indexes = [
|
|
|
424
370
|
// }
|
|
425
371
|
// }
|
|
426
372
|
// ],
|
|
373
|
+
// discontinue(2026-08-27~)
|
|
374
|
+
// [
|
|
375
|
+
// { 'about.id': 1, startDate: -1 },
|
|
376
|
+
// {
|
|
377
|
+
// name: 'aboutId',
|
|
378
|
+
// partialFilterExpression: {
|
|
379
|
+
// 'about.id': { $exists: true }
|
|
380
|
+
// }
|
|
381
|
+
// }
|
|
382
|
+
// ],
|
|
383
|
+
// discontinue(2026-08-27~)
|
|
384
|
+
// [
|
|
385
|
+
// { 'instrument.identifier': 1, startDate: -1 },
|
|
386
|
+
// {
|
|
387
|
+
// name: 'instrumentIdentifier',
|
|
388
|
+
// partialFilterExpression: {
|
|
389
|
+
// 'instrument.identifier': { $exists: true }
|
|
390
|
+
// }
|
|
391
|
+
// }
|
|
392
|
+
// ],
|
|
393
|
+
// discontinue(2026-08-27~)
|
|
394
|
+
// [
|
|
395
|
+
// { 'object.reservedTicket.ticketType.id': 1, startDate: -1 },
|
|
396
|
+
// {
|
|
397
|
+
// name: 'searchByObjectReservedTicketTicketTypeId',
|
|
398
|
+
// partialFilterExpression: {
|
|
399
|
+
// 'object.reservedTicket.ticketType.id': { $exists: true }
|
|
400
|
+
// }
|
|
401
|
+
// }
|
|
402
|
+
// ],
|
|
403
|
+
// discontinue(2026-08-27~)
|
|
404
|
+
// [
|
|
405
|
+
// { 'result.orderNumber': 1, startDate: -1 },
|
|
406
|
+
// {
|
|
407
|
+
// name: 'searchByResultOrderNumber',
|
|
408
|
+
// partialFilterExpression: {
|
|
409
|
+
// 'result.orderNumber': { $exists: true }
|
|
410
|
+
// }
|
|
411
|
+
// }
|
|
412
|
+
// ],
|
|
413
|
+
// discontinue(2026-08-27~)
|
|
414
|
+
// [
|
|
415
|
+
// { 'object.paymentMethod.accountId': 1, startDate: -1 },
|
|
416
|
+
// {
|
|
417
|
+
// name: 'searchByObjectPaymentMethodAccountId',
|
|
418
|
+
// partialFilterExpression: {
|
|
419
|
+
// 'object.paymentMethod.accountId': { $exists: true }
|
|
420
|
+
// }
|
|
421
|
+
// }
|
|
422
|
+
// ],
|
|
423
|
+
// discontinue(2026-08-27~)
|
|
424
|
+
// [
|
|
425
|
+
// { 'result.typeOf': 1, startDate: -1 },
|
|
426
|
+
// {
|
|
427
|
+
// name: 'searchByResultTypeOf',
|
|
428
|
+
// partialFilterExpression: {
|
|
429
|
+
// 'result.typeOf': { $exists: true }
|
|
430
|
+
// }
|
|
431
|
+
// }
|
|
432
|
+
// ],
|
|
427
433
|
];
|
|
428
434
|
exports.indexes = indexes;
|
|
429
435
|
/**
|
|
@@ -74,26 +74,29 @@ const indexes = [
|
|
|
74
74
|
expireAfterSeconds: 17280000 // 200 days
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
|
-
[
|
|
78
|
-
{ dateCreated: -1 },
|
|
79
|
-
{ name: 'searchByDateCreated' }
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
{ 'project.id': 1, dateCreated: -1 },
|
|
83
|
-
{ name: 'searchByProjectId' }
|
|
84
|
-
],
|
|
85
|
-
[
|
|
86
|
-
{ 'recipeFor.id': 1, dateCreated: -1 },
|
|
87
|
-
{ name: 'searchByRecipeForId' }
|
|
88
|
-
],
|
|
89
77
|
// テスト環境ではユニークインデックス適用済(2026-08-21~)
|
|
78
|
+
// 本番環境でもユニークインデックス適用済(2026-08-29~)
|
|
79
|
+
[
|
|
80
|
+
{ 'recipeFor.id': 1 }, // support unique index(2026-08-21~)
|
|
81
|
+
{
|
|
82
|
+
unique: true,
|
|
83
|
+
name: 'uniqueActionId'
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
// uniqueActionIdを適用したのでおそらく不要(2026-08-30~)
|
|
87
|
+
// [
|
|
88
|
+
// { 'recipeFor.id': 1, dateCreated: -1 },
|
|
89
|
+
// { name: 'searchByRecipeForId' }
|
|
90
|
+
// ],
|
|
91
|
+
// 以下、汎用検索系インデックスもひとまず廃止(2026-08-30~)
|
|
92
|
+
// [
|
|
93
|
+
// { dateCreated: -1 },
|
|
94
|
+
// { name: 'searchByDateCreated' }
|
|
95
|
+
// ],
|
|
90
96
|
// [
|
|
91
|
-
// { '
|
|
92
|
-
// {
|
|
93
|
-
//
|
|
94
|
-
// name: 'uniqueActionId'
|
|
95
|
-
// }
|
|
96
|
-
// ]
|
|
97
|
+
// { 'project.id': 1, dateCreated: -1 },
|
|
98
|
+
// { name: 'searchByProjectId' }
|
|
99
|
+
// ],
|
|
97
100
|
];
|
|
98
101
|
exports.indexes = indexes;
|
|
99
102
|
/**
|
|
@@ -31,11 +31,8 @@ class OfferRateLimitRepo {
|
|
|
31
31
|
async lock(params) {
|
|
32
32
|
const key = OfferRateLimitRepo.createKey(params);
|
|
33
33
|
const value = params.reservationNumber;
|
|
34
|
-
const
|
|
34
|
+
const expires = (0, moment_1.default)(params.reservationFor.startDate)
|
|
35
35
|
.add(params.reservedTicket.ticketType.validRateLimit.unitInSeconds, 'seconds')
|
|
36
|
-
.diff((0, moment_1.default)(), 'seconds');
|
|
37
|
-
const expires = (0, moment_1.default)()
|
|
38
|
-
.add(ttl, 'seconds')
|
|
39
36
|
.toDate();
|
|
40
37
|
// reimplement using concurrentLockRepo(2025-05-27~)
|
|
41
38
|
try {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.4.0
|
|
14
|
+
"@chevre/factory": "10.4.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",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vitest": "4.0.18"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
56
|
+
"@redis/client": "^6.2.1",
|
|
57
|
+
"mongoose": "^8.23.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22.0.0",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "27.0.0
|
|
91
|
+
"version": "27.0.0"
|
|
92
92
|
}
|