@chevre/domain 24.1.0-alpha.37 → 24.1.0-alpha.38
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.
|
@@ -93,9 +93,7 @@ async function createEmailMessageAbout(params) {
|
|
|
93
93
|
}
|
|
94
94
|
return about;
|
|
95
95
|
}
|
|
96
|
-
function createEmailMessageSender(params,
|
|
97
|
-
// settings: Settings
|
|
98
|
-
setting) {
|
|
96
|
+
function createEmailMessageSender(params, setting) {
|
|
99
97
|
if (typeof setting.defaultSenderEmail !== 'string') {
|
|
100
98
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
101
99
|
}
|
|
@@ -113,9 +111,7 @@ setting) {
|
|
|
113
111
|
/**
|
|
114
112
|
* 注文配送メッセージを作成する
|
|
115
113
|
*/
|
|
116
|
-
async function createSendOrderMessage(params,
|
|
117
|
-
// settings: Settings
|
|
118
|
-
setting) {
|
|
114
|
+
async function createSendOrderMessage(params, setting) {
|
|
119
115
|
const emailMessageText = await createEmailMessageText({
|
|
120
116
|
order: params.order,
|
|
121
117
|
email: params.email,
|
|
@@ -169,9 +165,7 @@ setting) {
|
|
|
169
165
|
/**
|
|
170
166
|
* 注文返品メッセージを作成する
|
|
171
167
|
*/
|
|
172
|
-
async function createReturnOrderMessage(params,
|
|
173
|
-
// settings: Settings
|
|
174
|
-
setting) {
|
|
168
|
+
async function createReturnOrderMessage(params, setting) {
|
|
175
169
|
const emailMessageText = await createEmailMessageText({
|
|
176
170
|
order: params.order,
|
|
177
171
|
email: params.email,
|
|
@@ -225,9 +219,7 @@ setting) {
|
|
|
225
219
|
/**
|
|
226
220
|
* 返金メッセージを作成する
|
|
227
221
|
*/
|
|
228
|
-
async function createRefundMessage(params,
|
|
229
|
-
// settings: Settings
|
|
230
|
-
setting) {
|
|
222
|
+
async function createRefundMessage(params, setting) {
|
|
231
223
|
const emailMessageText = await createEmailMessageText({
|
|
232
224
|
order: params.order,
|
|
233
225
|
email: params.email
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { SendGridCredentials } from '../credentials/sendGrid';
|
|
2
2
|
import type { IExecuteSettings as IMinimumExecuteSettings, INextFunction, IReadyTask, IRunningTask } from '../eventEmitter/task';
|
|
3
3
|
import { factory } from '../factory';
|
|
4
|
-
import type { IntegrationSettingRepo as Settings } from '../repo/setting/integration';
|
|
5
4
|
import type { AggregationSettings } from '../taskSettings';
|
|
6
5
|
interface ICredentialSettings {
|
|
7
6
|
sendGrid: SendGridCredentials;
|
|
8
7
|
}
|
|
9
8
|
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
10
9
|
credentials: ICredentialSettings;
|
|
11
|
-
settings: Settings;
|
|
12
10
|
aggregationSettings?: AggregationSettings;
|
|
13
11
|
}
|
|
14
12
|
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
@@ -17,6 +17,7 @@ const debug = (0, debug_1.default)('chevre-domain:service:task');
|
|
|
17
17
|
function executeById(params, next) {
|
|
18
18
|
return async (settings) => {
|
|
19
19
|
const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
|
|
20
|
+
const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
|
|
20
21
|
const { id, status, executor, expires } = params;
|
|
21
22
|
let task = null;
|
|
22
23
|
try {
|
|
@@ -34,7 +35,10 @@ function executeById(params, next) {
|
|
|
34
35
|
}
|
|
35
36
|
// タスクがなければ終了
|
|
36
37
|
if (task !== null) {
|
|
37
|
-
await (0, taskHandler_1.executeTask)(task, (typeof next === 'function') ? next : undefined)(
|
|
38
|
+
await (0, taskHandler_1.executeTask)(task, (typeof next === 'function') ? next : undefined)({
|
|
39
|
+
...settings,
|
|
40
|
+
settings: integrationSettingRepo
|
|
41
|
+
}, {
|
|
38
42
|
executeById: true,
|
|
39
43
|
executeByName: false
|
|
40
44
|
});
|
|
@@ -44,6 +48,7 @@ function executeById(params, next) {
|
|
|
44
48
|
function executeOneIfExists(params) {
|
|
45
49
|
return async (settings) => {
|
|
46
50
|
const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
|
|
51
|
+
const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
|
|
47
52
|
// 未実行のタスクを取得
|
|
48
53
|
let task = null;
|
|
49
54
|
try {
|
|
@@ -61,7 +66,10 @@ function executeOneIfExists(params) {
|
|
|
61
66
|
}
|
|
62
67
|
// タスクがなければ終了
|
|
63
68
|
if (task !== null) {
|
|
64
|
-
await (0, taskHandler_1.executeTask)(task)(
|
|
69
|
+
await (0, taskHandler_1.executeTask)(task)({
|
|
70
|
+
...settings,
|
|
71
|
+
settings: integrationSettingRepo
|
|
72
|
+
}, {
|
|
65
73
|
executeById: false,
|
|
66
74
|
executeByName: (typeof params.name?.$eq === 'string')
|
|
67
75
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SendGridCredentials } from './credentials/sendGrid';
|
|
2
2
|
import type { IExecuteSettings as IMinimumExecuteSettings } from './eventEmitter/task';
|
|
3
3
|
import { factory } from './factory';
|
|
4
|
-
import type { IntegrationSettingRepo
|
|
4
|
+
import type { IntegrationSettingRepo } from './repo/setting/integration';
|
|
5
5
|
interface IOnOrderStatusChanged {
|
|
6
6
|
informOrder2hub?: factory.project.IInformParams[];
|
|
7
7
|
}
|
|
@@ -39,7 +39,10 @@ interface ICredentialSettings {
|
|
|
39
39
|
}
|
|
40
40
|
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
41
41
|
credentials: ICredentialSettings;
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* 外部連携設定リポジトリ
|
|
44
|
+
*/
|
|
45
|
+
settings: IntegrationSettingRepo;
|
|
43
46
|
aggregationSettings?: AggregationSettings;
|
|
44
47
|
}
|
|
45
48
|
interface IExecuteOptions {
|
package/package.json
CHANGED