@chevre/domain 26.1.0-alpha.0 → 26.1.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.
@@ -1,67 +1,40 @@
1
- import { Surfrock } from '@surfrock/sdk';
1
+ import type { Surfrock } from '@surfrock/sdk';
2
2
  import type { Connection } from 'mongoose';
3
3
  import { factory } from '../../factory';
4
- import { ActionProcessRepo, IActionRecipe } from './anyAction/actionProcess';
4
+ import { DedicatedActionProcessRepo, IActionRecipe, IRecipeAsActionAttributes } from './dedicatedAction/dedicatedActionProcess';
5
5
  export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
6
6
  knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
7
7
  };
8
+ type StartableActionType = factory.actionType.CheckAction;
9
+ export type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
8
10
  /**
9
- * アクションIDで参照、あるいは、決済カードコード+イベントIDで参照
11
+ * 決済カード認証アクションリポジトリ
10
12
  */
11
- type IFindCompletedCheckActionsParams = ({
13
+ export declare class CheckMovieTicketActionRepo extends DedicatedActionProcessRepo<StartableActionType, IActionRecipe<factory.recipe.RecipeCategory.checkMovieTicket>> {
12
14
  /**
13
- * アクションID
15
+ * 専用アクションモデル
14
16
  */
15
- id?: string;
16
- purpose?: {
17
- /**
18
- * 注文取引ID
19
- */
20
- id?: string;
21
- };
22
- object?: never;
23
- sort?: never;
24
- }) | (Pick<factory.action.ISearchConditions, 'sort'> & {
25
- purpose?: {
26
- /**
27
- * 注文取引ID
28
- */
29
- id?: string;
30
- };
31
- object?: {
32
- /**
33
- * 決済サービス
34
- */
35
- id?: {
36
- $eq?: string;
37
- };
38
- movieTickets?: {
39
- identifier?: {
40
- $eq?: string;
41
- };
42
- serviceOutput?: {
43
- reservationFor?: {
44
- id?: {
45
- $eq?: string;
46
- };
47
- };
48
- };
49
- };
50
- typeOf?: {
51
- $eq?: factory.service.paymentService.PaymentServiceType.MovieTicket;
52
- };
53
- };
17
+ private readonly checkMovieTicketActionModel;
54
18
  /**
55
- * アクションID
19
+ * 旧汎用アクションモデル
56
20
  */
57
- id?: never;
58
- });
59
- export type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
60
- /**
61
- * 決済カード認証アクションリポジトリ
62
- */
63
- export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheckMovieTicketAction, IActionRecipe<factory.recipe.RecipeCategory.checkMovieTicket>> {
21
+ private readonly legacyActionModel;
64
22
  constructor(connection: Connection);
23
+ startCheckMovieTicketAction(attributes: factory.action.check.paymentMethod.movieTicket.IAttributes, options?: {
24
+ recipe?: IRecipeAsActionAttributes<factory.recipe.RecipeCategory.checkMovieTicket>;
25
+ }): Promise<Pick<ICheckMovieTicketAction, 'id' | 'typeOf' | 'startDate'>>;
26
+ completeCheckMovieTicketAction(params: {
27
+ typeOf: StartableActionType;
28
+ id: string;
29
+ result: factory.action.check.paymentMethod.movieTicket.IResult;
30
+ recipe?: IRecipeAsActionAttributes<factory.recipe.RecipeCategory.checkMovieTicket>;
31
+ }): Promise<void>;
32
+ giveUpCheckMovieTicketAction(params: {
33
+ typeOf: StartableActionType;
34
+ id: string;
35
+ error: Error | Error[] | unknown;
36
+ recipe?: IRecipeAsActionAttributes<factory.recipe.RecipeCategory.checkMovieTicket>;
37
+ }): Promise<void>;
65
38
  findActionBySameAs(params: {
66
39
  sameAs: {
67
40
  id: string;
@@ -81,6 +54,7 @@ export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheck
81
54
  id: string;
82
55
  };
83
56
  }): Promise<IMinimizedPurchaseNumberAuthResult | undefined>;
57
+ private completedCheckMovieTicketActionExistsById;
84
58
  searchYkknInfoByCheckRecipe(filter: {
85
59
  limit: number;
86
60
  page: number;
@@ -116,6 +90,17 @@ export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheck
116
90
  /**
117
91
  * 認証済アクション参照
118
92
  */
119
- findCompletedCheckActions(params: IFindCompletedCheckActionsParams): Promise<Pick<ICheckMovieTicketAction, 'id'>[]>;
93
+ findCompletedCheckMovieTicketAction(params: {
94
+ /**
95
+ * 認証アクションID
96
+ */
97
+ id: string;
98
+ purpose: {
99
+ /**
100
+ * 注文取引ID
101
+ */
102
+ id: string;
103
+ };
104
+ }): Promise<Pick<import("@chevre/factory/lib/chevre/action/check/paymentMethod/movieTicket").IAction, "id"> | null>;
120
105
  }
121
106
  export {};
@@ -3,39 +3,75 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CheckMovieTicketActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
5
  const settings_1 = require("../../settings");
6
- const actionProcess_1 = require("./anyAction/actionProcess");
6
+ const checkMovieTicket_1 = require("../mongoose/schemas/action/checkMovieTicket");
7
+ const action_1 = require("../mongoose/schemas/action");
8
+ const dedicatedActionProcess_1 = require("./dedicatedAction/dedicatedActionProcess");
7
9
  const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
8
10
  /**
9
11
  * 決済カード認証アクションリポジトリ
10
12
  */
11
- class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
13
+ class CheckMovieTicketActionRepo extends dedicatedActionProcess_1.DedicatedActionProcessRepo {
14
+ /**
15
+ * 専用アクションモデル
16
+ */
17
+ checkMovieTicketActionModel;
18
+ /**
19
+ * 旧汎用アクションモデル
20
+ */
21
+ legacyActionModel;
12
22
  constructor(connection) {
13
- super({ connection }, {
23
+ const checkMovieTicketActionModel = connection.model(checkMovieTicket_1.modelName, (0, checkMovieTicket_1.createSchema)());
24
+ const legacyActionModel = connection.model(action_1.modelName, (0, action_1.createSchema)());
25
+ super({
26
+ connection,
27
+ actionModel: checkMovieTicketActionModel
28
+ }, {
14
29
  expireAfterSeconds: EXPIRE_AFTER_SECONDS,
15
30
  recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
16
31
  });
32
+ this.checkMovieTicketActionModel = checkMovieTicketActionModel;
33
+ this.legacyActionModel = legacyActionModel;
34
+ }
35
+ async startCheckMovieTicketAction(attributes, options) {
36
+ return this.startAction(attributes, options);
37
+ }
38
+ async completeCheckMovieTicketAction(params) {
39
+ await this.completeAction(params);
40
+ }
41
+ async giveUpCheckMovieTicketAction(params) {
42
+ await this.giveUpAction(params);
17
43
  }
18
44
  async findActionBySameAs(params) {
19
- return this.actionModel.findOne({
45
+ const filter = {
20
46
  typeOf: { $eq: factory_1.factory.actionType.CheckAction }, // 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
21
47
  'sameAs.id': { $exists: true, $eq: params.sameAs.id },
22
48
  ...(typeof params.purpose?.id === 'string')
23
49
  ? { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
24
50
  : undefined
25
- }, {
51
+ };
52
+ const projection = {
26
53
  _id: 0,
27
54
  id: { $toString: '$_id' },
28
55
  actionStatus: 1,
29
56
  error: 1,
30
57
  purpose: 1
31
- })
58
+ };
59
+ const doc = await this.checkMovieTicketActionModel.findOne(filter, projection)
32
60
  .lean()
33
61
  .exec();
62
+ if (doc === null) {
63
+ // コレクション移行の互換性維持対応(2026-08-20~)
64
+ return this.legacyActionModel.findOne(filter, projection)
65
+ .lean()
66
+ .exec();
67
+ }
68
+ return doc;
34
69
  }
35
70
  /**
36
71
  * アクションIDからレシピのafterMediaを参照する
37
72
  */
38
73
  async findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe(params) {
74
+ // レシピのみ参照のため互換性維持対応は不要
39
75
  const recipe = await this.actionRecipeModel.findOne({
40
76
  'project.id': { $eq: params.project.id },
41
77
  'recipeFor.id': { $eq: params.recipeFor.id }
@@ -52,7 +88,7 @@ class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
52
88
  .exec();
53
89
  return recipe?.step[0]?.itemListElement[0]?.itemListElement[0]?.afterMedia;
54
90
  }
55
- async searchYkknInfoByCheckRecipe(filter) {
91
+ async completedCheckMovieTicketActionExistsById(filter) {
56
92
  const filterQuery = {
57
93
  _id: { $eq: filter.id },
58
94
  'project.id': { $eq: filter.project.id },
@@ -60,11 +96,19 @@ class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
60
96
  typeOf: { $eq: factory_1.factory.actionType.CheckAction },
61
97
  actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus }
62
98
  };
63
- const actionDoc = await this.actionModel.findOne(filterQuery, { _id: 1 }, { lean: true })
99
+ const actionDoc = await this.checkMovieTicketActionModel.findOne(filterQuery, { _id: 1 }, { lean: true })
64
100
  .exec();
65
101
  if (actionDoc === null) {
66
- throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
102
+ // コレクション移行の互換性維持対応(2026-08-20~)
103
+ const legacyActionDoc = await this.legacyActionModel.findOne(filterQuery, { _id: 1 }, { lean: true })
104
+ .exec();
105
+ if (legacyActionDoc === null) {
106
+ throw new factory_1.factory.errors.NotFound(this.checkMovieTicketActionModel.modelName);
107
+ }
67
108
  }
109
+ }
110
+ async searchYkknInfoByCheckRecipe(filter) {
111
+ await this.completedCheckMovieTicketActionExistsById(filter);
68
112
  const filterQuery4recipe = {
69
113
  'recipeFor.id': { $eq: filter.id }
70
114
  };
@@ -96,18 +140,7 @@ class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
96
140
  .exec();
97
141
  }
98
142
  async searchMkknInfoByCheckRecipe(filter) {
99
- const filterQuery = {
100
- _id: { $eq: filter.id },
101
- 'project.id': { $eq: filter.project.id },
102
- 'purpose.id': { $exists: true, $eq: filter.purpose.id },
103
- typeOf: { $eq: factory_1.factory.actionType.CheckAction },
104
- actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus }
105
- };
106
- const actionDoc = this.actionModel.findOne(filterQuery, { _id: 1 }, { lean: true })
107
- .exec();
108
- if (actionDoc === null) {
109
- throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
110
- }
143
+ await this.completedCheckMovieTicketActionExistsById(filter);
111
144
  const filterQuery4recipe = {
112
145
  'recipeFor.id': { $eq: filter.id }
113
146
  };
@@ -145,57 +178,29 @@ class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
145
178
  /**
146
179
  * 認証済アクション参照
147
180
  */
148
- async findCompletedCheckActions(params) {
149
- const andConditions = [
150
- ...(typeof params.id === 'string') ? [{ _id: { $eq: params.id } }] : [],
151
- { typeOf: { $eq: factory_1.factory.actionType.CheckAction } },
152
- { actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus } }
153
- ];
154
- const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
155
- if (typeof objectMovieTicketsIdentifierEq === 'string') {
156
- andConditions.push({
157
- 'object.movieTickets.identifier': { $exists: true, $eq: objectMovieTicketsIdentifierEq }
158
- });
159
- }
160
- const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
161
- if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
162
- andConditions.push({
163
- 'object.movieTickets.serviceOutput.reservationFor.id': { $exists: true, $eq: objectMovieTicketsServiceOutputReservationForIdEq }
164
- });
165
- }
166
- const objectTypeOfEq = params.object?.typeOf?.$eq;
167
- if (typeof objectTypeOfEq === 'string') {
168
- andConditions.push({
169
- 'object.typeOf': { $exists: true, $eq: objectTypeOfEq }
170
- });
171
- }
172
- const objectIdEq = params.object?.id?.$eq;
173
- if (typeof objectIdEq === 'string') {
174
- andConditions.push({
175
- 'object.id': { $exists: true, $eq: objectIdEq }
176
- });
177
- }
178
- const purposeIdEq = params.purpose?.id;
179
- if (typeof purposeIdEq === 'string') {
180
- andConditions.push({
181
- 'purpose.id': { $exists: true, $eq: purposeIdEq }
182
- });
183
- }
181
+ async findCompletedCheckMovieTicketAction(params) {
182
+ const filter = {
183
+ _id: { $eq: params.id },
184
+ typeOf: { $eq: factory_1.factory.actionType.CheckAction },
185
+ actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus },
186
+ 'purpose.id': { $exists: true, $eq: params.purpose.id }
187
+ };
184
188
  const projection = {
185
189
  _id: 0,
186
190
  id: { $toString: '$_id' },
187
191
  };
188
- const query = this.actionModel.find({ $and: andConditions }, projection);
189
- query.limit(1);
190
- /* istanbul ignore else */
191
- if (params.sort?.startDate !== undefined) {
192
- query.sort({ startDate: params.sort.startDate });
193
- }
194
- // const explainResult = await (<any>query).explain();
195
- // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
196
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
192
+ const doc = await this.checkMovieTicketActionModel.findOne(filter, projection)
193
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
197
194
  .lean()
198
195
  .exec();
196
+ if (doc === null) {
197
+ // コレクション移行の互換性維持対応(2026-08-20~)
198
+ return this.legacyActionModel.findOne(filter, projection)
199
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
200
+ .lean()
201
+ .exec();
202
+ }
203
+ return doc;
199
204
  }
200
205
  }
201
206
  exports.CheckMovieTicketActionRepo = CheckMovieTicketActionRepo;
@@ -2,10 +2,11 @@ import { Connection } from 'mongoose';
2
2
  import { factory } from '../../../factory';
3
3
  import type { IAbstractActionModel } from '../../mongoose/schemas/action/abstractAction';
4
4
  import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from '../anyAction/actionRecipe';
5
- type AvailableActionType = factory.actionType.InformAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction | factory.actionType.UseAction;
6
- type IAction<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAction : never;
7
- type IActionAttributes<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAttributes : T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAttributes : never;
8
- type IResult<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IResult : T extends factory.actionType.AddAction ? factory.action.update.add.IResult : T extends factory.actionType.UpdateAction ? factory.action.update.update.IResult : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IResult : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IResult : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IResult : never;
5
+ export { IActionRecipe, IRecipeAsActionAttributes };
6
+ type AvailableActionType = factory.actionType.InformAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction | factory.actionType.UseAction | factory.actionType.CheckAction;
7
+ type IAction<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAction : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IAction : never;
8
+ type IActionAttributes<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAttributes : T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAttributes : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IAttributes : never;
9
+ type IResult<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IResult : T extends factory.actionType.AddAction ? factory.action.update.add.IResult : T extends factory.actionType.UpdateAction ? factory.action.update.update.IResult : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IResult : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IResult : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IResult : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IResult : never;
9
10
  interface IOptions {
10
11
  expireAfterSeconds: number;
11
12
  recipeExpireAfterSeconds: number;
@@ -43,4 +44,3 @@ export declare class DedicatedActionProcessRepo<TActionType extends AvailableAct
43
44
  recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
44
45
  }): Promise<void>;
45
46
  }
46
- export {};
@@ -0,0 +1,11 @@
1
+ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
+ import { IVirtuals } from '../../virtuals';
3
+ import { factory } from '../../../../factory';
4
+ type IDocType = Pick<factory.action.check.paymentMethod.movieTicket.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'expires' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'>;
5
+ type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
6
+ type ISchemaDefinition = SchemaDefinition<IDocType>;
7
+ type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
8
+ declare const modelName = "Action.CheckMovieTicket";
9
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
10
+ declare function createSchema(): ISchema;
11
+ export { createSchema, IDocType, IModel, indexes, modelName };
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modelName = exports.indexes = void 0;
4
+ exports.createSchema = createSchema;
5
+ const mongoose_1 = require("mongoose");
6
+ const writeConcern_1 = require("../../writeConcern");
7
+ const settings_1 = require("../../../../settings");
8
+ const modelName = 'Action.CheckMovieTicket';
9
+ exports.modelName = modelName;
10
+ const schemaDefinition = {
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
+ actionStatus: { type: String, required: true },
13
+ typeOf: { type: String, required: true },
14
+ agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
15
+ object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
16
+ startDate: { type: Date, required: true },
17
+ expires: { type: Date, required: true },
18
+ result: mongoose_1.SchemaTypes.Mixed,
19
+ error: mongoose_1.SchemaTypes.Mixed,
20
+ endDate: Date,
21
+ purpose: mongoose_1.SchemaTypes.Mixed,
22
+ potentialActions: mongoose_1.SchemaTypes.Mixed,
23
+ instrument: mongoose_1.SchemaTypes.Mixed,
24
+ sameAs: mongoose_1.SchemaTypes.Mixed,
25
+ };
26
+ const schemaOptions = {
27
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
28
+ autoCreate: false,
29
+ collection: 'actions.checkMovieTicket',
30
+ id: true,
31
+ read: 'primary',
32
+ writeConcern: writeConcern_1.writeConcern,
33
+ strict: true,
34
+ strictQuery: false,
35
+ timestamps: false,
36
+ versionKey: false,
37
+ toJSON: {
38
+ getters: false,
39
+ virtuals: false,
40
+ minimize: false,
41
+ versionKey: false
42
+ },
43
+ toObject: {
44
+ getters: false,
45
+ virtuals: true,
46
+ minimize: false,
47
+ versionKey: false
48
+ }
49
+ };
50
+ const indexes = [
51
+ [
52
+ { expires: 1 },
53
+ {
54
+ name: 'expires',
55
+ expireAfterSeconds: 0
56
+ }
57
+ ],
58
+ [
59
+ { startDate: -1 },
60
+ { name: 'startDate' }
61
+ ],
62
+ [
63
+ { 'project.id': 1, startDate: -1 },
64
+ { name: 'projectId' }
65
+ ],
66
+ [
67
+ { typeOf: 1, startDate: -1 },
68
+ { name: 'typeOf' }
69
+ ],
70
+ [
71
+ { actionStatus: 1, startDate: -1 },
72
+ { name: 'actionStatus' }
73
+ ],
74
+ [
75
+ { 'sameAs.id': 1, startDate: -1 },
76
+ {
77
+ name: 'sameAsId',
78
+ partialFilterExpression: {
79
+ 'sameAs.id': { $exists: true }
80
+ }
81
+ }
82
+ ],
83
+ [
84
+ { 'purpose.id': 1, startDate: -1 },
85
+ {
86
+ name: 'purposeId',
87
+ partialFilterExpression: {
88
+ 'purpose.id': { $exists: true }
89
+ }
90
+ }
91
+ ],
92
+ ];
93
+ exports.indexes = indexes;
94
+ /**
95
+ * サーフロック認証アクションスキーマ
96
+ */
97
+ let schema;
98
+ function createSchema() {
99
+ if (schema === undefined) {
100
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
101
+ }
102
+ if (settings_1.MONGO_AUTO_INDEX) {
103
+ indexes.forEach((indexParams) => {
104
+ schema?.index(...indexParams);
105
+ });
106
+ }
107
+ return schema;
108
+ }
@@ -42,7 +42,7 @@ function checkMovieTicket(params) {
42
42
  ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } // タスク関連付け(2024-05-21~)
43
43
  : undefined
44
44
  };
45
- const action = await repos.actions.checkMovieTicket.start(actionAttributes);
45
+ const action = await repos.actions.checkMovieTicket.startCheckMovieTicketAction(actionAttributes);
46
46
  let processPurchaseNumberAuthResult;
47
47
  let recipe;
48
48
  try {
@@ -76,7 +76,7 @@ function checkMovieTicket(params) {
76
76
  // アクション保管用のエラーと両方保管(2024-05-22~)
77
77
  const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
78
78
  try {
79
- await repos.actions.checkMovieTicket.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
79
+ await repos.actions.checkMovieTicket.giveUpCheckMovieTicketAction({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
80
80
  }
81
81
  catch (__) {
82
82
  // 失敗したら仕方ない
@@ -84,7 +84,7 @@ function checkMovieTicket(params) {
84
84
  throw errors[0];
85
85
  }
86
86
  const result = {};
87
- await repos.actions.checkMovieTicket.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result, recipe });
87
+ await repos.actions.checkMovieTicket.completeCheckMovieTicketAction({ typeOf: actionAttributes.typeOf, id: action.id, result, recipe });
88
88
  return { result: processPurchaseNumberAuthResult };
89
89
  };
90
90
  }
@@ -121,58 +121,28 @@ function checkByIdentifierIfNotYet(params) {
121
121
  }
122
122
  const specifiedCheckedActionId = params.checkedAction?.id;
123
123
  if (typeof specifiedCheckedActionId === 'string' && specifiedCheckedActionId !== '') {
124
- alreadyCheckedAction = (await repos.actions.checkMovieTicket.findCompletedCheckActions({
125
- // limit: 1,
126
- // page: 1,
127
- // id: { $in: [specifiedCheckedActionId] },
124
+ alreadyCheckedAction = await repos.actions.checkMovieTicket.findCompletedCheckMovieTicketAction({
128
125
  id: specifiedCheckedActionId,
129
- // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
130
- // ...(typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined
131
- ...(typeof placeOrderId === 'string') ? { purpose: { id: placeOrderId } } : undefined
132
- })).shift();
133
- if (alreadyCheckedAction === undefined) {
126
+ purpose: { id: placeOrderId }
127
+ });
128
+ if (typeof alreadyCheckedAction?.id !== 'string') {
134
129
  throw new factory_1.factory.errors.NotFound(factory_1.factory.actionType.CheckAction);
135
130
  }
136
131
  }
137
132
  else {
138
133
  // 認証IDの未指定ケースは廃止(2026-03-21~)
139
134
  throw new factory_1.factory.errors.ArgumentNull('checkedAction.id');
140
- // // 認証IDの未指定ケースがあるかどうか確認するためにlog
141
- // console.log('checkByIdentifierIfNotYet: specifiedCheckedActionId undefined. params:', JSON.stringify(params));
142
- // alreadyCheckedAction = (await repos.checkMovieTicketAction.findCompletedCheckActions(
143
- // {
144
- // // limit: 1,
145
- // // page: 1,
146
- // sort: { startDate: factory.sortType.Descending },
147
- // // typeOf: { $eq: factory.actionType.CheckAction },
148
- // // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
149
- // object: {
150
- // typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
151
- // id: { $eq: params.paymentServiceId }, // 指定の決済サービスにおいて
152
- // movieTickets: {
153
- // identifier: { $eq: params.movieTicketIdentifier }, // 指定の決済カードコードを
154
- // serviceOutput: {
155
- // reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
156
- // }
157
- // }
158
- // },
159
- // // ...(typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined
160
- // ...(typeof placeOrderId === 'string') ? { purpose: { id: placeOrderId } } : undefined
161
- // }
162
- // )).shift();
163
135
  }
164
136
  debug('checkByIdentifierIfNotYet: alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'params:', JSON.stringify(params));
165
- if (alreadyCheckedAction !== undefined) {
166
- const recipe = await repos.actions.checkMovieTicket.findRecipeByAction({
167
- project: { id: params.screeningEvent.project.id },
168
- recipeFor: { id: alreadyCheckedAction.id }
169
- });
170
- const directionPurchaseNumberAuth = recipe?.step[0]?.itemListElement[0]?.itemListElement[0];
171
- if (directionPurchaseNumberAuth !== undefined) {
172
- const { beforeMedia, afterMedia } = directionPurchaseNumberAuth;
173
- if (beforeMedia !== undefined && afterMedia !== undefined) {
174
- checkResult = { purchaseNumberAuthIn: beforeMedia, purchaseNumberAuthResult: afterMedia };
175
- }
137
+ const recipe = await repos.actions.checkMovieTicket.findRecipeByAction({
138
+ project: { id: params.screeningEvent.project.id },
139
+ recipeFor: { id: alreadyCheckedAction.id }
140
+ });
141
+ const directionPurchaseNumberAuth = recipe?.step[0]?.itemListElement[0]?.itemListElement[0];
142
+ if (directionPurchaseNumberAuth !== undefined) {
143
+ const { beforeMedia, afterMedia } = directionPurchaseNumberAuth;
144
+ if (beforeMedia !== undefined && afterMedia !== undefined) {
145
+ checkResult = { purchaseNumberAuthIn: beforeMedia, purchaseNumberAuthResult: afterMedia };
176
146
  }
177
147
  }
178
148
  if (checkResult === undefined) {
package/package.json CHANGED
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "26.1.0-alpha.0"
91
+ "version": "26.1.0-alpha.1"
92
92
  }