@chevre/domain 22.8.0-alpha.9 → 22.8.0

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 (49) hide show
  1. package/example/src/chevre/adminSellerReturnPolicy.ts +102 -0
  2. package/example/src/chevre/{searchActions.ts → searchActionsByOrderNumber.ts} +3 -5
  3. package/example/src/chevre/searchSellersByAggregate.ts +7 -20
  4. package/example/src/chevre/transaction/processPlaceOrder.ts +2 -0
  5. package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
  6. package/lib/chevre/repo/action.d.ts +5 -1
  7. package/lib/chevre/repo/action.js +51 -45
  8. package/lib/chevre/repo/issuer.d.ts +32 -0
  9. package/lib/chevre/repo/issuer.js +150 -0
  10. package/lib/chevre/repo/member.d.ts +4 -5
  11. package/lib/chevre/repo/member.js +19 -9
  12. package/lib/chevre/repo/memberProgram.d.ts +59 -0
  13. package/lib/chevre/repo/memberProgram.js +140 -0
  14. package/lib/chevre/repo/mongoose/schemas/action.js +20 -10
  15. package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +40 -0
  16. package/lib/chevre/repo/mongoose/schemas/issuer.js +56 -0
  17. package/lib/chevre/repo/mongoose/schemas/seller.js +3 -12
  18. package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.d.ts +10 -0
  19. package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.js +92 -0
  20. package/lib/chevre/repo/mongoose/schemas/task.js +0 -66
  21. package/lib/chevre/repo/projectMakesOffer.d.ts +2 -1
  22. package/lib/chevre/repo/projectMakesOffer.js +4 -5
  23. package/lib/chevre/repo/seller.d.ts +1 -1
  24. package/lib/chevre/repo/seller.js +25 -21
  25. package/lib/chevre/repo/sellerReturnPolicy.d.ts +36 -0
  26. package/lib/chevre/repo/sellerReturnPolicy.js +164 -0
  27. package/lib/chevre/repository.d.ts +15 -0
  28. package/lib/chevre/repository.js +41 -2
  29. package/lib/chevre/service/notification.js +3 -2
  30. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -0
  31. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -0
  32. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -0
  33. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +5 -4
  34. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +5 -2
  35. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +20 -10
  36. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +3 -1
  37. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
  38. package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -0
  39. package/lib/chevre/service/order/returnOrder.js +16 -11
  40. package/lib/chevre/service/task/createEvent/createEventBySchedule.js +2 -2
  41. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +8 -0
  42. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +34 -7
  43. package/lib/chevre/service/transaction/placeOrder/start.d.ts +4 -0
  44. package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -0
  45. package/lib/chevre/service/transaction/returnOrder/preStart.js +19 -7
  46. package/lib/chevre/service/transaction/returnOrder.d.ts +2 -0
  47. package/package.json +3 -3
  48. package/example/src/chevre/adminSellerPaymentAccepted.ts +0 -60
  49. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -129
@@ -0,0 +1,102 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+ const IDENTIFIER = 'SellerReturnPolicy:20250117045254:0';
8
+
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const sellerReturnPolicyRepo = await chevre.repository.SellerReturnPolicy.createInstance(mongoose.connection);
13
+
14
+ let policies = await sellerReturnPolicyRepo.projectFields(
15
+ {
16
+ project: { id: { $eq: project.id } },
17
+ identifier: { $eq: IDENTIFIER }
18
+ },
19
+ ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
20
+ );
21
+ console.log('policies:', policies);
22
+ console.log(policies.length, 'policies found');
23
+
24
+ if (policies.length > 0) {
25
+ try {
26
+ await sellerReturnPolicyRepo.deleteById({
27
+ project: { id: policies[0].project.id },
28
+ id: policies[0].id
29
+ });
30
+ console.log('policy deleted', policies[0].id);
31
+ } catch (error) {
32
+ console.error(error);
33
+ }
34
+ }
35
+
36
+ policies = await sellerReturnPolicyRepo.projectFields(
37
+ {
38
+ project: { id: { $eq: project.id } },
39
+ identifier: { $eq: IDENTIFIER }
40
+ },
41
+ ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
42
+ );
43
+ console.log('policies:', policies);
44
+ console.log(policies.length, 'programs found');
45
+
46
+ await sellerReturnPolicyRepo.save({
47
+ attributes: {
48
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
49
+ name: { ja: 'イベント2日前0時まで10円' },
50
+ typeOf: 'MerchantReturnPolicy',
51
+ restockingFee: {
52
+ typeOf: 'MonetaryAmount',
53
+ currency: 'JPY',
54
+ value: 10
55
+ },
56
+ identifier: IDENTIFIER,
57
+ // url: 'https://example.com',
58
+ itemCondition: {
59
+ id: '6466c23f8e7f569b623d876b',
60
+ name: {
61
+ ja: 'イベント2日前0時まで'
62
+ },
63
+ typeOf: 'OfferItemCondition'
64
+ },
65
+ merchantReturnDays: 100,
66
+ applicablePaymentMethod: [
67
+ 'au',
68
+ 'CreditCard',
69
+ 'CreditCardBySPS',
70
+ 'MGTicket',
71
+ 'MovieTicket',
72
+ 'PayPay',
73
+ 'CreditCard3DS'
74
+ ]
75
+ }
76
+ });
77
+ console.log('program created');
78
+
79
+ policies = await sellerReturnPolicyRepo.projectFields(
80
+ {
81
+ project: { id: { $eq: project.id } },
82
+ identifier: { $eq: IDENTIFIER }
83
+ },
84
+ ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
85
+ );
86
+ console.log('policies:', policies);
87
+ console.log(policies.length, 'policies found');
88
+
89
+ policies = await sellerReturnPolicyRepo.projectFields(
90
+ {
91
+ project: { id: { $eq: project.id } },
92
+ restockingFee: { value: { $eq: 10 } }
93
+ },
94
+ ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
95
+ );
96
+ console.log('policies:', policies);
97
+ console.log(policies.length, 'policies found');
98
+ }
99
+
100
+ main()
101
+ .then()
102
+ .catch(console.error);
@@ -13,13 +13,11 @@ async function main() {
13
13
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
14
 
15
15
  const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
- const actions = await actionRepo.search(
16
+ const actions = await actionRepo.searchByOrderNumber(
17
17
  {
18
- limit: 3,
19
- page: 1,
18
+ orderNumber: 'CIN6-4292767-6570494',
20
19
  sort: { startDate: chevre.factory.sortType.Descending }
21
- },
22
- ['startDate']
20
+ }
23
21
  );
24
22
  console.log('actions:', actions);
25
23
  }
@@ -3,7 +3,7 @@ import * as mongoose from 'mongoose';
3
3
 
4
4
  import { chevre } from '../../../lib/index';
5
5
 
6
- // const project = { id: String(process.env.PROJECT_ID) };
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
7
 
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
@@ -12,33 +12,20 @@ async function main() {
12
12
 
13
13
  const sellersByAggregate = await sellerRepo.searchByAggregate(
14
14
  {
15
- limit: 1,
15
+ limit: 10,
16
16
  page: 1,
17
- sort: { branchCode: chevre.factory.sortType.Descending }
17
+ sort: { branchCode: chevre.factory.sortType.Descending },
18
18
  // id: { $eq: '59d20831e53ebc2b4e774466' }
19
- // project: { id: { $eq: project.id } }
19
+ project: { id: { $eq: project.id } }
20
20
  // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
21
21
  // hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
22
22
  },
23
- ['hasMerchantReturnPolicy', 'additionalProperty', 'project', 'name', 'typeOf', 'url', 'telephone']
23
+ ['additionalProperty', 'project', 'name', 'typeOf', 'url', 'telephone']
24
24
  );
25
+ // tslint:disable-next-line:no-null-keyword
26
+ console.dir(sellersByAggregate, { depth: null });
25
27
  console.log('sellers found', sellersByAggregate, sellersByAggregate[0]?.hasMerchantReturnPolicy);
26
28
  console.log(sellersByAggregate.length, 'sellers found');
27
-
28
- const sellers = await sellerRepo.projectFields(
29
- {
30
- limit: 5,
31
- page: 1,
32
- sort: { branchCode: chevre.factory.sortType.Descending },
33
- id: { $eq: '59d20831e53ebc2b4e774466' }
34
- // project: { id: { $eq: project.id } }
35
- // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
36
- // hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
37
- },
38
- ['id', 'typeOf']
39
- );
40
- console.log('sellers found', sellers, sellers[0]?.hasMerchantReturnPolicy);
41
- console.log(sellers.length, 'sellers found');
42
29
  }
43
30
 
44
31
  main()
@@ -35,7 +35,9 @@ async function main() {
35
35
  lockPassport: true
36
36
  }
37
37
  )({
38
+ issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
38
39
  member: await chevre.repository.Member.createInstance(mongoose.connection),
40
+ memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
39
41
  passport: await chevre.repository.Passport.createInstance(
40
42
  client,
41
43
  {
@@ -32,6 +32,7 @@ async function main() {
32
32
  project: await chevre.repository.Project.createInstance(mongoose.connection),
33
33
  reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
34
34
  seller: await chevre.repository.Seller.createInstance(mongoose.connection),
35
+ sellerReturnPolicy: await chevre.repository.SellerReturnPolicy.createInstance(mongoose.connection),
35
36
  transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
36
37
  });
37
38
  console.log(result);
@@ -2,7 +2,7 @@ import { factory as surfrockFactory } from '@surfrock/sdk';
2
2
  import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  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.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
5
- 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.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
5
+ 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.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<any> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
6
6
  interface IAggregationByStatus {
7
7
  actionCount: number;
8
8
  avgDuration: number;
@@ -347,6 +347,7 @@ export declare class ActionRepo {
347
347
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
348
348
  targetCollection?: any;
349
349
  potentialActions?: any;
350
+ about?: any;
350
351
  instrument?: any;
351
352
  location?: any;
352
353
  endDate?: Date | undefined;
@@ -370,6 +371,7 @@ export declare class ActionRepo {
370
371
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
371
372
  targetCollection?: any;
372
373
  potentialActions?: any;
374
+ about?: any;
373
375
  instrument?: any;
374
376
  location?: any;
375
377
  endDate?: Date | undefined;
@@ -395,6 +397,7 @@ export declare class ActionRepo {
395
397
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
396
398
  targetCollection?: any;
397
399
  potentialActions?: any;
400
+ about?: any;
398
401
  instrument?: any;
399
402
  location?: any;
400
403
  endDate?: Date | undefined;
@@ -418,6 +421,7 @@ export declare class ActionRepo {
418
421
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
419
422
  targetCollection?: any;
420
423
  potentialActions?: any;
424
+ about?: any;
421
425
  instrument?: any;
422
426
  location?: any;
423
427
  endDate?: Date | undefined;
@@ -48,7 +48,8 @@ const AVAILABLE_PROJECT_FIELDS = [
48
48
  'replacer',
49
49
  'targetCollection',
50
50
  'sameAs',
51
- 'cancelAction'
51
+ 'cancelAction',
52
+ 'about'
52
53
  ];
53
54
  /**
54
55
  * アクションリポジトリ
@@ -60,7 +61,7 @@ class ActionRepo {
60
61
  }
61
62
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
62
63
  static CREATE_MONGO_CONDITIONS(params) {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68;
64
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72;
64
65
  const andConditions = [];
65
66
  const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
66
67
  if (Array.isArray(idIn)) {
@@ -104,7 +105,11 @@ class ActionRepo {
104
105
  if (typeof instrumentTypeOfEq === 'string') {
105
106
  andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
106
107
  }
107
- const locationIdEq = (_p = (_o = params.location) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
108
+ const instrumentIdentifierEq = (_p = (_o = params.instrument) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
109
+ if (typeof instrumentIdentifierEq === 'string') {
110
+ andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
111
+ }
112
+ const locationIdEq = (_r = (_q = params.location) === null || _q === void 0 ? void 0 : _q.id) === null || _r === void 0 ? void 0 : _r.$eq;
108
113
  if (typeof locationIdEq === 'string') {
109
114
  andConditions.push({
110
115
  'location.id': {
@@ -113,7 +118,7 @@ class ActionRepo {
113
118
  }
114
119
  });
115
120
  }
116
- const locationIdentifierEq = (_r = (_q = params.location) === null || _q === void 0 ? void 0 : _q.identifier) === null || _r === void 0 ? void 0 : _r.$eq;
121
+ const locationIdentifierEq = (_t = (_s = params.location) === null || _s === void 0 ? void 0 : _s.identifier) === null || _t === void 0 ? void 0 : _t.$eq;
117
122
  if (typeof locationIdentifierEq === 'string') {
118
123
  andConditions.push({
119
124
  'location.identifier': {
@@ -122,7 +127,7 @@ class ActionRepo {
122
127
  }
123
128
  });
124
129
  }
125
- const objectMovieTicketsIdentifierEq = (_u = (_t = (_s = params.object) === null || _s === void 0 ? void 0 : _s.movieTickets) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$eq;
130
+ const objectMovieTicketsIdentifierEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.movieTickets) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$eq;
126
131
  if (typeof objectMovieTicketsIdentifierEq === 'string') {
127
132
  andConditions.push({
128
133
  'object.movieTickets.identifier': {
@@ -131,7 +136,7 @@ class ActionRepo {
131
136
  }
132
137
  });
133
138
  }
134
- const objectMovieTicketsServiceOutputReservationForIdEq = (_z = (_y = (_x = (_w = (_v = params.object) === null || _v === void 0 ? void 0 : _v.movieTickets) === null || _w === void 0 ? void 0 : _w.serviceOutput) === null || _x === void 0 ? void 0 : _x.reservationFor) === null || _y === void 0 ? void 0 : _y.id) === null || _z === void 0 ? void 0 : _z.$eq;
139
+ const objectMovieTicketsServiceOutputReservationForIdEq = (_1 = (_0 = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.movieTickets) === null || _y === void 0 ? void 0 : _y.serviceOutput) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
135
140
  if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
136
141
  andConditions.push({
137
142
  'object.movieTickets.serviceOutput.reservationFor.id': {
@@ -140,7 +145,7 @@ class ActionRepo {
140
145
  }
141
146
  });
142
147
  }
143
- const objectPaymentMethodIdEq = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethodId) === null || _1 === void 0 ? void 0 : _1.$eq;
148
+ const objectPaymentMethodIdEq = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.paymentMethodId) === null || _3 === void 0 ? void 0 : _3.$eq;
144
149
  if (typeof objectPaymentMethodIdEq === 'string') {
145
150
  andConditions.push({
146
151
  'object.paymentMethodId': {
@@ -149,7 +154,7 @@ class ActionRepo {
149
154
  }
150
155
  });
151
156
  }
152
- const objectObjectPaymentMethodIdEq = (_4 = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.object) === null || _3 === void 0 ? void 0 : _3.paymentMethodId) === null || _4 === void 0 ? void 0 : _4.$eq;
157
+ const objectObjectPaymentMethodIdEq = (_6 = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.object) === null || _5 === void 0 ? void 0 : _5.paymentMethodId) === null || _6 === void 0 ? void 0 : _6.$eq;
153
158
  if (typeof objectObjectPaymentMethodIdEq === 'string') {
154
159
  andConditions.push({
155
160
  'object.object.paymentMethodId': {
@@ -158,7 +163,7 @@ class ActionRepo {
158
163
  }
159
164
  });
160
165
  }
161
- const objectReservationForIdEq = (_7 = (_6 = (_5 = params.object) === null || _5 === void 0 ? void 0 : _5.reservationFor) === null || _6 === void 0 ? void 0 : _6.id) === null || _7 === void 0 ? void 0 : _7.$eq;
166
+ const objectReservationForIdEq = (_9 = (_8 = (_7 = params.object) === null || _7 === void 0 ? void 0 : _7.reservationFor) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$eq;
162
167
  if (typeof objectReservationForIdEq === 'string') {
163
168
  andConditions.push({
164
169
  'object.reservationFor.id': {
@@ -167,7 +172,7 @@ class ActionRepo {
167
172
  }
168
173
  });
169
174
  }
170
- const objectReservationNumberEq = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.reservationNumber) === null || _9 === void 0 ? void 0 : _9.$eq;
175
+ const objectReservationNumberEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.reservationNumber) === null || _11 === void 0 ? void 0 : _11.$eq;
171
176
  if (typeof objectReservationNumberEq === 'string') {
172
177
  andConditions.push({
173
178
  'object.reservationNumber': {
@@ -176,7 +181,7 @@ class ActionRepo {
176
181
  }
177
182
  });
178
183
  }
179
- const objectReservationNumberIn = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.reservationNumber) === null || _11 === void 0 ? void 0 : _11.$in;
184
+ const objectReservationNumberIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.reservationNumber) === null || _13 === void 0 ? void 0 : _13.$in;
180
185
  if (Array.isArray(objectReservationNumberIn)) {
181
186
  andConditions.push({
182
187
  'object.reservationNumber': {
@@ -185,7 +190,7 @@ class ActionRepo {
185
190
  }
186
191
  });
187
192
  }
188
- const objectPaymentMethodAccountIdEq = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.paymentMethod) === null || _13 === void 0 ? void 0 : _13.accountId) === null || _14 === void 0 ? void 0 : _14.$eq;
193
+ const objectPaymentMethodAccountIdEq = (_16 = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.paymentMethod) === null || _15 === void 0 ? void 0 : _15.accountId) === null || _16 === void 0 ? void 0 : _16.$eq;
189
194
  if (typeof objectPaymentMethodAccountIdEq === 'string') {
190
195
  andConditions.push({
191
196
  'object.paymentMethod.accountId': {
@@ -194,7 +199,7 @@ class ActionRepo {
194
199
  }
195
200
  });
196
201
  }
197
- const objectPaymentMethodPaymentMethodIdEq = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.paymentMethodId) === null || _17 === void 0 ? void 0 : _17.$eq;
202
+ const objectPaymentMethodPaymentMethodIdEq = (_19 = (_18 = (_17 = params.object) === null || _17 === void 0 ? void 0 : _17.paymentMethod) === null || _18 === void 0 ? void 0 : _18.paymentMethodId) === null || _19 === void 0 ? void 0 : _19.$eq;
198
203
  if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
199
204
  andConditions.push({
200
205
  'object.paymentMethod.paymentMethodId': {
@@ -203,7 +208,7 @@ class ActionRepo {
203
208
  }
204
209
  });
205
210
  }
206
- const objectPaymentMethodPaymentMethodIdIn = (_20 = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.paymentMethod) === null || _19 === void 0 ? void 0 : _19.paymentMethodId) === null || _20 === void 0 ? void 0 : _20.$in;
211
+ const objectPaymentMethodPaymentMethodIdIn = (_22 = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.paymentMethod) === null || _21 === void 0 ? void 0 : _21.paymentMethodId) === null || _22 === void 0 ? void 0 : _22.$in;
207
212
  if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
208
213
  andConditions.push({
209
214
  'object.paymentMethod.paymentMethodId': {
@@ -212,7 +217,7 @@ class ActionRepo {
212
217
  }
213
218
  });
214
219
  }
215
- const objectPaymentMethodTypeOfEq = (_23 = (_22 = (_21 = params.object) === null || _21 === void 0 ? void 0 : _21.paymentMethod) === null || _22 === void 0 ? void 0 : _22.typeOf) === null || _23 === void 0 ? void 0 : _23.$eq;
220
+ const objectPaymentMethodTypeOfEq = (_25 = (_24 = (_23 = params.object) === null || _23 === void 0 ? void 0 : _23.paymentMethod) === null || _24 === void 0 ? void 0 : _24.typeOf) === null || _25 === void 0 ? void 0 : _25.$eq;
216
221
  if (typeof objectPaymentMethodTypeOfEq === 'string') {
217
222
  andConditions.push({
218
223
  'object.paymentMethod.typeOf': {
@@ -221,7 +226,7 @@ class ActionRepo {
221
226
  }
222
227
  });
223
228
  }
224
- const objectTypeOfEq = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.typeOf) === null || _25 === void 0 ? void 0 : _25.$eq;
229
+ const objectTypeOfEq = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.typeOf) === null || _27 === void 0 ? void 0 : _27.$eq;
225
230
  if (typeof objectTypeOfEq === 'string') {
226
231
  andConditions.push({
227
232
  'object.typeOf': {
@@ -230,7 +235,7 @@ class ActionRepo {
230
235
  }
231
236
  });
232
237
  }
233
- const objectTypeOfIn = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.typeOf) === null || _27 === void 0 ? void 0 : _27.$in;
238
+ const objectTypeOfIn = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$in;
234
239
  if (Array.isArray(objectTypeOfIn)) {
235
240
  andConditions.push({
236
241
  'object.typeOf': {
@@ -239,7 +244,7 @@ class ActionRepo {
239
244
  }
240
245
  });
241
246
  }
242
- const objectIdEq = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.id) === null || _29 === void 0 ? void 0 : _29.$eq;
247
+ const objectIdEq = (_31 = (_30 = params.object) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$eq;
243
248
  if (typeof objectIdEq === 'string') {
244
249
  andConditions.push({
245
250
  'object.id': {
@@ -248,7 +253,7 @@ class ActionRepo {
248
253
  }
249
254
  });
250
255
  }
251
- const objectIdIn = (_31 = (_30 = params.object) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$in;
256
+ const objectIdIn = (_33 = (_32 = params.object) === null || _32 === void 0 ? void 0 : _32.id) === null || _33 === void 0 ? void 0 : _33.$in;
252
257
  if (Array.isArray(objectIdIn)) {
253
258
  andConditions.push({
254
259
  'object.id': {
@@ -257,7 +262,7 @@ class ActionRepo {
257
262
  }
258
263
  });
259
264
  }
260
- const objectOrderNumberIn = (_33 = (_32 = params.object) === null || _32 === void 0 ? void 0 : _32.orderNumber) === null || _33 === void 0 ? void 0 : _33.$in;
265
+ const objectOrderNumberIn = (_35 = (_34 = params.object) === null || _34 === void 0 ? void 0 : _34.orderNumber) === null || _35 === void 0 ? void 0 : _35.$in;
261
266
  if (Array.isArray(objectOrderNumberIn)) {
262
267
  andConditions.push({
263
268
  'object.orderNumber': {
@@ -266,7 +271,7 @@ class ActionRepo {
266
271
  }
267
272
  });
268
273
  }
269
- const objectEventIdIn = (_36 = (_35 = (_34 = params.object) === null || _34 === void 0 ? void 0 : _34.event) === null || _35 === void 0 ? void 0 : _35.id) === null || _36 === void 0 ? void 0 : _36.$in;
274
+ const objectEventIdIn = (_38 = (_37 = (_36 = params.object) === null || _36 === void 0 ? void 0 : _36.event) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$in;
270
275
  if (Array.isArray(objectEventIdIn)) {
271
276
  andConditions.push({
272
277
  'object.event.id': {
@@ -286,7 +291,7 @@ class ActionRepo {
286
291
  // }
287
292
  // });
288
293
  // }
289
- const objectTransactionNumberEq = (_38 = (_37 = params.object) === null || _37 === void 0 ? void 0 : _37.transactionNumber) === null || _38 === void 0 ? void 0 : _38.$eq;
294
+ const objectTransactionNumberEq = (_40 = (_39 = params.object) === null || _39 === void 0 ? void 0 : _39.transactionNumber) === null || _40 === void 0 ? void 0 : _40.$eq;
290
295
  if (typeof objectTransactionNumberEq === 'string') {
291
296
  andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
292
297
  }
@@ -296,14 +301,14 @@ class ActionRepo {
296
301
  });
297
302
  }
298
303
  else {
299
- const typeOfEq = (_39 = params.typeOf) === null || _39 === void 0 ? void 0 : _39.$eq;
304
+ const typeOfEq = (_41 = params.typeOf) === null || _41 === void 0 ? void 0 : _41.$eq;
300
305
  if (typeof typeOfEq === 'string') {
301
306
  andConditions.push({
302
307
  typeOf: { $eq: typeOfEq }
303
308
  });
304
309
  }
305
310
  }
306
- const actionStatusIn = (_40 = params.actionStatus) === null || _40 === void 0 ? void 0 : _40.$in;
311
+ const actionStatusIn = (_42 = params.actionStatus) === null || _42 === void 0 ? void 0 : _42.$in;
307
312
  if (Array.isArray(actionStatusIn)) {
308
313
  andConditions.push({
309
314
  actionStatus: { $in: actionStatusIn }
@@ -326,7 +331,7 @@ class ActionRepo {
326
331
  startDate: { $lte: startDateLte }
327
332
  });
328
333
  }
329
- const fromLocationTypeOfIn = (_42 = (_41 = params.fromLocation) === null || _41 === void 0 ? void 0 : _41.typeOf) === null || _42 === void 0 ? void 0 : _42.$in;
334
+ const fromLocationTypeOfIn = (_44 = (_43 = params.fromLocation) === null || _43 === void 0 ? void 0 : _43.typeOf) === null || _44 === void 0 ? void 0 : _44.$in;
330
335
  if (Array.isArray(fromLocationTypeOfIn)) {
331
336
  andConditions.push({
332
337
  'fromLocation.typeOf': {
@@ -335,7 +340,7 @@ class ActionRepo {
335
340
  }
336
341
  });
337
342
  }
338
- const fromLocationAccountNumberIn = (_44 = (_43 = params.fromLocation) === null || _43 === void 0 ? void 0 : _43.accountNumber) === null || _44 === void 0 ? void 0 : _44.$in;
343
+ const fromLocationAccountNumberIn = (_46 = (_45 = params.fromLocation) === null || _45 === void 0 ? void 0 : _45.accountNumber) === null || _46 === void 0 ? void 0 : _46.$in;
339
344
  if (Array.isArray(fromLocationAccountNumberIn)) {
340
345
  andConditions.push({
341
346
  'fromLocation.accountNumber': {
@@ -344,7 +349,7 @@ class ActionRepo {
344
349
  }
345
350
  });
346
351
  }
347
- const fromLocationAccountTypeIn = (_46 = (_45 = params.fromLocation) === null || _45 === void 0 ? void 0 : _45.accountType) === null || _46 === void 0 ? void 0 : _46.$in;
352
+ const fromLocationAccountTypeIn = (_48 = (_47 = params.fromLocation) === null || _47 === void 0 ? void 0 : _47.accountType) === null || _48 === void 0 ? void 0 : _48.$in;
348
353
  if (Array.isArray(fromLocationAccountTypeIn)) {
349
354
  andConditions.push({
350
355
  'fromLocation.accountType': {
@@ -353,7 +358,7 @@ class ActionRepo {
353
358
  }
354
359
  });
355
360
  }
356
- const toLocationTypeOfIn = (_48 = (_47 = params.toLocation) === null || _47 === void 0 ? void 0 : _47.typeOf) === null || _48 === void 0 ? void 0 : _48.$in;
361
+ const toLocationTypeOfIn = (_50 = (_49 = params.toLocation) === null || _49 === void 0 ? void 0 : _49.typeOf) === null || _50 === void 0 ? void 0 : _50.$in;
357
362
  if (Array.isArray(toLocationTypeOfIn)) {
358
363
  andConditions.push({
359
364
  'toLocation.typeOf': {
@@ -362,7 +367,7 @@ class ActionRepo {
362
367
  }
363
368
  });
364
369
  }
365
- const toLocationAccountNumberIn = (_50 = (_49 = params.toLocation) === null || _49 === void 0 ? void 0 : _49.accountNumber) === null || _50 === void 0 ? void 0 : _50.$in;
370
+ const toLocationAccountNumberIn = (_52 = (_51 = params.toLocation) === null || _51 === void 0 ? void 0 : _51.accountNumber) === null || _52 === void 0 ? void 0 : _52.$in;
366
371
  if (Array.isArray(toLocationAccountNumberIn)) {
367
372
  andConditions.push({
368
373
  'toLocation.accountNumber': {
@@ -371,7 +376,7 @@ class ActionRepo {
371
376
  }
372
377
  });
373
378
  }
374
- const toLocationAccountTypeIn = (_52 = (_51 = params.toLocation) === null || _51 === void 0 ? void 0 : _51.accountType) === null || _52 === void 0 ? void 0 : _52.$in;
379
+ const toLocationAccountTypeIn = (_54 = (_53 = params.toLocation) === null || _53 === void 0 ? void 0 : _53.accountType) === null || _54 === void 0 ? void 0 : _54.$in;
375
380
  if (Array.isArray(toLocationAccountTypeIn)) {
376
381
  andConditions.push({
377
382
  'toLocation.accountType': {
@@ -380,7 +385,7 @@ class ActionRepo {
380
385
  }
381
386
  });
382
387
  }
383
- const purposeTypeOfIn = (_54 = (_53 = params.purpose) === null || _53 === void 0 ? void 0 : _53.typeOf) === null || _54 === void 0 ? void 0 : _54.$in;
388
+ const purposeTypeOfIn = (_56 = (_55 = params.purpose) === null || _55 === void 0 ? void 0 : _55.typeOf) === null || _56 === void 0 ? void 0 : _56.$in;
384
389
  if (Array.isArray(purposeTypeOfIn)) {
385
390
  andConditions.push({
386
391
  'purpose.typeOf': {
@@ -389,7 +394,7 @@ class ActionRepo {
389
394
  }
390
395
  });
391
396
  }
392
- const purposeIdIn = (_56 = (_55 = params.purpose) === null || _55 === void 0 ? void 0 : _55.id) === null || _56 === void 0 ? void 0 : _56.$in;
397
+ const purposeIdIn = (_58 = (_57 = params.purpose) === null || _57 === void 0 ? void 0 : _57.id) === null || _58 === void 0 ? void 0 : _58.$in;
393
398
  if (Array.isArray(purposeIdIn)) {
394
399
  andConditions.push({
395
400
  'purpose.id': {
@@ -398,7 +403,7 @@ class ActionRepo {
398
403
  }
399
404
  });
400
405
  }
401
- const purposeOrderNumberIn = (_58 = (_57 = params.purpose) === null || _57 === void 0 ? void 0 : _57.orderNumber) === null || _58 === void 0 ? void 0 : _58.$in;
406
+ const purposeOrderNumberIn = (_60 = (_59 = params.purpose) === null || _59 === void 0 ? void 0 : _59.orderNumber) === null || _60 === void 0 ? void 0 : _60.$in;
402
407
  if (Array.isArray(purposeOrderNumberIn)) {
403
408
  andConditions.push({
404
409
  'purpose.orderNumber': {
@@ -407,7 +412,7 @@ class ActionRepo {
407
412
  }
408
413
  });
409
414
  }
410
- const resultTypeOfIn = (_60 = (_59 = params.result) === null || _59 === void 0 ? void 0 : _59.typeOf) === null || _60 === void 0 ? void 0 : _60.$in;
415
+ const resultTypeOfIn = (_62 = (_61 = params.result) === null || _61 === void 0 ? void 0 : _61.typeOf) === null || _62 === void 0 ? void 0 : _62.$in;
411
416
  if (Array.isArray(resultTypeOfIn)) {
412
417
  andConditions.push({
413
418
  'result.typeOf': {
@@ -416,7 +421,7 @@ class ActionRepo {
416
421
  }
417
422
  });
418
423
  }
419
- const resultIdIn = (_62 = (_61 = params.result) === null || _61 === void 0 ? void 0 : _61.id) === null || _62 === void 0 ? void 0 : _62.$in;
424
+ const resultIdIn = (_64 = (_63 = params.result) === null || _63 === void 0 ? void 0 : _63.id) === null || _64 === void 0 ? void 0 : _64.$in;
420
425
  if (Array.isArray(resultIdIn)) {
421
426
  andConditions.push({
422
427
  'result.id': {
@@ -425,7 +430,7 @@ class ActionRepo {
425
430
  }
426
431
  });
427
432
  }
428
- const resultOrderNumberIn = (_64 = (_63 = params.result) === null || _63 === void 0 ? void 0 : _63.orderNumber) === null || _64 === void 0 ? void 0 : _64.$in;
433
+ const resultOrderNumberIn = (_66 = (_65 = params.result) === null || _65 === void 0 ? void 0 : _65.orderNumber) === null || _66 === void 0 ? void 0 : _66.$in;
429
434
  if (Array.isArray(resultOrderNumberIn)) {
430
435
  andConditions.push({
431
436
  'result.orderNumber': {
@@ -434,7 +439,7 @@ class ActionRepo {
434
439
  }
435
440
  });
436
441
  }
437
- const resultCodeIn = (_66 = (_65 = params.result) === null || _65 === void 0 ? void 0 : _65.code) === null || _66 === void 0 ? void 0 : _66.$in;
442
+ const resultCodeIn = (_68 = (_67 = params.result) === null || _67 === void 0 ? void 0 : _67.code) === null || _68 === void 0 ? void 0 : _68.$in;
438
443
  if (Array.isArray(resultCodeIn)) {
439
444
  andConditions.push({
440
445
  'result.code': {
@@ -444,10 +449,14 @@ class ActionRepo {
444
449
  });
445
450
  }
446
451
  // sameAs(2024-04-23~)
447
- const sameAsIdEq = (_68 = (_67 = params.sameAs) === null || _67 === void 0 ? void 0 : _67.id) === null || _68 === void 0 ? void 0 : _68.$eq;
452
+ const sameAsIdEq = (_70 = (_69 = params.sameAs) === null || _69 === void 0 ? void 0 : _69.id) === null || _70 === void 0 ? void 0 : _70.$eq;
448
453
  if (typeof sameAsIdEq === 'string') {
449
454
  andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
450
455
  }
456
+ const aboutOrderNumberEq = (_72 = (_71 = params.about) === null || _71 === void 0 ? void 0 : _71.orderNumber) === null || _72 === void 0 ? void 0 : _72.$eq;
457
+ if (typeof aboutOrderNumberEq === 'string') {
458
+ andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
459
+ }
451
460
  return andConditions;
452
461
  }
453
462
  /**
@@ -461,11 +470,6 @@ class ActionRepo {
461
470
  if (Array.isArray(inclusion) && inclusion.length > 0) {
462
471
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
463
472
  }
464
- else {
465
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
466
- // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
467
- // }
468
- }
469
473
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
470
474
  const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
471
475
  if (typeof params.limit === 'number' && params.limit > 0) {
@@ -765,8 +769,10 @@ class ActionRepo {
765
769
  var _a;
766
770
  const filter = {
767
771
  $or: [
768
- { 'object.orderNumber': { $eq: params.orderNumber } },
769
- { 'purpose.orderNumber': { $eq: params.orderNumber } }
772
+ { 'object.orderNumber': { $exists: true, $eq: params.orderNumber } },
773
+ { 'purpose.orderNumber': { $exists: true, $eq: params.orderNumber } },
774
+ // consider inform returnAction(2025-01-22~)
775
+ { 'about.orderNumber': { $exists: true, $eq: params.orderNumber } }
770
776
  ]
771
777
  };
772
778
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
@@ -0,0 +1,32 @@
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
+ import { IIssuer, ISearchConditions } from './mongoose/schemas/issuer';
3
+ /**
4
+ * 発行者リポジトリ
5
+ */
6
+ export declare class IssuerRepo {
7
+ private readonly issuerModel;
8
+ constructor(connection: Connection);
9
+ static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<IIssuer>[];
10
+ saveIssuer(params: IIssuer): Promise<{
11
+ id: string;
12
+ }>;
13
+ projectPublicFields(params: ISearchConditions): Promise<Pick<IIssuer, 'id' | 'identifier' | 'project'>[]>;
14
+ findById(params: {
15
+ id: string;
16
+ project: {
17
+ id: string;
18
+ };
19
+ }): Promise<IIssuer>;
20
+ findByIdentifier(params: {
21
+ identifier: string;
22
+ project: {
23
+ id: string;
24
+ };
25
+ }): Promise<IIssuer>;
26
+ deleteById(params: {
27
+ id: string;
28
+ project: {
29
+ id: string;
30
+ };
31
+ }): Promise<void>;
32
+ }