@chevre/domain 24.1.0-alpha.37 → 24.1.0-alpha.39

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.
@@ -1,20 +1,8 @@
1
- import type { CustomSearchCredentials } from './credentials/customSearch';
2
- import type { LINENotifyCredentials } from './credentials/lineNotify';
3
- import type { SendGridCredentials } from './credentials/sendGrid';
4
1
  /**
5
2
  * 外部サービス認証情報
6
3
  */
7
- export declare namespace credentials {
8
- type CustomSearch = CustomSearchCredentials;
9
- namespace CustomSearch {
10
- function createInstance(...params: ConstructorParameters<typeof CustomSearchCredentials>): Promise<CustomSearchCredentials>;
11
- }
12
- type LINENotify = LINENotifyCredentials;
13
- namespace LINENotify {
14
- function createInstance(...params: ConstructorParameters<typeof LINENotifyCredentials>): Promise<LINENotifyCredentials>;
15
- }
16
- type SendGrid = SendGridCredentials;
17
- namespace SendGrid {
18
- function createInstance(...params: ConstructorParameters<typeof SendGridCredentials>): Promise<SendGridCredentials>;
19
- }
4
+ import type { SendGridCredentials } from './credentials/sendGrid';
5
+ export type SendGrid = SendGridCredentials;
6
+ export declare namespace SendGrid {
7
+ function createInstance(...params: ConstructorParameters<typeof SendGridCredentials>): Promise<SendGridCredentials>;
20
8
  }
@@ -1,42 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.credentials = void 0;
4
- /**
5
- * 外部サービス認証情報
6
- */
7
- var credentials;
8
- (function (credentials) {
9
- let CustomSearch;
10
- (function (CustomSearch) {
11
- let cred;
12
- async function createInstance(...params) {
13
- if (cred === undefined) {
14
- cred = (await import('./credentials/customSearch.js')).CustomSearchCredentials;
15
- }
16
- return new cred(...params);
3
+ exports.SendGrid = void 0;
4
+ var SendGrid;
5
+ (function (SendGrid) {
6
+ let cred;
7
+ async function createInstance(...params) {
8
+ if (cred === undefined) {
9
+ cred = (await import('./credentials/sendGrid.js')).SendGridCredentials;
17
10
  }
18
- CustomSearch.createInstance = createInstance;
19
- })(CustomSearch = credentials.CustomSearch || (credentials.CustomSearch = {}));
20
- let LINENotify;
21
- (function (LINENotify) {
22
- let cred;
23
- async function createInstance(...params) {
24
- if (cred === undefined) {
25
- cred = (await import('./credentials/lineNotify.js')).LINENotifyCredentials;
26
- }
27
- return new cred(...params);
28
- }
29
- LINENotify.createInstance = createInstance;
30
- })(LINENotify = credentials.LINENotify || (credentials.LINENotify = {}));
31
- let SendGrid;
32
- (function (SendGrid) {
33
- let cred;
34
- async function createInstance(...params) {
35
- if (cred === undefined) {
36
- cred = (await import('./credentials/sendGrid.js')).SendGridCredentials;
37
- }
38
- return new cred(...params);
39
- }
40
- SendGrid.createInstance = createInstance;
41
- })(SendGrid = credentials.SendGrid || (credentials.SendGrid = {}));
42
- })(credentials || (exports.credentials = credentials = {}));
11
+ return new cred(...params);
12
+ }
13
+ SendGrid.createInstance = createInstance;
14
+ })(SendGrid || (exports.SendGrid = SendGrid = {}));
@@ -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,4 +1,4 @@
1
- import { credentials } from './credentials';
1
+ import * as credentials from './credentials';
2
2
  import * as errorHandler from './errorHandler';
3
3
  import * as eventEmitter from './eventEmitter';
4
4
  import { factory } from './factory';
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.taskSettings = exports.settings = exports.service = exports.repository = exports.factory = exports.eventEmitter = exports.errorHandler = exports.credentials = void 0;
37
- const credentials_1 = require("./credentials");
38
- Object.defineProperty(exports, "credentials", { enumerable: true, get: function () { return credentials_1.credentials; } });
37
+ const credentials = __importStar(require("./credentials"));
38
+ exports.credentials = credentials;
39
39
  const errorHandler = __importStar(require("./errorHandler"));
40
40
  exports.errorHandler = errorHandler;
41
41
  const eventEmitter = __importStar(require("./eventEmitter"));
@@ -5,12 +5,6 @@ const client_1 = require("@sendgrid/client");
5
5
  const http_status_1 = require("http-status");
6
6
  const util_1 = require("util");
7
7
  const factory_1 = require("../../factory");
8
- // type ILineNotifyOperation<T> = (
9
- // repos: undefined,
10
- // credentials: {
11
- // lineNotify: LINENotifyCredentials;
12
- // }
13
- // ) => Promise<T>;
14
8
  function notifyByEmail(params) {
15
9
  return async (__, credentials) => {
16
10
  const { logLevel } = params;
@@ -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)(settings, {
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)(settings, {
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 as Settings } from './repo/setting/integration';
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
- settings: Settings;
42
+ /**
43
+ * 外部連携設定リポジトリ
44
+ */
45
+ settings: IntegrationSettingRepo;
43
46
  aggregationSettings?: AggregationSettings;
44
47
  }
45
48
  interface IExecuteOptions {
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.1.0-alpha.37"
94
+ "version": "24.1.0-alpha.39"
95
95
  }
@@ -1,13 +0,0 @@
1
- interface IOptions {
2
- engineId: string;
3
- apiKey: string;
4
- }
5
- /**
6
- * GoogleCustomSearch認証情報
7
- */
8
- declare class CustomSearchCredentials {
9
- readonly engineId: string;
10
- readonly apiKey: string;
11
- constructor(options: IOptions);
12
- }
13
- export { CustomSearchCredentials };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CustomSearchCredentials = void 0;
4
- /**
5
- * GoogleCustomSearch認証情報
6
- */
7
- class CustomSearchCredentials {
8
- engineId;
9
- apiKey;
10
- constructor(options) {
11
- const { engineId, apiKey } = options;
12
- this.engineId = engineId;
13
- this.apiKey = apiKey;
14
- }
15
- }
16
- exports.CustomSearchCredentials = CustomSearchCredentials;
@@ -1,17 +0,0 @@
1
- interface IOptions {
2
- url: string;
3
- accessToken: string;
4
- accessTokenAlert: string;
5
- accessTokenInfo: string;
6
- }
7
- /**
8
- * 通知認証情報
9
- */
10
- declare class LINENotifyCredentials {
11
- readonly url: string;
12
- readonly accessToken: string;
13
- readonly accessTokenAlert: string;
14
- readonly accessTokenInfo: string;
15
- constructor(options: IOptions);
16
- }
17
- export { LINENotifyCredentials };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LINENotifyCredentials = void 0;
4
- /**
5
- * 通知認証情報
6
- */
7
- class LINENotifyCredentials {
8
- url;
9
- accessToken;
10
- accessTokenAlert;
11
- accessTokenInfo;
12
- constructor(options) {
13
- const { url, accessToken, accessTokenAlert, accessTokenInfo } = options;
14
- this.url = url;
15
- this.accessToken = accessToken;
16
- this.accessTokenAlert = accessTokenAlert;
17
- this.accessTokenInfo = accessTokenInfo;
18
- }
19
- }
20
- exports.LINENotifyCredentials = LINENotifyCredentials;