@chevre/domain 26.0.0-alpha.37 → 26.0.0-alpha.39

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.
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AcceptCOAOfferActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
6
5
  const actionProcess_1 = require("./actionProcess");
7
6
  /**
8
7
  * COAオファー採用リポジトリ
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AcceptPayActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../../settings';
6
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
7
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
8
5
  const actionProcess_1 = require("./actionProcess");
9
6
  /**
10
7
  * 決済採用リポジトリ
@@ -1,9 +1,10 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import { factory } from '../../factory';
3
- import { IModel as IActionModel } from '../mongoose/schemas/action';
3
+ import { IModel as IActionModel, IDocType } from '../mongoose/schemas/action';
4
4
  import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from './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 : T extends factory.actionType.CreateAction ? factory.action.create.IAction : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
6
+ type IAuthorizeAction = factory.action.authorize.invoice.IAction | factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction | factory.action.authorize.ticketedObject.IAction;
7
+ 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 ? IAuthorizeAction : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IAction : T extends factory.actionType.CreateAction ? factory.action.create.IAction : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
7
8
  export interface ICancelActionAction {
8
9
  typeOf: factory.actionType.CancelAction;
9
10
  agent: factory.action.IParticipantAsPerson | factory.action.IParticipantAsProject | factory.action.IParticipantAsWebApplication;
@@ -15,7 +16,7 @@ export interface ICancelActionAction {
15
16
  };
16
17
  }
17
18
  export { IActionRecipe };
18
- export type IKeyOfProjection = keyof IAction<factory.actionType> | keyof IAction<factory.actionType.AuthorizeAction> | keyof IAction<factory.actionType.ReplaceAction> | 'identifier';
19
+ export type IKeyOfProjection = keyof IDocType | 'id';
19
20
  export declare const AVAILABLE_PROJECT_FIELDS: IKeyOfProjection[];
20
21
  /**
21
22
  * アクション状態管理リポジトリ
@@ -26,6 +26,7 @@ exports.AVAILABLE_PROJECT_FIELDS = [
26
26
  'cancelAction',
27
27
  'about',
28
28
  'identifier',
29
+ 'expires'
29
30
  ];
30
31
  const DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
31
32
  const RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthorizeInvoiceActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../settings';
6
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
7
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
8
5
  const actionProcess_1 = require("./actionProcess");
9
6
  /**
10
7
  * インボイス承認リポジトリ
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthorizeOfferActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../settings';
6
5
  const actionProcess_1 = require("./actionProcess");
7
6
  /**
8
7
  * オファー承認リポジトリ
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthorizePaymentMethodActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../../settings';
6
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
7
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
8
5
  const actionProcess_1 = require("./actionProcess");
9
6
  /**
10
7
  * 決済承認リポジトリ
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthorizeTicketedObjectActionRepo = void 0;
4
- // import { MONGO_MAX_TIME_MS } from '../settings';
5
4
  const actionProcess_1 = require("./actionProcess");
6
5
  /**
7
6
  * 決済とオファー以外に対する汎用承認リポジトリ
@@ -0,0 +1,8 @@
1
+ import { factory } from '../../factory';
2
+ import { ActionProcessRepo } from './actionProcess';
3
+ export type ICreateAction = factory.action.create.IAction;
4
+ /**
5
+ * レポート作成アクションリポジトリ
6
+ */
7
+ export declare class CreateActionRepo extends ActionProcessRepo<ICreateAction, never> {
8
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateActionRepo = void 0;
4
+ const actionProcess_1 = require("./actionProcess");
5
+ /**
6
+ * レポート作成アクションリポジトリ
7
+ */
8
+ class CreateActionRepo extends actionProcess_1.ActionProcessRepo {
9
+ }
10
+ exports.CreateActionRepo = CreateActionRepo;
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PayActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../settings';
6
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
7
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
8
5
  const actionProcess_1 = require("./actionProcess");
9
6
  /**
10
7
  * 決済アクションリポジトリ
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefundActionRepo = void 0;
4
- // import { MONGO_MAX_TIME_MS } from '../settings';
5
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
6
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
7
4
  const actionProcess_1 = require("./actionProcess");
8
5
  /**
9
6
  * 返金アクションリポジトリ
@@ -4,7 +4,7 @@ export { ICancelActionAction };
4
4
  /**
5
5
  * 汎用アクションリポジトリで開始可能なアクションタイプ
6
6
  */
7
- export 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 | factory.actionType.UseAction>;
7
+ export 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 | factory.actionType.UseAction | factory.actionType.CreateAction>;
8
8
  export 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>>;
9
9
  /**
10
10
  * アクションリポジトリ
@@ -57,6 +57,16 @@ const schemaOptions = {
57
57
  }
58
58
  };
59
59
  const indexes = [
60
+ [
61
+ { expires: 1 },
62
+ {
63
+ name: 'expires',
64
+ expireAfterSeconds: 0,
65
+ partialFilterExpression: {
66
+ expires: { $exists: true }
67
+ }
68
+ }
69
+ ],
60
70
  [
61
71
  { startDate: 1 },
62
72
  {
@@ -57,6 +57,16 @@ const schemaOptions = {
57
57
  }
58
58
  };
59
59
  const indexes = [
60
+ [
61
+ { expires: 1 },
62
+ {
63
+ name: 'expires',
64
+ expireAfterSeconds: 0,
65
+ partialFilterExpression: {
66
+ expires: { $exists: true }
67
+ }
68
+ }
69
+ ],
60
70
  [
61
71
  { dateCreated: 1 },
62
72
  {
@@ -1,5 +1,5 @@
1
1
  import { AccountingReportRepo } from '../../repo/accountingReport';
2
2
  import { factory } from '../../factory';
3
- export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'paymentMethods' | 'seller' | 'typeOf' | 'orderDate'> & {}): (repos: {
3
+ export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'paymentMethods' | 'seller' | 'typeOf' | 'orderDate'>): (repos: {
4
4
  accountingReport: AccountingReportRepo;
5
5
  }) => Promise<void>;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
7
- const moment_timezone_1 = __importDefault(require("moment-timezone"));
7
+ const moment_1 = __importDefault(require("moment"));
8
8
  const factory_1 = require("../../factory");
9
9
  function createAccountingReportIfNotExist(params) {
10
10
  return async (repos) => {
@@ -17,61 +17,7 @@ function createAccountingReportIfNotExist(params) {
17
17
  await repos.accountingReport.syncMainEntity(accountingReport);
18
18
  };
19
19
  }
20
- // 最適化(2023-06-30~)
21
20
  function createOrder4report(params) {
22
- // if (!Array.isArray(params.acceptedOffers)) {
23
- // throw new factory.errors.ArgumentNull('order.acceptedOffers');
24
- // }
25
- // const numItems: number = params.acceptedOffers.length;
26
- // // 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
27
- // const acceptedOffers = (Array.isArray(params.acceptedOffers))
28
- // ? params.acceptedOffers.map((o) => {
29
- // if (o.itemOffered.typeOf === factory.reservationType.EventReservation) {
30
- // let itemOffered = o.itemOffered;
31
- // const reservationFor = itemOffered.reservationFor;
32
- // itemOffered = {
33
- // ...itemOffered,
34
- // reservationFor: {
35
- // ...reservationFor,
36
- // ...(reservationFor.doorTime !== undefined)
37
- // ? {
38
- // doorTime: moment(reservationFor.doorTime)
39
- // .toDate()
40
- // }
41
- // : undefined,
42
- // ...(reservationFor.endDate !== undefined)
43
- // ? {
44
- // endDate: moment(reservationFor.endDate)
45
- // .toDate()
46
- // }
47
- // : undefined,
48
- // ...(reservationFor.startDate !== undefined)
49
- // ? {
50
- // startDate: moment(reservationFor.startDate)
51
- // .toDate()
52
- // }
53
- // : undefined
54
- // }
55
- // } as factory.order.IReservation;
56
- // return {
57
- // ...o,
58
- // itemOffered
59
- // };
60
- // } else {
61
- // return o;
62
- // }
63
- // })
64
- // : [];
65
- // const customer: factory.report.accountingReport.IOptimizedCustomer = {
66
- // id: params.customer.id,
67
- // typeOf: params.customer.typeOf,
68
- // additionalProperty: (Array.isArray(params.customer.additionalProperty))
69
- // ? params.customer.additionalProperty
70
- // : [],
71
- // identifier: (Array.isArray(params.customer.identifier))
72
- // ? params.customer.identifier
73
- // : []
74
- // };
75
21
  return {
76
22
  id: params.id,
77
23
  orderNumber: params.orderNumber,
@@ -82,7 +28,7 @@ function createOrder4report(params) {
82
28
  typeOf: params.seller.typeOf
83
29
  },
84
30
  typeOf: params.typeOf,
85
- orderDate: (0, moment_timezone_1.default)(params.orderDate)
31
+ orderDate: (0, moment_1.default)(params.orderDate)
86
32
  .toDate(),
87
33
  // confirmationNumber: params.confirmationNumber, // discontinue(2026-05-06~)
88
34
  // price: params.price, // discontinue(2026-05-06~)
@@ -2,9 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const factory_1 = require("../../factory");
5
- const acceptedOffer_1 = require("../../repo/acceptedOffer");
6
5
  const accountingReport_1 = require("../../repo/accountingReport");
7
- const action_1 = require("../../repo/action");
6
+ const create_1 = require("../../repo/action/create");
8
7
  const order_1 = require("../../repo/order");
9
8
  const createAccountingReportIfNotExist_1 = require("../order/createAccountingReportIfNotExist");
10
9
  /**
@@ -13,9 +12,10 @@ const createAccountingReportIfNotExist_1 = require("../order/createAccountingRep
13
12
  function call(params) {
14
13
  return async ({ connection }) => {
15
14
  await createAccountingReport(params)({
16
- acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
17
15
  accountingReport: new accountingReport_1.AccountingReportRepo(connection),
18
- action: new action_1.ActionRepo(connection),
16
+ actions: {
17
+ create: new create_1.CreateActionRepo(connection)
18
+ },
19
19
  order: new order_1.OrderRepo(connection)
20
20
  });
21
21
  };
@@ -28,10 +28,6 @@ function createAccountingReport(params) {
28
28
  project: { id: params.project.id },
29
29
  inclusion: [
30
30
  'orderNumber', 'project', 'paymentMethods', 'seller', 'typeOf', 'orderDate'
31
- // 'customer', 'confirmationNumber',
32
- // 'orderedItem',
33
- // 'broker',
34
- // 'price', 'priceCurrency',
35
31
  ]
36
32
  });
37
33
  const simpleOrder = {
@@ -51,16 +47,13 @@ function createAccountingReport(params) {
51
47
  purpose: simpleOrder,
52
48
  sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-21~)
53
49
  };
54
- const action = await repos.action.start(actionAttributes);
50
+ const action = await repos.actions.create.start(actionAttributes);
55
51
  try {
56
- await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)({
57
- ...order,
58
- // acceptedOffers
59
- })(repos);
52
+ await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)(repos);
60
53
  }
61
54
  catch (error) {
62
55
  try {
63
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
56
+ await repos.actions.create.giveUp({ typeOf: action.typeOf, id: action.id, error });
64
57
  }
65
58
  catch (__) {
66
59
  // 失敗したら仕方ない
@@ -68,6 +61,6 @@ function createAccountingReport(params) {
68
61
  throw error;
69
62
  }
70
63
  const result = {};
71
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
64
+ await repos.actions.create.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
72
65
  };
73
66
  }
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.3.0-alpha.11",
14
+ "@chevre/factory": "10.3.0-alpha.12",
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": "26.0.0-alpha.37"
91
+ "version": "26.0.0-alpha.39"
92
92
  }