@chevre/domain 24.1.0-alpha.54 → 24.1.0-alpha.55

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,7 +1,4 @@
1
1
  import { factory } from '../../factory';
2
- export type IStartParams = factory.transaction.placeOrder.IStartParamsWithoutDetail & {
3
- broker?: factory.order.IBroker;
4
- };
5
2
  export type IOrderURLGenerator = (order: factory.transaction.placeOrder.IOrderAsResult) => string;
6
3
  export type IResultOrderParams = factory.transaction.placeOrder.IResultOrderParams & {
7
4
  /**
@@ -26,13 +26,7 @@ const schemaDefinition = {
26
26
  underName: mongoose_1.SchemaTypes.Mixed,
27
27
  checkedIn: { type: Boolean, default: false },
28
28
  attended: { type: Boolean, default: false },
29
- additionalProperty: mongoose_1.SchemaTypes.Mixed,
30
- // 以下廃止予定
31
- // bookingAgent: SchemaTypes.Mixed,
32
- // numSeats: Number, // discontinue(2026-05-13~)
33
- // price: SchemaTypes.Mixed, // discontinue(2026-05-13~)
34
- // priceCurrency: String, // discontinue(2026-05-13~)
35
- // issuedThrough: SchemaTypes.Mixed // discontinue(2026-05-13~)
29
+ // additionalProperty: SchemaTypes.Mixed, // 完全に廃止(2026-06-09~)
36
30
  };
37
31
  const schemaOptions = {
38
32
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -91,15 +85,6 @@ const indexes = [
91
85
  { attended: 1, bookingTime: -1 },
92
86
  { name: 'searchByAttended-v3' }
93
87
  ],
94
- // [
95
- // { useActionExists: 1, bookingTime: -1 },
96
- // {
97
- // name: 'searchByUseActionExists',
98
- // partialFilterExpression: {
99
- // useActionExists: { $exists: true }
100
- // }
101
- // }
102
- // ],
103
88
  [
104
89
  { additionalTicketText: 1, bookingTime: -1 },
105
90
  {
@@ -109,24 +94,6 @@ const indexes = [
109
94
  }
110
95
  }
111
96
  ],
112
- // [
113
- // { additionalProperty: 1, bookingTime: -1 },
114
- // {
115
- // name: 'searchByAdditionalProperty-v3',
116
- // partialFilterExpression: {
117
- // additionalProperty: { $exists: true }
118
- // }
119
- // }
120
- // ],
121
- // [
122
- // { 'price.priceComponent.appliesToMovieTicket.identifier': 1, bookingTime: -1 },
123
- // {
124
- // name: 'searchByPriceComponentAppliesToMovieTicketIdentifier',
125
- // partialFilterExpression: {
126
- // 'price.priceComponent.appliesToMovieTicket.identifier': { $exists: true }
127
- // }
128
- // }
129
- // ],
130
97
  [
131
98
  { 'reservationFor.typeOf': 1, bookingTime: -1 },
132
99
  {
@@ -6,5 +6,14 @@ type IVerifiedPassport = factory.waiter.passport.IPassport & {
6
6
  */
7
7
  identifier: string;
8
8
  };
9
- declare function createStartParams(params: factory.transaction.placeOrder.IStartParamsWithoutDetail, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, broker?: factory.order.IBroker, customerType?: string, memeberOfPayload?: factory.transaction.placeOrder.IMemberOfPayload): factory.transaction.placeOrder.IStartParams;
10
- export { AGENT_IDENTIFIER_NAME_PASSPORT, createStartParams };
9
+ type IStartPlaceOrderParams = factory.transaction.placeOrder.IStartParamsWithoutDetail & {
10
+ object: factory.transaction.placeOrder.IStartParamsWithoutDetail['object'] & {
11
+ /**
12
+ * api経由で取引が開始されれば必ず存在するはず
13
+ */
14
+ clientUser: factory.transaction.placeOrder.IClientUserBeforeStart;
15
+ };
16
+ broker?: factory.order.IBroker;
17
+ };
18
+ declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, customerType?: string): factory.transaction.placeOrder.IStartParams;
19
+ export { AGENT_IDENTIFIER_NAME_PASSPORT, createStartParams, IStartPlaceOrderParams };
@@ -5,19 +5,21 @@ exports.createStartParams = createStartParams;
5
5
  const factory_1 = require("../../../../factory");
6
6
  const AGENT_IDENTIFIER_NAME_PASSPORT = 'passport';
7
7
  exports.AGENT_IDENTIFIER_NAME_PASSPORT = AGENT_IDENTIFIER_NAME_PASSPORT;
8
- function createStartParams(params, expiresInSeconds, passport, seller, broker, customerType, memeberOfPayload) {
9
- let clientUser;
8
+ function createStartParams(params, expiresInSeconds, passport, seller,
9
+ // broker?: factory.order.IBroker,
10
+ customerType) {
11
+ const { broker } = params;
12
+ // let clientUser: Omit<factory.clientUser.IClientUser, 'scope' | 'scopes'> | undefined;
10
13
  let instrument;
11
14
  if (typeof params.object.clientUser?.client_id === 'string') {
12
- const { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ } = params.object.clientUser;
13
- clientUser = { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ };
15
+ const { client_id } = params.object.clientUser;
16
+ // const { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ } = params.object.clientUser;
17
+ // clientUser = { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ };
14
18
  instrument = { id: client_id, typeOf: factory_1.factory.creativeWorkType.WebApplication };
15
19
  }
16
20
  const transactionObject = {
17
- // discontinue passportToken(2024-07-05~)
18
- // ...(typeof params.object.passport?.token === 'string') ? { passportToken: params.object.passport.token } : undefined,
19
- ...(typeof passport?.scope === 'string') ? { passport } : undefined,
20
- ...(typeof clientUser?.client_id === 'string') ? { clientUser } : undefined,
21
+ // ...(typeof passport?.scope === 'string') ? { passport } : undefined, // discontinue(2026-06-10~)
22
+ // ...(typeof clientUser?.client_id === 'string') ? { clientUser } : undefined, // discontinue(2026-06-10~)
21
23
  ...(typeof params.object?.name === 'string') ? { name: params.object?.name } : undefined,
22
24
  ...(typeof broker?.typeOf === 'string') ? { broker: broker } : undefined,
23
25
  ...(typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined,
@@ -36,7 +38,7 @@ function createStartParams(params, expiresInSeconds, passport, seller, broker, c
36
38
  ];
37
39
  const agent = {
38
40
  ...params.agent,
39
- ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined,
41
+ // ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined, // discontinue(2026-06-10~)
40
42
  identifier: agentIdentifier
41
43
  };
42
44
  return {
@@ -12,7 +12,7 @@ declare function validateStartRequest(params: {
12
12
  seller: {
13
13
  id: string;
14
14
  };
15
- clientUser?: Omit<factory.clientUser.IClientUser, 'scope' | 'scopes'>;
15
+ clientUser?: factory.transaction.placeOrder.IClientUserBeforeStart;
16
16
  /**
17
17
  * passportによって決定するカスタマータイプ
18
18
  */
@@ -31,6 +31,5 @@ declare function validateStartRequest(params: {
31
31
  }) => Promise<{
32
32
  seller: ISeller;
33
33
  sellerMakesOffer: factory.seller.IMakesOffer;
34
- memeberOfPayload?: factory.transaction.placeOrder.IMemberOfPayload;
35
34
  }>;
36
35
  export { validateStartRequest };
@@ -104,8 +104,8 @@ function validateStartRequest(params) {
104
104
  if (iamMember === undefined) {
105
105
  throw new factory_1.factory.errors.NotFound(factory_1.factory.role.RoleType.OrganizationRole);
106
106
  }
107
- // メンバーシップトークン検証(2024-01-31~)
108
- let memeberOfPayload;
107
+ // // メンバーシップトークン検証(2024-01-31~)
108
+ // let memeberOfPayload: factory.transaction.placeOrder.IMemberOfPayload | undefined;
109
109
  // 適用メンバーシップについてはproject.makesOfferを参照(2025-01-13~)
110
110
  const validMemberProgramIdentifier = projectMakesOffer.validForMemberTier?.isTierOf.identifier;
111
111
  if (typeof validMemberProgramIdentifier === 'string') {
@@ -126,29 +126,18 @@ function validateStartRequest(params) {
126
126
  if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
127
127
  throw new factory_1.factory.errors.NotFound('issuer.tokenSecret');
128
128
  }
129
- memeberOfPayload = await verifyMembershipToken({
129
+ // memeberOfPayload =
130
+ await verifyMembershipToken({
130
131
  secret: issuer.tokenSecret,
131
132
  // issuer: issuer.identifier,
132
133
  issuer: issuer.url, // identifier -> url(2025-05-11~)
133
134
  ...(typeof params.memberOfToken === 'string') ? { token: params.memberOfToken } : undefined
134
135
  });
135
136
  }
136
- // discontinue(2025-01-14~)
137
- // if (Array.isArray(iamMember.member.member)) {
138
- // const verifySecret = iamMember.member.member[0]?.memberOf?.secret; // ひとまず1種類のメンバーシップのみ対応
139
- // const verifyIssuer = iamMember.member.member[0]?.memberOf?.issuer; // ひとまず1種類のメンバーシップのみ対応
140
- // if (typeof verifySecret === 'string') {
141
- // memeberOfPayload = await verifyMembershipToken({
142
- // secret: verifySecret,
143
- // ...(typeof params.memberOfToken === 'string') ? { token: params.memberOfToken } : undefined,
144
- // ...(typeof verifyIssuer === 'string') ? { issuer: verifyIssuer } : undefined
145
- // });
146
- // }
147
- // }
148
137
  return {
149
138
  sellerMakesOffer,
150
139
  seller,
151
- ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined
140
+ // ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined
152
141
  };
153
142
  };
154
143
  }
@@ -5,7 +5,7 @@ import type { PassportRepo } from '../../../repo/passport';
5
5
  import type { ProjectMakesOfferRepo } from '../../../repo/projectMakesOffer';
6
6
  import type { SellerRepo } from '../../../repo/seller';
7
7
  import type { IStartedPlaceOrder, PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
8
- import { PlaceOrderFactory } from '../../../factory/transaction';
8
+ import { IStartPlaceOrderParams } from './start/factory';
9
9
  interface IStartOperationRepos {
10
10
  issuer: IssuerRepo;
11
11
  member: MemberRepo;
@@ -16,12 +16,11 @@ interface IStartOperationRepos {
16
16
  placeOrder: PlaceOrderRepo;
17
17
  }
18
18
  type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
19
- type IStartParams = PlaceOrderFactory.IStartParams;
20
19
  interface IStartOptions {
21
20
  lockPassport: boolean;
22
21
  }
23
22
  /**
24
23
  * 取引開始
25
24
  */
26
- declare function start(params: IStartParams, options: IStartOptions): IStartOperation<IStartedPlaceOrder>;
27
- export { start };
25
+ declare function start(params: IStartPlaceOrderParams, options: IStartOptions): IStartOperation<IStartedPlaceOrder>;
26
+ export { start, IStartPlaceOrderParams };
@@ -10,7 +10,7 @@ const validateStartRequest_1 = require("./start/validateStartRequest");
10
10
  function start(params, options) {
11
11
  return async (repos) => {
12
12
  const { passport, customerType } = await repos.passport.validatePassportTokenIfExist(params);
13
- const { memeberOfPayload, sellerMakesOffer, seller } = await (0, validateStartRequest_1.validateStartRequest)({
13
+ const { sellerMakesOffer, seller } = await (0, validateStartRequest_1.validateStartRequest)({
14
14
  project: { id: params.project.id },
15
15
  seller: { id: params.seller.id },
16
16
  ...(typeof passport?.scope === 'string') ? { customerType } : undefined,
@@ -22,7 +22,7 @@ function start(params, options) {
22
22
  throw new factory_1.factory.errors.NotFound('eligibleTransactionDuration.maxValue');
23
23
  }
24
24
  // 取引ファクトリーで新しい進行中取引オブジェクトを作成
25
- const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, params.broker, customerType, memeberOfPayload);
25
+ const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, customerType);
26
26
  let transaction;
27
27
  // lock passport(2024-07-05~)
28
28
  if (options.lockPassport && passport !== undefined) {
@@ -4,6 +4,6 @@
4
4
  import { POINT_AWARD_IDENTIFIER_NAME } from '../../factory/order';
5
5
  import { confirm } from './placeOrder/confirm';
6
6
  import { exportTasksById } from './placeOrder/exportTasksById';
7
- import { start } from './placeOrder/start';
7
+ import { start, IStartPlaceOrderParams } from './placeOrder/start';
8
8
  import { updateAgent } from './placeOrder/updateAgent';
9
- export { confirm, POINT_AWARD_IDENTIFIER_NAME, start, exportTasksById, updateAgent };
9
+ export { confirm, POINT_AWARD_IDENTIFIER_NAME, start, IStartPlaceOrderParams, exportTasksById, updateAgent };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "8.2.0-alpha.7",
14
+ "@chevre/factory": "8.2.0-alpha.8",
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",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.1.0-alpha.54"
94
+ "version": "24.1.0-alpha.55"
95
95
  }