@chevre/domain 26.0.0-alpha.29 → 26.0.0-alpha.30

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.
Files changed (51) hide show
  1. package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
  2. package/lib/chevre/repo/action/inform.d.ts +45 -0
  3. package/lib/chevre/repo/action/inform.js +159 -0
  4. package/lib/chevre/repo/{updateAction.d.ts → action/update.d.ts} +2 -2
  5. package/lib/chevre/repo/{updateAction.js → action/update.js} +4 -4
  6. package/lib/chevre/repo/action.d.ts +1 -1
  7. package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +13 -0
  8. package/lib/chevre/repo/mongoose/schemas/action/inform.js +81 -0
  9. package/lib/chevre/repo/mongoose/schemas/{updateAction.d.ts → action/update.d.ts} +3 -3
  10. package/lib/chevre/repo/mongoose/schemas/{updateAction.js → action/update.js} +4 -4
  11. package/lib/chevre/repository.d.ts +5 -5
  12. package/lib/chevre/repository.js +12 -12
  13. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +4 -2
  14. package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
  15. package/lib/chevre/service/event.d.ts +4 -2
  16. package/lib/chevre/service/event.js +3 -3
  17. package/lib/chevre/service/notification/triggerWebhook.d.ts +4 -2
  18. package/lib/chevre/service/notification/triggerWebhook.js +5 -16
  19. package/lib/chevre/service/offer/onEventChanged.js +0 -2
  20. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +2 -4
  21. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +2 -4
  22. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +2 -4
  23. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -7
  24. package/lib/chevre/service/order/onOrderUpdated/factory.js +0 -3
  25. package/lib/chevre/service/task/deleteTransaction.js +4 -2
  26. package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
  27. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +4 -2
  28. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +3 -3
  29. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +4 -2
  30. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +3 -3
  31. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +4 -2
  32. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +3 -3
  33. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +4 -2
  34. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +3 -3
  35. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +4 -2
  36. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +3 -3
  37. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +4 -2
  38. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +3 -3
  39. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +4 -2
  40. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +3 -3
  41. package/lib/chevre/service/task/onResourceDeleted.js +4 -2
  42. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +0 -1
  43. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
  44. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +0 -1
  45. package/lib/chevre/service/task/onResourceUpdated.js +0 -8
  46. package/lib/chevre/service/task/syncResourcesFromCOA.js +14 -10
  47. package/lib/chevre/service/task/triggerWebhook.js +4 -2
  48. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +0 -1
  49. package/lib/chevre/service/transaction/deleteTransaction.d.ts +4 -2
  50. package/lib/chevre/service/transaction/deleteTransaction.js +3 -3
  51. package/package.json +2 -2
@@ -3,7 +3,7 @@ import { factory } from '../../factory';
3
3
  import { IModel as IActionModel } from '../mongoose/schemas/action';
4
4
  import { IModel as IActionRecipeModel } from '../mongoose/schemas/actionRecipe';
5
5
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
6
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
6
+ export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction & {
7
7
  error?: any;
8
8
  purpose?: never;
9
9
  } : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
@@ -0,0 +1,45 @@
1
+ import { Connection, FilterQuery } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { IDocType } from '../mongoose/schemas/action/inform';
4
+ type StartableActionType = factory.actionType.InformAction;
5
+ type IAction = IDocType & {
6
+ id: string;
7
+ };
8
+ type IKeyOfProjection = keyof IDocType;
9
+ type IFindParams = Pick<factory.action.ISearchConditions, 'limit' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough'> & {
10
+ id?: string;
11
+ object?: {
12
+ id?: string;
13
+ orderNumber?: string;
14
+ };
15
+ about?: {
16
+ orderNumber?: string;
17
+ };
18
+ };
19
+ /**
20
+ * 通知アクションリポジトリ
21
+ */
22
+ export declare class InformActionRepo {
23
+ private readonly informActionModel;
24
+ constructor(connection: Connection);
25
+ static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<IDocType>[];
26
+ /**
27
+ * アクション開始
28
+ */
29
+ startInformAction(attributes: factory.action.interact.inform.IAttributes): Promise<Pick<IAction, 'id' | 'typeOf' | 'startDate'>>;
30
+ completeInformAction(params: {
31
+ typeOf: StartableActionType;
32
+ id: string;
33
+ result: factory.action.interact.inform.IResult;
34
+ }): Promise<void>;
35
+ /**
36
+ * アクション失敗
37
+ */
38
+ giveUpInformAction(params: {
39
+ typeOf: StartableActionType;
40
+ id: string;
41
+ error: Error | Error[] | unknown;
42
+ }): Promise<void>;
43
+ findInformActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction[]>;
44
+ }
45
+ export {};
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InformActionRepo = void 0;
4
+ const factory_1 = require("../../factory");
5
+ const settings_1 = require("../../settings");
6
+ const inform_1 = require("../mongoose/schemas/action/inform");
7
+ const AVAILABLE_PROJECT_FIELDS = [
8
+ 'project',
9
+ 'actionStatus',
10
+ 'typeOf',
11
+ 'agent',
12
+ 'result',
13
+ 'error',
14
+ 'object',
15
+ 'startDate',
16
+ 'endDate',
17
+ 'about',
18
+ 'purpose',
19
+ 'recipient',
20
+ 'target'
21
+ ];
22
+ // 内部で正規化関数を定義(または外部ヘルパーを呼び出す)
23
+ function unknown2actionError(e) {
24
+ if (e instanceof Error) {
25
+ // Errorオブジェクトの場合は、既存のロジック通り展開
26
+ return { ...e, name: e.name, message: e.message };
27
+ }
28
+ else {
29
+ // Error以外(文字列など)が投げられた場合のハンドリング
30
+ return { name: 'UnknownError', message: String(e) };
31
+ }
32
+ }
33
+ ;
34
+ /**
35
+ * 通知アクションリポジトリ
36
+ */
37
+ class InformActionRepo {
38
+ informActionModel;
39
+ constructor(connection) {
40
+ this.informActionModel = connection.model(inform_1.modelName, (0, inform_1.createSchema)());
41
+ }
42
+ static CREATE_MONGO_CONDITIONS(params) {
43
+ const andConditions = [];
44
+ const idEq = params.id;
45
+ if (typeof idEq === 'string') {
46
+ andConditions.push({ _id: { $eq: idEq } });
47
+ }
48
+ const projectIdEq = params.project?.id?.$eq;
49
+ if (typeof projectIdEq === 'string') {
50
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
51
+ }
52
+ const objectIdEq = params.object?.id;
53
+ if (typeof objectIdEq === 'string') {
54
+ andConditions.push({ 'object.id': { $exists: true, $eq: objectIdEq } });
55
+ }
56
+ const objectOrderNumberEq = params.object?.orderNumber;
57
+ if (typeof objectOrderNumberEq === 'string') {
58
+ andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
59
+ }
60
+ const aboutOrderNumberEq = params.about?.orderNumber;
61
+ if (typeof aboutOrderNumberEq === 'string') {
62
+ andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
63
+ }
64
+ const startDateGte = params.startFrom;
65
+ if (startDateGte instanceof Date) {
66
+ andConditions.push({ startDate: { $gte: startDateGte } });
67
+ }
68
+ const startDateLte = params.startThrough;
69
+ if (startDateLte instanceof Date) {
70
+ andConditions.push({ startDate: { $lte: startDateLte } });
71
+ }
72
+ return andConditions;
73
+ }
74
+ /**
75
+ * アクション開始
76
+ */
77
+ async startInformAction(attributes) {
78
+ const startDate = new Date();
79
+ const creatingAction = {
80
+ ...attributes,
81
+ actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
82
+ startDate
83
+ };
84
+ const result = await this.informActionModel.insertMany(creatingAction, { rawResult: true });
85
+ const id = result.insertedIds?.[0]?.toHexString();
86
+ if (typeof id !== 'string') {
87
+ throw new factory_1.factory.errors.Internal('action not saved');
88
+ }
89
+ return { id, startDate, typeOf: creatingAction.typeOf };
90
+ }
91
+ async completeInformAction(params) {
92
+ const doc = await this.informActionModel.findOneAndUpdate({
93
+ _id: { $eq: params.id },
94
+ typeOf: { $eq: params.typeOf }
95
+ }, {
96
+ $set: {
97
+ actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
98
+ result: params.result,
99
+ endDate: new Date()
100
+ }
101
+ }, { new: false, projection: { _id: 1 } })
102
+ .lean()
103
+ .exec();
104
+ if (doc === null) {
105
+ throw new factory_1.factory.errors.NotFound(this.informActionModel.modelName);
106
+ }
107
+ }
108
+ /**
109
+ * アクション失敗
110
+ */
111
+ async giveUpInformAction(params) {
112
+ const actionError = Array.isArray(params.error)
113
+ ? params.error.map(unknown2actionError)
114
+ : unknown2actionError(params.error);
115
+ const doc = await this.informActionModel.findOneAndUpdate({
116
+ typeOf: { $eq: params.typeOf },
117
+ _id: { $eq: params.id }
118
+ }, {
119
+ $set: {
120
+ actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
121
+ error: actionError,
122
+ endDate: new Date()
123
+ }
124
+ }, { new: true, projection: { _id: 1 } })
125
+ .lean()
126
+ .exec();
127
+ if (doc === null) {
128
+ throw new factory_1.factory.errors.NotFound(this.informActionModel.modelName);
129
+ }
130
+ }
131
+ async findInformActions(params, inclusion) {
132
+ const conditions = InformActionRepo.CREATE_MONGO_CONDITIONS(params);
133
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
134
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
135
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
136
+ }
137
+ const projection = {
138
+ _id: 0,
139
+ id: { $toString: '$_id' },
140
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
141
+ };
142
+ const query = this.informActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
143
+ if (typeof params.limit === 'number' && params.limit > 0) {
144
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
145
+ query.limit(params.limit)
146
+ .skip(params.limit * (page - 1));
147
+ }
148
+ /* istanbul ignore else */
149
+ if (params.sort?.startDate !== undefined) {
150
+ query.sort({ startDate: params.sort.startDate });
151
+ }
152
+ // const explainResult = await (<any>query).explain();
153
+ // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
154
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
155
+ .lean() // 2024-08-26~
156
+ .exec();
157
+ }
158
+ }
159
+ exports.InformActionRepo = InformActionRepo;
@@ -1,6 +1,6 @@
1
1
  import { Connection, FilterQuery } from 'mongoose';
2
- import { factory } from '../factory';
3
- import { IDocType } from './mongoose/schemas/updateAction';
2
+ import { factory } from '../../factory';
3
+ import { IDocType } from '../mongoose/schemas/action/update';
4
4
  type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction;
5
5
  type IAction<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : never;
6
6
  type IKeyOfProjection = keyof IDocType;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateActionRepo = void 0;
4
- const factory_1 = require("../factory");
5
- const settings_1 = require("../settings");
6
- const updateAction_1 = require("./mongoose/schemas/updateAction");
4
+ const factory_1 = require("../../factory");
5
+ const settings_1 = require("../../settings");
6
+ const update_1 = require("../mongoose/schemas/action/update");
7
7
  const AVAILABLE_PROJECT_FIELDS = [
8
8
  'project',
9
9
  'actionStatus',
@@ -36,7 +36,7 @@ function unknown2actionError(e) {
36
36
  class UpdateActionRepo {
37
37
  updateActionModel;
38
38
  constructor(connection) {
39
- this.updateActionModel = connection.model(updateAction_1.modelName, (0, updateAction_1.createSchema)());
39
+ this.updateActionModel = connection.model(update_1.modelName, (0, update_1.createSchema)());
40
40
  }
41
41
  static CREATE_MONGO_CONDITIONS(params) {
42
42
  const andConditions = [];
@@ -7,7 +7,7 @@ export { ICancelActionAction };
7
7
  /**
8
8
  * 汎用アクションリポジトリで開始可能なアクションタイプ
9
9
  */
10
- type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction>;
10
+ type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction | factory.actionType.InformAction>;
11
11
  type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds | factory.recipe.RecipeCategory.payCreditCard | factory.recipe.RecipeCategory.payMovieTicket | factory.recipe.RecipeCategory.refundCreditCard | factory.recipe.RecipeCategory.refundMovieTicket>>;
12
12
  export interface IDeleteActionResult {
13
13
  identifier: string;
@@ -0,0 +1,13 @@
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.interact.inform.IAction, 'about' | 'actionStatus' | 'agent' | 'endDate' | 'object' | 'project' | 'recipient' | 'result' | 'startDate' | 'target' | 'typeOf' | 'purpose'> & {
5
+ error?: any;
6
+ };
7
+ type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
8
+ type ISchemaDefinition = SchemaDefinition<IDocType>;
9
+ type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
10
+ declare const modelName = "Action.Inform";
11
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
12
+ declare function createSchema(): ISchema;
13
+ export { createSchema, IDocType, IModel, indexes, modelName };
@@ -0,0 +1,81 @@
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.Inform';
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
+ target: { type: mongoose_1.SchemaTypes.Mixed, required: true },
18
+ recipient: { type: mongoose_1.SchemaTypes.Mixed, required: true },
19
+ result: mongoose_1.SchemaTypes.Mixed,
20
+ error: mongoose_1.SchemaTypes.Mixed,
21
+ endDate: Date,
22
+ about: mongoose_1.SchemaTypes.Mixed,
23
+ purpose: mongoose_1.SchemaTypes.Mixed,
24
+ };
25
+ const schemaOptions = {
26
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
27
+ autoCreate: false,
28
+ collection: 'actions.inform',
29
+ id: true,
30
+ read: 'primary',
31
+ writeConcern: writeConcern_1.writeConcern,
32
+ strict: true,
33
+ strictQuery: false,
34
+ timestamps: false,
35
+ versionKey: false,
36
+ toJSON: {
37
+ getters: false,
38
+ virtuals: false,
39
+ minimize: false,
40
+ versionKey: false
41
+ },
42
+ toObject: {
43
+ getters: false,
44
+ virtuals: true,
45
+ minimize: false,
46
+ versionKey: false
47
+ }
48
+ };
49
+ const indexes = [
50
+ [
51
+ { startDate: 1 },
52
+ {
53
+ name: 'ttlByStartDate',
54
+ expireAfterSeconds: 2592000 // 30 days
55
+ }
56
+ ],
57
+ [
58
+ { 'project.id': 1, startDate: 1 },
59
+ { name: 'projectId' }
60
+ ],
61
+ [
62
+ { typeOf: 1, startDate: 1 },
63
+ { name: 'typeOf' }
64
+ ],
65
+ ];
66
+ exports.indexes = indexes;
67
+ /**
68
+ * 通知アクションスキーマ
69
+ */
70
+ let schema;
71
+ function createSchema() {
72
+ if (schema === undefined) {
73
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
74
+ }
75
+ if (settings_1.MONGO_AUTO_INDEX) {
76
+ indexes.forEach((indexParams) => {
77
+ schema?.index(...indexParams);
78
+ });
79
+ }
80
+ return schema;
81
+ }
@@ -1,12 +1,12 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
- import { IVirtuals } from '../virtuals';
3
- import { factory } from '../../../factory';
2
+ import { IVirtuals } from '../../virtuals';
3
+ import { factory } from '../../../../factory';
4
4
  type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf';
5
5
  type IDocType = Pick<factory.action.update.add.IAction, Keys> | Pick<factory.action.update.replace.IAction, Keys> | Pick<factory.action.update.update.IAction, Keys> | Pick<factory.action.update.deleteAction.IAction, Keys>;
6
6
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
7
7
  type ISchemaDefinition = SchemaDefinition<IDocType>;
8
8
  type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
9
- declare const modelName = "UpdateAction";
9
+ declare const modelName = "Action.Update";
10
10
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
11
11
  declare function createSchema(): ISchema;
12
12
  export { createSchema, IDocType, IModel, indexes, modelName };
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.modelName = exports.indexes = void 0;
4
4
  exports.createSchema = createSchema;
5
5
  const mongoose_1 = require("mongoose");
6
- const writeConcern_1 = require("../writeConcern");
7
- const settings_1 = require("../../../settings");
8
- const modelName = 'UpdateAction';
6
+ const writeConcern_1 = require("../../writeConcern");
7
+ const settings_1 = require("../../../../settings");
8
+ const modelName = 'Action.Update';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
11
  project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
@@ -24,7 +24,7 @@ const schemaDefinition = {
24
24
  const schemaOptions = {
25
25
  autoIndex: settings_1.MONGO_AUTO_INDEX,
26
26
  autoCreate: false,
27
- collection: 'updateActions',
27
+ collection: 'actions.update',
28
28
  id: true,
29
29
  read: 'primary',
30
30
  writeConcern: writeConcern_1.writeConcern,
@@ -103,7 +103,7 @@ import type { PlaceOrderRepo } from './repo/transaction/placeOrder';
103
103
  import type { ReturnOrderRepo } from './repo/transaction/returnOrder';
104
104
  import type { TransactionNumberRepo } from './repo/transactionNumber';
105
105
  import type { TransactionProcessRepo } from './repo/transactionProcess';
106
- import type { UpdateActionRepo } from './repo/updateAction';
106
+ import type { UpdateActionRepo } from './repo/action/update';
107
107
  import type { WebSiteRepo } from './repo/webSite';
108
108
  import type { ConfirmationNumberRepo } from './repo/confirmationNumber';
109
109
  import type { OrderNumberRepo } from './repo/orderNumber';
@@ -165,6 +165,10 @@ export declare namespace action {
165
165
  namespace Refund {
166
166
  function createInstance(...params: ConstructorParameters<typeof RefundActionRepo>): Promise<RefundActionRepo>;
167
167
  }
168
+ type Update = UpdateActionRepo;
169
+ namespace Update {
170
+ function createInstance(...params: ConstructorParameters<typeof UpdateActionRepo>): Promise<UpdateActionRepo>;
171
+ }
168
172
  }
169
173
  export type AdditionalProperty = AdditionalPropertyRepo;
170
174
  export declare namespace AdditionalProperty {
@@ -558,10 +562,6 @@ export declare namespace rateLimit {
558
562
  function createInstance(...params: ConstructorParameters<typeof OfferRateLimitRepo>): Promise<OfferRateLimitRepo>;
559
563
  }
560
564
  }
561
- export type UpdateAction = UpdateActionRepo;
562
- export declare namespace UpdateAction {
563
- function createInstance(...params: ConstructorParameters<typeof UpdateActionRepo>): Promise<UpdateActionRepo>;
564
- }
565
565
  export type WebSite = WebSiteRepo;
566
566
  export declare namespace WebSite {
567
567
  function createInstance(...params: ConstructorParameters<typeof WebSiteRepo>): Promise<WebSiteRepo>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
4
- exports.WebSite = exports.UpdateAction = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
4
+ exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
5
5
  var AcceptedOffer;
6
6
  (function (AcceptedOffer) {
7
7
  let repo;
@@ -158,6 +158,17 @@ var action;
158
158
  }
159
159
  Refund.createInstance = createInstance;
160
160
  })(Refund = action.Refund || (action.Refund = {}));
161
+ let Update;
162
+ (function (Update) {
163
+ let repo;
164
+ async function createInstance(...params) {
165
+ if (repo === undefined) {
166
+ repo = (await import('./repo/action/update.js')).UpdateActionRepo;
167
+ }
168
+ return new repo(...params);
169
+ }
170
+ Update.createInstance = createInstance;
171
+ })(Update = action.Update || (action.Update = {}));
161
172
  })(action || (exports.action = action = {}));
162
173
  var AdditionalProperty;
163
174
  (function (AdditionalProperty) {
@@ -1193,17 +1204,6 @@ var rateLimit;
1193
1204
  Offer.createInstance = createInstance;
1194
1205
  })(Offer = rateLimit.Offer || (rateLimit.Offer = {}));
1195
1206
  })(rateLimit || (exports.rateLimit = rateLimit = {}));
1196
- var UpdateAction;
1197
- (function (UpdateAction) {
1198
- let repo;
1199
- async function createInstance(...params) {
1200
- if (repo === undefined) {
1201
- repo = (await import('./repo/updateAction.js')).UpdateActionRepo;
1202
- }
1203
- return new repo(...params);
1204
- }
1205
- UpdateAction.createInstance = createInstance;
1206
- })(UpdateAction || (exports.UpdateAction = UpdateAction = {}));
1207
1207
  var WebSite;
1208
1208
  (function (WebSite) {
1209
1209
  let repo;
@@ -1,5 +1,5 @@
1
1
  import type { COA } from '@motionpicture/coa-service';
2
- import type { UpdateActionRepo } from '../../repo/updateAction';
2
+ import type { UpdateActionRepo } from '../../repo/action/update';
3
3
  import type { CategoryCodeRepo } from '../../repo/categoryCode';
4
4
  import type { MovieTheaterRepo } from '../../repo/place/movieTheater';
5
5
  import type { ScreeningRoomRepo } from '../../repo/place/screeningRoom';
@@ -9,7 +9,9 @@ import { IImportFromCOAParams } from './factory';
9
9
  type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
10
10
  declare function processUpdateMovieTheater(params: IImportFromCOAParams): (repos: {
11
11
  masterService: COA.service.Master;
12
- updateAction: UpdateActionRepo;
12
+ actions: {
13
+ update: UpdateActionRepo;
14
+ };
13
15
  categoryCode: CategoryCodeRepo;
14
16
  movieTheater: MovieTheaterRepo;
15
17
  screeningRoom: ScreeningRoomRepo;
@@ -20,7 +20,7 @@ function processUpdateMovieTheater(params) {
20
20
  },
21
21
  targetCollection: { typeOf: factory_1.factory.placeType.MovieTheater }
22
22
  };
23
- const action = await repos.updateAction.startUpdateAction(actionAttributes);
23
+ const action = await repos.actions.update.startUpdateAction(actionAttributes);
24
24
  let seller;
25
25
  let movieTheater;
26
26
  let screeningRooms;
@@ -66,7 +66,7 @@ function processUpdateMovieTheater(params) {
66
66
  }
67
67
  catch (error) {
68
68
  try {
69
- await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
69
+ await repos.actions.update.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
70
70
  }
71
71
  catch (__) {
72
72
  // 失敗したら仕方ない
@@ -77,7 +77,7 @@ function processUpdateMovieTheater(params) {
77
77
  screeningRoomsCount: screeningRooms.length,
78
78
  ...(processTime !== undefined) ? { processTime } : undefined
79
79
  };
80
- await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
80
+ await repos.actions.update.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
81
81
  return { seller, movieTheater, screeningRooms };
82
82
  };
83
83
  }
@@ -2,7 +2,7 @@
2
2
  * マスターデータ同期サービス
3
3
  */
4
4
  import type { COA } from '@motionpicture/coa-service';
5
- import type { UpdateActionRepo } from '../repo/updateAction';
5
+ import type { UpdateActionRepo } from '../repo/action/update';
6
6
  import type { CategoryCodeRepo } from '../repo/categoryCode';
7
7
  import type { CreativeWorkRepo } from '../repo/creativeWork';
8
8
  import type { EventRepo } from '../repo/event';
@@ -17,7 +17,9 @@ import { saveScreeningEventSeries } from './event/saveScreeningEventSeries';
17
17
  * イベントをインポートする
18
18
  */
19
19
  declare function importFromCOA(params: IImportFromCOAParams): (repos: {
20
- updateAction: UpdateActionRepo;
20
+ actions: {
21
+ update: UpdateActionRepo;
22
+ };
21
23
  categoryCode: CategoryCodeRepo;
22
24
  creativeWork: CreativeWorkRepo;
23
25
  event: EventRepo;
@@ -70,7 +70,7 @@ function importFromCOA(params) {
70
70
  instrument,
71
71
  targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent }
72
72
  };
73
- const action = await repos.updateAction.startUpdateAction(actionAttributes);
73
+ const action = await repos.actions.update.startUpdateAction(actionAttributes);
74
74
  let savedScreeningEventsCount = 0;
75
75
  let savedScreeningEventSeriesCount = 0;
76
76
  let cancelledIds = [];
@@ -131,7 +131,7 @@ function importFromCOA(params) {
131
131
  }
132
132
  catch (error) {
133
133
  try {
134
- await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
134
+ await repos.actions.update.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
135
135
  }
136
136
  catch (__) {
137
137
  // 失敗したら仕方ない
@@ -144,7 +144,7 @@ function importFromCOA(params) {
144
144
  savedScreeningEventSeriesCount,
145
145
  ...(processTime !== undefined) ? { processTime } : undefined
146
146
  };
147
- await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
147
+ await repos.actions.update.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
148
148
  };
149
149
  }
150
150
  function cancelDeletedEvents(params) {
@@ -1,9 +1,11 @@
1
1
  import { factory } from '../../factory';
2
- import type { ActionRepo } from '../../repo/action';
2
+ import type { InformActionRepo } from '../../repo/action/inform';
3
3
  import type { PotentialActionRepo } from '../../repo/potentialAction';
4
4
  import type { SettingRepo } from '../../repo/setting';
5
5
  interface ITriggerWebhookRepos {
6
- action: ActionRepo;
6
+ actions: {
7
+ inform: InformActionRepo;
8
+ };
7
9
  potentialAction: PotentialActionRepo;
8
10
  setting: SettingRepo;
9
11
  }
@@ -88,18 +88,7 @@ function createInformActionAttributes(params) {
88
88
  const { about, object, purpose, recipient, project, id, typeOf } = params;
89
89
  // redefine recipient(2025-02-15~)
90
90
  let informRecipient;
91
- // let informRecipient: factory.action.interact.inform.IRecipient | factory.action.interact.inform.IRecipientDeprecated = {
92
- // ...recipient
93
- // // url: target.urlTemplate // discontinue(2025-02-15~)
94
- // };
95
- if (recipient?.typeOf === factory_1.factory.organizationType.Corporation && typeof recipient.id === 'string') {
96
- informRecipient = {
97
- id: recipient.id,
98
- name: recipient.name,
99
- typeOf: recipient.typeOf
100
- };
101
- }
102
- else if (recipient?.typeOf === factory_1.factory.creativeWorkType.WebApplication) {
91
+ if (recipient?.typeOf === factory_1.factory.creativeWorkType.WebApplication) {
103
92
  informRecipient = {
104
93
  name: recipient.name,
105
94
  typeOf: recipient.typeOf
@@ -139,9 +128,9 @@ function createInformActionAttributes(params) {
139
128
  project: { id: project.id, typeOf: factory_1.factory.organizationType.Project },
140
129
  recipient: informRecipient,
141
130
  typeOf: factory_1.factory.actionType.InformAction,
131
+ target, // add(2025-02-06~)
142
132
  ...(typeof purpose?.typeOf === 'string') ? { purpose } : undefined,
143
133
  ...(typeof about?.typeOf === 'string') ? { about } : undefined, // add(2025-01-23~)
144
- ...(typeof target?.typeOf === 'string') ? { target } : undefined // add(2025-02-06~)
145
134
  };
146
135
  };
147
136
  }
@@ -159,7 +148,7 @@ function processInformAction(params, options) {
159
148
  const headerIdentifier = options?.triggerWebhook?.headerIdentifier;
160
149
  const { identifier } = params;
161
150
  const informActionAttributes = await createInformActionAttributes(params)(repos);
162
- const action = await repos.action.start(informActionAttributes);
151
+ const action = await repos.actions.inform.startInformAction(informActionAttributes);
163
152
  let result = {};
164
153
  try {
165
154
  const urlTemplate = informActionAttributes.target?.urlTemplate;
@@ -226,13 +215,13 @@ function processInformAction(params, options) {
226
215
  }
227
216
  catch (error) {
228
217
  try {
229
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
218
+ await repos.actions.inform.giveUpInformAction({ typeOf: action.typeOf, id: action.id, error });
230
219
  }
231
220
  catch (__) {
232
221
  // 失敗したら仕方ない
233
222
  }
234
223
  throw error;
235
224
  }
236
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
225
+ await repos.actions.inform.completeInformAction({ typeOf: action.typeOf, id: action.id, result: result });
237
226
  };
238
227
  }