@chevre/domain 25.2.0-alpha.52 → 25.2.0-alpha.54
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/asyncAction.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
- package/lib/chevre/repo/task.d.ts +34 -10
- package/lib/chevre/repo/task.js +64 -32
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +2 -4
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +2 -4
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +4 -0
- package/lib/chevre/service/payment/any/findCheckAction.js +20 -9
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/taskSettings.d.ts +2 -1
- package/package.json +2 -2
|
@@ -2,11 +2,11 @@ import type { Connection, FilterQuery } from 'mongoose';
|
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IModel, IDocType } from './mongoose/schemas/asyncAction';
|
|
4
4
|
import type { IExecutableTask } from '../taskSettings';
|
|
5
|
-
type ISavingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | '
|
|
5
|
+
type ISavingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'project' | 'runsAt' | 'status'> & {
|
|
6
6
|
expires: Date;
|
|
7
7
|
};
|
|
8
8
|
export type IExecutableAsyncAction = Pick<IExecutableTask<factory.taskName>, 'data' | 'expires' | 'id' | 'name' | 'project' | 'runsAt' | 'status'>;
|
|
9
|
-
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName
|
|
9
|
+
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
|
|
10
10
|
type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
|
|
11
11
|
/**
|
|
12
12
|
* 非同期アクションリポジトリ
|
|
@@ -14,7 +14,7 @@ type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project
|
|
|
14
14
|
export declare class AsyncActionRepo {
|
|
15
15
|
readonly asyncActionModel: IModel;
|
|
16
16
|
constructor(connection: Connection);
|
|
17
|
-
static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status'>): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/
|
|
17
|
+
static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status'>): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
|
|
18
18
|
findAsyncActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
|
|
19
19
|
id: string;
|
|
20
20
|
})[]>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Pick<factory.task.ITask<factory.taskName>, 'data' | 'dateAborted' | 'executionResults' | 'executor' | '
|
|
4
|
+
type IDocType = Pick<factory.task.ITask<factory.taskName>, 'data' | 'dateAborted' | 'executionResults' | 'executor' | 'lastTriedAt' | 'name' | 'project' | 'runsAt' | 'status'> & {
|
|
5
|
+
expires: Date;
|
|
6
|
+
};
|
|
5
7
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
8
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
9
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.task.ITask<factory.taskName>, 'id'
|
|
4
|
+
type IDocType = Omit<factory.task.ITask<factory.taskName>, 'id'> & {
|
|
5
|
+
/**
|
|
6
|
+
* 非同期アクション移行前のタスクには残っている(2026-07-29時点)
|
|
7
|
+
*/
|
|
8
|
+
expires?: Date;
|
|
9
|
+
};
|
|
5
10
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
11
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
12
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -23,16 +23,21 @@ export interface IAggregateTask {
|
|
|
23
23
|
interface IOptionOnCreate {
|
|
24
24
|
emitImmediately: boolean;
|
|
25
25
|
}
|
|
26
|
-
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName
|
|
27
|
-
|
|
26
|
+
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
|
|
27
|
+
/**
|
|
28
|
+
* リトライ可能なタスク作成属性
|
|
29
|
+
*/
|
|
30
|
+
type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'> & {
|
|
31
|
+
expires?: Date;
|
|
32
|
+
};
|
|
28
33
|
/**
|
|
29
34
|
* タスクリポジトリ
|
|
30
35
|
*/
|
|
31
36
|
export declare class TaskRepo {
|
|
32
37
|
readonly taskModel: IModel;
|
|
33
38
|
constructor(connection: Connection);
|
|
34
|
-
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/
|
|
35
|
-
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
|
|
39
|
+
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
|
|
40
|
+
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
36
41
|
alternateName?: never;
|
|
37
42
|
identifier?: never;
|
|
38
43
|
expires: Date;
|
|
@@ -61,11 +66,9 @@ export declare class TaskRepo {
|
|
|
61
66
|
*/
|
|
62
67
|
createIfNotExistByAlternateName(params: ICreatingTask & {
|
|
63
68
|
alternateName: string;
|
|
69
|
+
identifier: string;
|
|
70
|
+
expires?: never;
|
|
64
71
|
}, options: IOptionOnCreate): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* 取引削除タスク冪等作成
|
|
67
|
-
*/
|
|
68
|
-
createDeleteTransactionTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.DeleteTransaction>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
|
|
69
72
|
createOnAssetTransactionStatusChangedTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
|
|
70
73
|
/**
|
|
71
74
|
* Ready -> remainingNumberOfTriesが1減る
|
|
@@ -197,6 +200,23 @@ export declare class TaskRepo {
|
|
|
197
200
|
* 検索する
|
|
198
201
|
*/
|
|
199
202
|
projectFields(params: factory.task.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.task.ITask<factory.taskName>[]>;
|
|
203
|
+
/**
|
|
204
|
+
* タスクの状態を参照する
|
|
205
|
+
* 非同期アクション移行が完了したら廃止する(2026-07-29~)
|
|
206
|
+
*/
|
|
207
|
+
findTaskById(params: {
|
|
208
|
+
id: {
|
|
209
|
+
$eq: string;
|
|
210
|
+
};
|
|
211
|
+
project: {
|
|
212
|
+
id: {
|
|
213
|
+
$eq: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
name: factory.taskName;
|
|
217
|
+
}, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
|
|
218
|
+
id: string;
|
|
219
|
+
} | undefined)>;
|
|
200
220
|
deleteByProject(params: {
|
|
201
221
|
project: {
|
|
202
222
|
id: string;
|
|
@@ -229,11 +249,15 @@ export declare class TaskRepo {
|
|
|
229
249
|
}): Promise<{
|
|
230
250
|
count: number;
|
|
231
251
|
}>;
|
|
232
|
-
getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> &
|
|
252
|
+
getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask, "id"> & {
|
|
253
|
+
expires?: Date;
|
|
254
|
+
} & {
|
|
233
255
|
_id: import("mongoose").Types.ObjectId;
|
|
234
256
|
} & {
|
|
235
257
|
__v: number;
|
|
236
|
-
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> &
|
|
258
|
+
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask, "id"> & {
|
|
259
|
+
expires?: Date;
|
|
260
|
+
} & {
|
|
237
261
|
_id: import("mongoose").Types.ObjectId;
|
|
238
262
|
} & {
|
|
239
263
|
__v: number;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -30,7 +30,6 @@ const executableTaskProjection = {
|
|
|
30
30
|
runsAt: 1,
|
|
31
31
|
expires: 1
|
|
32
32
|
};
|
|
33
|
-
// type IProjection = { [key in IKeyOfProjection]?: 0 | 1; };
|
|
34
33
|
const AVAILABLE_PROJECT_FIELDS = [
|
|
35
34
|
'alternateName',
|
|
36
35
|
'identifier',
|
|
@@ -272,30 +271,39 @@ class TaskRepo {
|
|
|
272
271
|
throw new factory_1.factory.errors.Internal(`falied in creating a task unexpectedly. ${params.alternateName}`);
|
|
273
272
|
}
|
|
274
273
|
}
|
|
275
|
-
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
async createDeleteTransactionTaskIfNotExist(
|
|
279
|
-
// resolve uniqueness of identifier(2025-03-27~)
|
|
280
|
-
params
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
274
|
+
// /**
|
|
275
|
+
// * 取引削除タスク冪等作成
|
|
276
|
+
// */
|
|
277
|
+
// public async createDeleteTransactionTaskIfNotExist(
|
|
278
|
+
// // resolve uniqueness of identifier(2025-03-27~)
|
|
279
|
+
// params: Pick<
|
|
280
|
+
// factory.task.IAttributes<factory.taskName.DeleteTransaction>,
|
|
281
|
+
// 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'
|
|
282
|
+
// >,
|
|
283
|
+
// options: IOptionOnCreate
|
|
284
|
+
// ): Promise<void> {
|
|
285
|
+
// if (params.data.object.specifyingMethod !== factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id) {
|
|
286
|
+
// throw new factory.errors.NotImplemented(`only ${factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id} implemented`);
|
|
287
|
+
// }
|
|
288
|
+
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
289
|
+
// {
|
|
290
|
+
// 'project.id': { $eq: params.project.id },
|
|
291
|
+
// name: { $eq: params.name },
|
|
292
|
+
// 'data.object.id': { $exists: true, $eq: params.data.object.id }
|
|
293
|
+
// },
|
|
294
|
+
// { $setOnInsert: params },
|
|
295
|
+
// { new: true, upsert: true }
|
|
296
|
+
// )
|
|
297
|
+
// .select({ _id: 1 })
|
|
298
|
+
// .exec();
|
|
299
|
+
// if (options.emitImmediately) {
|
|
300
|
+
// taskEventEmitter.emitTaskStatusChanged({
|
|
301
|
+
// id: createdTask.id,
|
|
302
|
+
// name: params.name,
|
|
303
|
+
// status: factory.taskStatus.Ready
|
|
304
|
+
// });
|
|
305
|
+
// }
|
|
306
|
+
// }
|
|
299
307
|
async createOnAssetTransactionStatusChangedTaskIfNotExist(
|
|
300
308
|
// resolve uniqueness of identifier(2025-03-27~)
|
|
301
309
|
params, options) {
|
|
@@ -674,14 +682,8 @@ class TaskRepo {
|
|
|
674
682
|
/**
|
|
675
683
|
* 検索する
|
|
676
684
|
*/
|
|
677
|
-
async projectFields(params,
|
|
678
|
-
// projection?: IProjection
|
|
679
|
-
inclusion) {
|
|
685
|
+
async projectFields(params, inclusion) {
|
|
680
686
|
const conditions = TaskRepo.CREATE_MONGO_CONDITIONS(params);
|
|
681
|
-
// const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
|
|
682
|
-
// ? Object.values(projection)
|
|
683
|
-
// .some((value) => value !== 0)
|
|
684
|
-
// : false;
|
|
685
687
|
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
686
688
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
687
689
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
@@ -707,6 +709,36 @@ class TaskRepo {
|
|
|
707
709
|
.lean() // lean(2024-09-26~)
|
|
708
710
|
.exec();
|
|
709
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* タスクの状態を参照する
|
|
714
|
+
* 非同期アクション移行が完了したら廃止する(2026-07-29~)
|
|
715
|
+
*/
|
|
716
|
+
async findTaskById(params, inclusion) {
|
|
717
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
718
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
719
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
// no op
|
|
723
|
+
}
|
|
724
|
+
const projection = {
|
|
725
|
+
_id: 0,
|
|
726
|
+
id: { $toString: '$_id' },
|
|
727
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
728
|
+
};
|
|
729
|
+
const query = this.taskModel.findOne({
|
|
730
|
+
_id: { $eq: params.id.$eq },
|
|
731
|
+
'project.id': { $eq: params.project.id.$eq },
|
|
732
|
+
name: { $eq: params.name }
|
|
733
|
+
}, projection);
|
|
734
|
+
const doc = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
735
|
+
.lean()
|
|
736
|
+
.exec();
|
|
737
|
+
if (doc === null) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
return doc;
|
|
741
|
+
}
|
|
710
742
|
async deleteByProject(params) {
|
|
711
743
|
await this.taskModel.deleteMany({
|
|
712
744
|
'project.id': { $eq: params.project.id }
|
|
@@ -36,7 +36,7 @@ interface IVoidTransactionRepos {
|
|
|
36
36
|
* 興行オファー承認取消(タスクから実行 or apiから実行))
|
|
37
37
|
* 取引中の承認アクション全てについて処理する or 特定の承認アクションについて処理する
|
|
38
38
|
*/
|
|
39
|
-
declare function voidTransaction(params: factory.task.IData
|
|
39
|
+
declare function voidTransaction(params: factory.task.voidReserveTransaction.IData & {
|
|
40
40
|
project: {
|
|
41
41
|
id: string;
|
|
42
42
|
};
|
|
@@ -36,7 +36,7 @@ interface IVoidTransactionByActionIdRepos {
|
|
|
36
36
|
* 興行オファー承認取消(apiから実行)
|
|
37
37
|
* 特定の承認アクションについて処理する
|
|
38
38
|
*/
|
|
39
|
-
declare function voidTransactionByActionId(params: factory.task.IData
|
|
39
|
+
declare function voidTransactionByActionId(params: factory.task.voidReserveTransaction.IData & {
|
|
40
40
|
project: {
|
|
41
41
|
id: string;
|
|
42
42
|
};
|
|
@@ -17,13 +17,11 @@ function findAcceptAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.AcceptCOAOffer
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AcceptCOAOffer);
|
|
@@ -7,5 +7,5 @@ import { factory } from '../../../../factory';
|
|
|
7
7
|
*/
|
|
8
8
|
declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
9
9
|
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
|
|
10
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
10
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
11
11
|
export { createOnOrderCancelledTasksByTransaction };
|
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ declare function createInformTasks(params: {
|
|
|
18
18
|
}, setting: Pick<ISetting, 'onOrderStatusChanged'> | null): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
19
19
|
declare function createNextSendOrderTasks(params: {
|
|
20
20
|
order: IInTransitOrder;
|
|
21
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
21
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
22
22
|
export { createInformTasks, createNextSendOrderTasks, IInTransitOrder };
|
|
@@ -11,5 +11,5 @@ declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IRe
|
|
|
11
11
|
declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
12
12
|
order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
|
|
13
13
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
14
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
14
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
15
15
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
|
|
@@ -17,13 +17,11 @@ function findAcceptAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.PublishPaymentUrl
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.PublishPaymentUrl);
|
|
@@ -17,13 +17,11 @@ function findAuthorizeAction(params, options) {
|
|
|
17
17
|
}
|
|
18
18
|
// 非同期アクションが存在しなければタスクを参照
|
|
19
19
|
if (task === undefined) {
|
|
20
|
-
task =
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
23
21
|
id: { $eq: params.sameAs.id },
|
|
24
22
|
project: { id: { $eq: params.project.id } },
|
|
25
23
|
name: factory_1.factory.taskName.AuthorizePayment
|
|
26
|
-
}, ['status', 'executionResults'])
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
27
25
|
}
|
|
28
26
|
if (task === undefined) {
|
|
29
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AuthorizePayment);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { CheckMovieTicketActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../../repo/action/checkMovieTicket';
|
|
3
|
+
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
3
4
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
5
|
interface IFindCheckActionRepos {
|
|
5
6
|
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
7
|
+
asyncAction: AsyncActionRepo;
|
|
6
8
|
task: TaskRepo;
|
|
7
9
|
}
|
|
8
10
|
interface IFindCheckActionResult {
|
|
@@ -41,5 +43,7 @@ declare function findCheckAction(params: {
|
|
|
41
43
|
*/
|
|
42
44
|
id: string;
|
|
43
45
|
};
|
|
46
|
+
}, options: {
|
|
47
|
+
useAsyncAction: boolean;
|
|
44
48
|
}): (repos: IFindCheckActionRepos) => Promise<IFindCheckActionResult>;
|
|
45
49
|
export { IFindCheckActionRepos, findCheckAction, };
|
|
@@ -2,16 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findCheckAction = findCheckAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findCheckAction(params) {
|
|
5
|
+
function findCheckAction(params, options) {
|
|
6
6
|
return async (repos) => {
|
|
7
|
-
//
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
// 非同期アクションに対応(2026-07-28~)
|
|
8
|
+
const { useAsyncAction } = options;
|
|
9
|
+
let task;
|
|
10
|
+
if (useAsyncAction) {
|
|
11
|
+
// まず非同期アクションを参照
|
|
12
|
+
task = await repos.asyncAction.findAsyncActionById({
|
|
13
|
+
id: { $eq: params.sameAs.id },
|
|
14
|
+
project: { id: { $eq: params.project.id } },
|
|
15
|
+
name: factory_1.factory.taskName.CheckMovieTicket
|
|
16
|
+
}, ['status', 'executionResults']);
|
|
17
|
+
}
|
|
18
|
+
// 非同期アクションが存在しなければタスクを参照
|
|
19
|
+
if (task === undefined) {
|
|
20
|
+
task = await repos.task.findTaskById({
|
|
21
|
+
id: { $eq: params.sameAs.id },
|
|
22
|
+
project: { id: { $eq: params.project.id } },
|
|
23
|
+
name: factory_1.factory.taskName.CheckMovieTicket
|
|
24
|
+
}, ['status', 'executionResults']);
|
|
25
|
+
}
|
|
15
26
|
if (task === undefined) {
|
|
16
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.CheckMovieTicket);
|
|
17
28
|
}
|
|
@@ -3,4 +3,4 @@ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../tas
|
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(params: Pick<factory.task.ITask
|
|
6
|
+
export declare function call(params: Pick<factory.task.voidReserveTransaction.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -25,5 +25,5 @@ interface IDeleteTransactionRepos {
|
|
|
25
25
|
* 取引に関わるリソースを削除する
|
|
26
26
|
* 冪等性を確保すること
|
|
27
27
|
*/
|
|
28
|
-
export declare function deleteTransaction(params: factory.task.IData
|
|
28
|
+
export declare function deleteTransaction(params: factory.task.deleteTransaction.IData): (repos: IDeleteTransactionRepos) => Promise<void>;
|
|
29
29
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
-
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.IAttributes
|
|
3
|
+
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.deleteTransaction.IAttributes | factory.task.IAttributes<factory.taskName.VoidPayTransaction> | factory.task.voidReserveTransaction.IAttributes;
|
|
4
4
|
/**
|
|
5
5
|
* 取引のタスクを作成する
|
|
6
6
|
*/
|
|
@@ -27,8 +27,9 @@ interface IExecuteOptions {
|
|
|
27
27
|
type IOperationExecute<T> = (settings: IExecuteSettings, options: IExecuteOptions) => Promise<T>;
|
|
28
28
|
type ICallResult = void | Pick<factory.task.IExecutionResult, 'error'>;
|
|
29
29
|
type ICallableTaskOperation = (task: IExecutableTask<factory.taskName>) => IOperationExecute<ICallResult>;
|
|
30
|
-
type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt'
|
|
30
|
+
type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt';
|
|
31
31
|
type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys> & {
|
|
32
|
+
expires?: Date;
|
|
32
33
|
status: factory.taskStatus.Running;
|
|
33
34
|
};
|
|
34
35
|
export { ICallableTaskOperation, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
|
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.1.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.1.0-alpha.2",
|
|
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",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "25.2.0-alpha.
|
|
91
|
+
"version": "25.2.0-alpha.54"
|
|
92
92
|
}
|