@chevre/domain 22.11.0-alpha.6 → 22.11.0-alpha.8

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.
@@ -47,6 +47,7 @@ async function main() {
47
47
  'admin.sellers.events.update',
48
48
  'admin.sellers.orders.read',
49
49
  'admin.sellers.reservations.read',
50
+ 'admin.sellers.reservations.useActions.read',
50
51
  'admin.sellers.assetTransactions.cancelReservation.write'
51
52
  ];
52
53
  for (const roleName of roleNames) {
@@ -92,7 +93,8 @@ async function main() {
92
93
  'admin.sellers.orders.read',
93
94
  'admin.sellers.orders.update',
94
95
  'admin.sellers.reservations.read',
95
- 'admin.sellers.reservations.attended',
96
+ 'admin.sellers.reservations.useActions.read',
97
+ 'admin.sellers.reservations.useActions.create',
96
98
  'admin.sellers.assetTransactions.cancelReservation.write'
97
99
  ];
98
100
  for (const roleName of roleNames) {
@@ -110,7 +112,8 @@ async function main() {
110
112
  ];
111
113
  permissions = [
112
114
  'admin.sellers.reservations.read',
113
- 'admin.sellers.reservations.attended'
115
+ 'admin.sellers.reservations.useActions.read',
116
+ 'admin.sellers.reservations.useActions.create'
114
117
  ];
115
118
  for (const roleName of roleNames) {
116
119
  for (const permission of permissions) {
@@ -0,0 +1,37 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../../lib/index';
5
+
6
+ // tslint:disable-next-line:max-func-body-length
7
+ async function main() {
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
+
10
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
11
+
12
+ const roleNames = [
13
+ chevre.factory.role.organizationRole.RoleName.Customer,
14
+ chevre.factory.role.organizationRole.RoleName.InventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.POS,
16
+ chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
17
+ chevre.factory.role.organizationRole.RoleName.SellersOwner,
18
+ chevre.factory.role.organizationRole.RoleName.TicketClerk,
19
+ chevre.factory.role.organizationRole.RoleName.User
20
+ ];
21
+ const permissions = [
22
+ 'db.primary.read'
23
+ ];
24
+ for (const roleName of roleNames) {
25
+ for (const permission of permissions) {
26
+ const result = await roleRepo.addPermissionIfNotExists({
27
+ roleName: { $eq: roleName },
28
+ permission
29
+ });
30
+ console.log('permission added.', result, roleName);
31
+ }
32
+ }
33
+ }
34
+
35
+ main()
36
+ .then()
37
+ .catch(console.error);
@@ -98,11 +98,6 @@ async function main() {
98
98
  mongoose.connection
99
99
  );
100
100
 
101
- // const setting = await settingRepo.findOne(
102
- // { project: { id: { $eq: '*' } } },
103
- // ['useMongoAsStockHolder']
104
- // );
105
- // const useMongoAsStockHolder = setting?.useMongoAsStockHolder === true;
106
101
  let checkingProjects: string[] = [];
107
102
  // 全プロジェクト
108
103
  checkingProjects = (await projectRepo.projectFields(
@@ -18,9 +18,11 @@ async function main() {
18
18
  'project.id': { $eq: '*' }
19
19
  },
20
20
  $unset: {
21
- useMongo4confirmationNumberFrom: 1,
22
- useMongo4orderNumberFrom: 1,
23
- useMongo4transactionNumberFrom: 1
21
+ useMongoAsStockHolder: 1,
22
+ useMongoAsStockHolderProjects: 1
23
+ // useMongo4confirmationNumberFrom: 1,
24
+ // useMongo4orderNumberFrom: 1,
25
+ // useMongo4transactionNumberFrom: 1
24
26
  }
25
27
  });
26
28
  console.log(updateResult);
@@ -287,17 +287,6 @@ class StockHolderRepo {
287
287
  throw new factory.errors.Argument('startDate', 'must be Date');
288
288
  }
289
289
  let useMongoose = false;
290
- // useMongoAsStockHolder設定有の場合のみmongo利用(2025-04-18~)
291
- // const useMongoAsStockHolderBySettings = await this.useMongoAsStockHolderBySettings({ project: { id: params.project.id } });
292
- // if (useMongoAsStockHolderBySettings) {
293
- // const redisKeyExists = await this.redisKeyExists(params);
294
- // if (redisKeyExists) {
295
- // useMongoose = false;
296
- // } else {
297
- // // redis keyが存在しなければmongo利用
298
- // useMongoose = true;
299
- // }
300
- // }
301
290
  // always use mongo(2025-05-21~)
302
291
  const redisKeyExists = yield this.redisKeyExists(params);
303
292
  if (redisKeyExists) {
@@ -19,7 +19,7 @@ const orderNumber_1 = require("../../repo/orderNumber");
19
19
  const project_1 = require("../../repo/project");
20
20
  const reserveInterface_1 = require("../../repo/reserveInterface");
21
21
  const transaction_1 = require("../../repo/transaction");
22
- const transactionProcess_1 = require("../../repo/transactionProcess");
22
+ // import { TransactionProcessRepo } from '../../repo/transactionProcess';
23
23
  const acceptOffer_1 = require("../offer/eventServiceByCOA/acceptOffer");
24
24
  let coaAuthClient;
25
25
  /**
@@ -62,7 +62,7 @@ function call(params) {
62
62
  coaAuthClient = new COA.auth.RefreshToken(Object.assign(Object.assign({}, credentials), (credentialsRepo !== undefined) ? { credentialsRepo } : undefined));
63
63
  }
64
64
  const actionRepo = new action_1.ActionRepo(connection);
65
- const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
65
+ // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
66
66
  try {
67
67
  const reserveService = new COA.service.Reserve({
68
68
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
@@ -128,8 +128,9 @@ function call(params) {
128
128
  }
129
129
  }
130
130
  finally {
131
+ // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
131
132
  // 取引プロセスロック解除
132
- yield transactionProcessRepo.unlock({ typeOf: factory.transactionType.PlaceOrder, id: params.data.purpose.id });
133
+ // await transactionProcessRepo.unlock({ typeOf: factory.transactionType.PlaceOrder, id: params.data.purpose.id });
133
134
  }
134
135
  });
135
136
  }
@@ -29,7 +29,7 @@ const task_1 = require("../../repo/task");
29
29
  const ticket_1 = require("../../repo/ticket");
30
30
  const transaction_1 = require("../../repo/transaction");
31
31
  const transactionNumber_1 = require("../../repo/transactionNumber");
32
- const transactionProcess_1 = require("../../repo/transactionProcess");
32
+ // import { TransactionProcessRepo } from '../../repo/transactionProcess';
33
33
  const any_1 = require("../payment/any");
34
34
  /**
35
35
  * タスク実行関数
@@ -45,7 +45,7 @@ function call(params) {
45
45
  }
46
46
  let callResult;
47
47
  const actionRepo = new action_1.ActionRepo(connection);
48
- const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
48
+ // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
49
49
  const paymentServiceId = params.data.object.issuedThrough.id;
50
50
  const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
51
51
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
@@ -101,7 +101,8 @@ function call(params) {
101
101
  finally {
102
102
  // 取引プロセスロック解除(2024-04-20~)
103
103
  if (params.data.options.useUnlockTransactionProcess) {
104
- yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
104
+ // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
105
+ // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
105
106
  }
106
107
  }
107
108
  if (callResult !== undefined) {
@@ -17,7 +17,7 @@ const event_1 = require("../../repo/event");
17
17
  const paymentService_1 = require("../../repo/paymentService");
18
18
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
19
19
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
20
- const transactionProcess_1 = require("../../repo/transactionProcess");
20
+ // import { TransactionProcessRepo } from '../../repo/transactionProcess';
21
21
  const pay_1 = require("../assetTransaction/pay");
22
22
  /**
23
23
  * タスク実行関数
@@ -33,7 +33,7 @@ function call(params) {
33
33
  return;
34
34
  }
35
35
  const actionRepo = new action_1.ActionRepo(connection);
36
- const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
36
+ // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
37
37
  const paymentServiceId = (_b = params.data.object[0]) === null || _b === void 0 ? void 0 : _b.id;
38
38
  const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
39
39
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
@@ -67,7 +67,8 @@ function call(params) {
67
67
  finally {
68
68
  // 取引プロセスロック解除
69
69
  if (typeof ((_d = params.data.purpose) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
70
- yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
70
+ // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
71
+ // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
71
72
  }
72
73
  }
73
74
  });
@@ -22,7 +22,7 @@ const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
22
22
  const ticket_1 = require("../../repo/ticket");
23
23
  const transaction_1 = require("../../repo/transaction");
24
24
  const transactionNumber_1 = require("../../repo/transactionNumber");
25
- const transactionProcess_1 = require("../../repo/transactionProcess");
25
+ // import { TransactionProcessRepo } from '../../repo/transactionProcess';
26
26
  const any_1 = require("../payment/any");
27
27
  /**
28
28
  * タスク実行関数
@@ -37,7 +37,7 @@ function call(params) {
37
37
  return;
38
38
  }
39
39
  const actionRepo = new action_1.ActionRepo(connection);
40
- const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
40
+ // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
41
41
  try {
42
42
  yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
43
43
  action: actionRepo,
@@ -69,10 +69,9 @@ function call(params) {
69
69
  }
70
70
  }
71
71
  finally {
72
+ // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
72
73
  // 取引プロセスロック解除
73
- // if (params.data.options.useUnlockTransactionProcess) {
74
- yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
75
- // }
74
+ // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
76
75
  }
77
76
  });
78
77
  }
@@ -23,7 +23,7 @@ const setting_1 = require("../../repo/setting");
23
23
  const stockHolder_1 = require("../../repo/stockHolder");
24
24
  const task_1 = require("../../repo/task");
25
25
  const transaction_1 = require("../../repo/transaction");
26
- const transactionProcess_1 = require("../../repo/transactionProcess");
26
+ // import { TransactionProcessRepo } from '../../repo/transactionProcess';
27
27
  let coaAuthClientCreated = false;
28
28
  let coaAuthClient = new COA.auth.RefreshToken({
29
29
  endpoint: '', // 使用されないので空文字でok
@@ -59,7 +59,7 @@ function call(params) {
59
59
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
60
60
  auth: coaAuthClient
61
61
  }, { timeout: settings.coa.timeout });
62
- const transactionProcessRepo = new transactionProcess_1.TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
62
+ // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
63
63
  try {
64
64
  yield (0, voidTransaction_1.voidTransaction)(Object.assign(Object.assign({}, params.data), { project: { id: params.project.id }, sameAs: { id: params.id } }))({
65
65
  action: new action_1.ActionRepo(connection),
@@ -80,7 +80,8 @@ function call(params) {
80
80
  finally {
81
81
  // アクションID指定であれば取引プロセスロック解除(2024-05-26~)
82
82
  if (voidByActionId) {
83
- yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
83
+ // taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
84
+ // await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
84
85
  }
85
86
  }
86
87
  });
package/package.json CHANGED
@@ -113,5 +113,5 @@
113
113
  "postversion": "git push origin --tags",
114
114
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
115
115
  },
116
- "version": "22.11.0-alpha.6"
116
+ "version": "22.11.0-alpha.8"
117
117
  }