@chevre/domain 23.2.0-alpha.4 → 23.2.0-alpha.6

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.
@@ -0,0 +1,49 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../../lib/index';
5
+
6
+ async function main() {
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ // chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ // chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ // chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.eventSeries.read'
19
+ ];
20
+ for (const roleName of roleNames) {
21
+ for (const permission of permissions) {
22
+ const result = await roleRepo.addPermissionIfNotExists({
23
+ roleName: { $eq: roleName },
24
+ permission
25
+ });
26
+ console.log('permission added.', result, roleName);
27
+ }
28
+ }
29
+
30
+ // roleNames = [
31
+ // chevre.factory.role.organizationRole.RoleName.TicketClerk
32
+ // ];
33
+ // permissions = [
34
+ // 'admin.sellers.productOffers.read'
35
+ // ];
36
+ // for (const roleName of roleNames) {
37
+ // for (const permission of permissions) {
38
+ // const result = await roleRepo.addPermissionIfNotExists({
39
+ // roleName: { $eq: roleName },
40
+ // permission
41
+ // });
42
+ // console.log('permission added.', result, roleName);
43
+ // }
44
+ // }
45
+ }
46
+
47
+ main()
48
+ .then()
49
+ .catch(console.error);
@@ -50,7 +50,7 @@ class CreativeWorkRepo {
50
50
  }
51
51
  // tslint:disable-next-line:max-func-body-length
52
52
  static CREATE_MONGO_CONDITIONS(params) {
53
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
53
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
54
54
  const andConditions = [
55
55
  { typeOf: { $eq: factory.creativeWorkType.Movie } }
56
56
  ];
@@ -90,12 +90,16 @@ class CreativeWorkRepo {
90
90
  if (Array.isArray(identifierIn)) {
91
91
  andConditions.push({ identifier: { $in: identifierIn } });
92
92
  }
93
+ const identifierRegex = (_k = params.identifier) === null || _k === void 0 ? void 0 : _k.$regex;
94
+ if (typeof identifierRegex === 'string' && identifierRegex !== '') {
95
+ andConditions.push({ identifier: { $regex: new RegExp(identifierRegex) } });
96
+ }
93
97
  }
94
98
  if (typeof params.name === 'string' && params.name.length > 0) {
95
99
  // 多言語名称対応(2022-07-11~)
96
100
  andConditions.push({
97
101
  $or: [
98
- { name: { $exists: true, $regex: new RegExp(params.name) } },
102
+ // { name: { $exists: true, $regex: new RegExp(params.name) } }, // string型への互換性維持を廃止(2025-12-20~)
99
103
  { 'name.ja': { $exists: true, $regex: new RegExp(params.name) } },
100
104
  { 'name.en': { $exists: true, $regex: new RegExp(params.name) } }
101
105
  ]
@@ -111,15 +115,15 @@ class CreativeWorkRepo {
111
115
  if (params.datePublishedThrough !== undefined) {
112
116
  andConditions.push({ datePublished: { $exists: true, $lte: params.datePublishedThrough } });
113
117
  }
114
- const offersAvailableFrom = (_k = params.offers) === null || _k === void 0 ? void 0 : _k.availableFrom;
118
+ const offersAvailableFrom = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.availableFrom;
115
119
  if (offersAvailableFrom instanceof Date) {
116
120
  andConditions.push({ 'offers.availabilityEnds': { $exists: true, $gte: offersAvailableFrom } });
117
121
  }
118
- const offersAvailableThrough = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.availableThrough;
122
+ const offersAvailableThrough = (_m = params.offers) === null || _m === void 0 ? void 0 : _m.availableThrough;
119
123
  if (offersAvailableThrough instanceof Date) {
120
124
  andConditions.push({ 'offers.availabilityStarts': { $exists: true, $lte: offersAvailableThrough } });
121
125
  }
122
- const additionalPropertyElemMatch = (_m = params.additionalProperty) === null || _m === void 0 ? void 0 : _m.$elemMatch;
126
+ const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
123
127
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
124
128
  andConditions.push({
125
129
  additionalProperty: {
@@ -67,15 +67,16 @@ const indexes = [
67
67
  name: 'searchByProjectId-v20220721'
68
68
  }
69
69
  ],
70
- [
71
- { name: 1, identifier: 1 },
72
- {
73
- name: 'searchByName2',
74
- partialFilterExpression: {
75
- name: { $exists: true }
76
- }
77
- }
78
- ],
70
+ // string型への互換性維持を廃止(2025-12-20~
71
+ // [
72
+ // { name: 1, identifier: 1 },
73
+ // {
74
+ // name: 'searchByName2',
75
+ // partialFilterExpression: {
76
+ // name: { $exists: true }
77
+ // }
78
+ // }
79
+ // ],
79
80
  [
80
81
  { 'name.ja': 1, identifier: 1 },
81
82
  {
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": "5.4.0-alpha.8",
14
+ "@chevre/factory": "5.4.0-alpha.9",
15
15
  "@cinerino/sdk": "12.12.1",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "23.2.0-alpha.4"
118
+ "version": "23.2.0-alpha.6"
119
119
  }