@chevre/domain 21.7.0-alpha.16 → 21.7.0-alpha.17
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.
|
@@ -142,13 +142,19 @@ class MongoRepository {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
findByIdAndIUpdate(params) {
|
|
145
|
-
var _a, _b;
|
|
145
|
+
var _a, _b, _c, _d, _e;
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
147
|
+
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
148
148
|
? { alternateName: params.alternateName }
|
|
149
|
-
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_a = params.settings) === null || _a === void 0 ? void 0 : _a.
|
|
149
|
+
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_c = (_b = (_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendEmailMessage) === null || _b === void 0 ? void 0 : _b.sender) === null || _c === void 0 ? void 0 : _c.email) === 'string')
|
|
150
|
+
? {
|
|
151
|
+
'settings.sendEmailMessage': {
|
|
152
|
+
sender: { email: params.settings.sendEmailMessage.sender.email }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
: undefined), (typeof ((_d = params.settings) === null || _d === void 0 ? void 0 : _d.sendgridApiKey) === 'string')
|
|
150
156
|
? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
|
|
151
|
-
: undefined), (typeof ((
|
|
157
|
+
: undefined), (typeof ((_e = params.subscription) === null || _e === void 0 ? void 0 : _e.useEventServiceAsProduct) === 'boolean')
|
|
152
158
|
? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
|
|
153
159
|
: undefined), {
|
|
154
160
|
// ↓customerUserPoolは廃止
|
|
@@ -24,8 +24,9 @@ const debug = createDebug('chevre-domain:service');
|
|
|
24
24
|
* https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html
|
|
25
25
|
*/
|
|
26
26
|
function sendEmailMessage(params) {
|
|
27
|
+
// tslint:disable-next-line:max-func-body-length
|
|
27
28
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
var _a, _b;
|
|
29
|
+
var _a, _b, _c, _d, _e;
|
|
29
30
|
const project = yield repos.project.findById({
|
|
30
31
|
id: params.project.id,
|
|
31
32
|
inclusion: ['_id', 'settings'],
|
|
@@ -45,6 +46,15 @@ function sendEmailMessage(params) {
|
|
|
45
46
|
}
|
|
46
47
|
sgMail.setApiKey(apiKey);
|
|
47
48
|
const emailMessage = params.object;
|
|
49
|
+
const emailMessageFrom = {
|
|
50
|
+
name: emailMessage.sender.name,
|
|
51
|
+
email: emailMessage.sender.email
|
|
52
|
+
};
|
|
53
|
+
// プロジェクト設定対応(2023-08-21~)
|
|
54
|
+
const senderEmailByProjectSettings = (_d = (_c = (_b = project.settings) === null || _b === void 0 ? void 0 : _b.sendEmailMessage) === null || _c === void 0 ? void 0 : _c.sender) === null || _d === void 0 ? void 0 : _d.email;
|
|
55
|
+
if (typeof senderEmailByProjectSettings === 'string' && senderEmailByProjectSettings.length > 0) {
|
|
56
|
+
emailMessageFrom.email = senderEmailByProjectSettings;
|
|
57
|
+
}
|
|
48
58
|
let subject;
|
|
49
59
|
// 互換性維持対応として、String型に対応
|
|
50
60
|
if (typeof emailMessage.about === 'string') {
|
|
@@ -52,7 +62,7 @@ function sendEmailMessage(params) {
|
|
|
52
62
|
subject = String(emailMessage.about);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
|
-
else if (typeof ((
|
|
65
|
+
else if (typeof ((_e = emailMessage.about) === null || _e === void 0 ? void 0 : _e.name) === 'string') {
|
|
56
66
|
if (emailMessage.about.name.length > 0) {
|
|
57
67
|
subject = emailMessage.about.name;
|
|
58
68
|
}
|
|
@@ -69,10 +79,7 @@ function sendEmailMessage(params) {
|
|
|
69
79
|
name: emailMessage.toRecipient.name,
|
|
70
80
|
email: emailMessage.toRecipient.email
|
|
71
81
|
}];
|
|
72
|
-
const msg = Object.assign(Object.assign(Object.assign({ to: emailDatas, from: {
|
|
73
|
-
name: emailMessage.sender.name,
|
|
74
|
-
email: emailMessage.sender.email
|
|
75
|
-
} }, (typeof subject === 'string') ? { subject } : undefined), (String(emailMessage.text).length > 0) ? { text: String(emailMessage.text) } : undefined), {
|
|
82
|
+
const msg = Object.assign(Object.assign(Object.assign({ to: emailDatas, from: emailMessageFrom }, (typeof subject === 'string') ? { subject } : undefined), (String(emailMessage.text).length > 0) ? { text: String(emailMessage.text) } : undefined), {
|
|
76
83
|
// html: '<strong>and easy to do anywhere, even with Node.js</strong>',
|
|
77
84
|
// categories: ['Transactional', 'My category'],
|
|
78
85
|
// 送信予定を追加することもできるが、タスクの実行予定日時でコントロールする想定
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.326.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.326.0-alpha.2",
|
|
13
13
|
"@cinerino/sdk": "3.165.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.7.0-alpha.
|
|
120
|
+
"version": "21.7.0-alpha.17"
|
|
121
121
|
}
|